Comparing version 1.0.0 to 1.0.1
@@ -31,4 +31,3 @@ # DPT | ||
binds the upd socket to `this.udpPort` and `this.address`. This is called | ||
automatically by the constuctor. | ||
Binds the upd socket to `this.udpPort` and `this.address`. | ||
@@ -35,0 +34,0 @@ ## bootStrap |
@@ -11,4 +11,6 @@ const DHT = require('../index.js') | ||
dht.bind() | ||
dht.on('message', function () { | ||
console.log('get message') | ||
}) |
@@ -11,2 +11,3 @@ const DHT = require('../index.js') | ||
dht.bind() | ||
console.log('id: ' + dht.id.toString('hex')) | ||
@@ -13,0 +14,0 @@ |
@@ -11,2 +11,4 @@ const DHT = require('../index.js') | ||
dht.bind() | ||
dht.socket.on('message', function (msg, rinfo) { | ||
@@ -13,0 +15,0 @@ console.log('server got msg from ' + rinfo.address + ':' + rinfo.port) |
@@ -118,3 +118,3 @@ // Implements ethereum's DPT | ||
this.secKey = opts.secretKey | ||
this.publicAddress = opts.publicAddress || opts.address | ||
this.publicAddress = opts.publicAddress || opts.address || '0.0.0.0' | ||
this.address = opts.address || opts.publicAddress | ||
@@ -147,4 +147,2 @@ this.publicUdpPort = opts.publicUdpPort || opts.udpPort || opts.port | ||
dhtLogic(this) | ||
// bind udp socket | ||
this.bind() | ||
} | ||
@@ -155,8 +153,18 @@ | ||
/** | ||
* binds the upd socket to `this.udpPort` and `this.address`. This is called | ||
* automatically by the constuctor. | ||
* binds the upd socket to `this.udpPort` and `this.address`. | ||
* @method bind | ||
*/ | ||
DPT.prototype.bind = function () { | ||
this.socket.bind({port: this.udpPort, address: this.address}) | ||
DPT.prototype.bind = function (port, address) { | ||
this.address = address = address || this.address | ||
this.udpPort = port = port || this.udpPort | ||
if (!this.publicUdpPort) { | ||
this.publicUdpPort = this.udpPort | ||
} | ||
if (!this.tcpPort) { | ||
this.tcpPort = this.udpPort | ||
} | ||
this.socket.bind({port: port, address: address}) | ||
} | ||
@@ -163,0 +171,0 @@ |
{ | ||
"name": "devp2p-dpt", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "an implemention of ethereum's DHT", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -32,2 +32,4 @@ const tape = require('tape') | ||
dht.bind() | ||
var dht2 = new DHT({ | ||
@@ -39,2 +41,4 @@ port: port + 1, | ||
dht2.bind() | ||
dht2.ping({ | ||
@@ -41,0 +45,0 @@ port: port, |
@@ -13,2 +13,3 @@ var tape = require('tape') | ||
}) | ||
dht.bind() | ||
@@ -15,0 +16,0 @@ cb(null, dht) |
@@ -17,2 +17,3 @@ const tape = require('tape') | ||
}) | ||
dht.bind() | ||
nodes.push(dht) | ||
@@ -19,0 +20,0 @@ } |
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
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
144587
1049
1
8