peer-exchange
Advanced tools
Comparing version 0.4.1 to 0.5.0
@@ -90,2 +90,3 @@ 'use strict'; | ||
peer.incoming = !outgoing; | ||
peer.transport = socket.transport; | ||
peer.once('error', function (err) { | ||
@@ -122,3 +123,3 @@ _this3.removePeer(peer); | ||
if (_this4._accepts[transportId]) { | ||
unaccept(); | ||
if (unaccept) unaccept(); | ||
return cb(alreadyAcceptingError); | ||
@@ -125,0 +126,0 @@ } |
'use strict'; | ||
var http = require('http'); | ||
var https = require('https'); | ||
var getBrowserRTC = require('get-browser-rtc'); | ||
@@ -53,7 +54,12 @@ var SimplePeer = require('simple-peer'); | ||
accept: function accept(opts, onConnection, cb) { | ||
// TODO: option for already-created http(s) server | ||
if (!opts.port) { | ||
throw new Error('Must specify "port" option'); | ||
} | ||
var server = http.createServer(); | ||
var httpsOpts; | ||
if (opts.https) { | ||
httpsOpts = opts.https; | ||
delete opts.https; | ||
opts.secure = true; | ||
} | ||
var server = httpsOpts ? https.createServer(https) : http.createServer(); | ||
server.on('error', cb); | ||
@@ -60,0 +66,0 @@ server.listen(opts.port, function () { |
@@ -24,4 +24,4 @@ 'use strict'; | ||
if (socket._socket) { | ||
var address = getRemoteAddress(socket._socket); | ||
if (address) return address; | ||
var _address = getRemoteAddress(socket._socket); | ||
if (_address) return _address; | ||
} | ||
@@ -28,0 +28,0 @@ } |
{ | ||
"name": "peer-exchange", | ||
"version": "0.4.1", | ||
"version": "0.5.0", | ||
"description": "Decentralized peer discovery and signaling", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
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
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
89432
922
4