multiserver
Advanced tools
Comparing version 3.4.0 to 3.5.0
{ | ||
"name": "multiserver", | ||
"description": "write a server which works over many protocols at once, or connect to the same", | ||
"version": "3.4.0", | ||
"version": "3.5.0", | ||
"homepage": "https://github.com/dominictarr/multiserver", | ||
@@ -6,0 +6,0 @@ "repository": { |
@@ -7,2 +7,4 @@ var WS = require('pull-ws') | ||
var http = require('http') | ||
var https = require('https') | ||
var fs = require('fs') | ||
var debug = require('debug')('multiserver:ws') | ||
@@ -48,3 +50,3 @@ | ||
var secure = opts.server && !!opts.server.key | ||
var secure = opts.server && !!opts.server.key || (!!opts.key && !!opts.cert) | ||
return { | ||
@@ -65,4 +67,10 @@ name: 'ws', | ||
var server = opts.server || http.createServer(opts.handler) | ||
if (typeof opts.key === 'string') | ||
opts.key = fs.readFileSync(opts.key) | ||
if (typeof opts.cert === 'string') | ||
opts.cert = fs.readFileSync(opts.cert) | ||
var server = opts.server || | ||
(opts.key && opts.cert ? https.createServer({ key: opts.key, cert: opts.cert }, opts.handler) : http.createServer(opts.handler)) | ||
WS.createServer(Object.assign({}, opts, {server: server}), function (stream) { | ||
@@ -69,0 +77,0 @@ stream.address = safe_origin( |
@@ -93,7 +93,7 @@ # multiserver | ||
keys: keys, | ||
appKey: appKey //application key | ||
appKey: appKey, //application key | ||
auth: accept_all | ||
}), | ||
] | ||
] | ||
]) | ||
@@ -232,3 +232,3 @@ console.log(ms.stringify()) | ||
``` | ||
### `WebSockets({host,port,scope,handler?})` | ||
### `WebSockets({host,port,scope,handler?,key?,cert?})` | ||
@@ -245,2 +245,5 @@ create a websocket server. Since websockets are | ||
If `opts.key` and `opts.cert` are provided as paths, a https server | ||
will be spawned. | ||
``` js | ||
@@ -247,0 +250,0 @@ var WebSockets = require('multiserver/plugins/ws`) |
@@ -307,2 +307,14 @@ var fs = require('fs') | ||
tape('wss with key and cert', function (t) { | ||
var ws = Ws({ | ||
external: 'domain.de', | ||
scope: 'public', | ||
key: 'path', | ||
cert: 'path' | ||
}) | ||
t.equal(ws.stringify('public'), 'wss://domain.de') | ||
t.equal(ws.stringify('local'), null) | ||
t.equal(ws.stringify('device'), null) | ||
t.end() | ||
}) | ||
@@ -309,0 +321,0 @@ var onion = Onion({scope: 'public'}) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 2 instances in 1 package
475
4
55635
17
1242
5