dht-rpc 6.8.2 → 6.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -0
- package/index.js +7 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -207,6 +207,10 @@ Boolean indicated if your node is behind a firewall.
|
|
|
207
207
|
This is auto detected by having other nodes trying to do a PING to you
|
|
208
208
|
without you contacting them first.
|
|
209
209
|
|
|
210
|
+
#### `node.randomized`
|
|
211
|
+
|
|
212
|
+
Boolean indicating if your node is likely behind a randomizing NAT.
|
|
213
|
+
|
|
210
214
|
#### `const addr = node.address()`
|
|
211
215
|
|
|
212
216
|
Get the local address of the UDP socket bound.
|
package/index.js
CHANGED
|
@@ -94,6 +94,10 @@ class DHT extends EventEmitter {
|
|
|
94
94
|
return this._nat.port
|
|
95
95
|
}
|
|
96
96
|
|
|
97
|
+
get randomized () {
|
|
98
|
+
return this._nat.host !== null && (this._nat.port === 0)
|
|
99
|
+
}
|
|
100
|
+
|
|
97
101
|
get socket () {
|
|
98
102
|
return this.firewalled ? this.io.clientSocket : this.io.serverSocket
|
|
99
103
|
}
|
|
@@ -385,8 +389,9 @@ class DHT extends EventEmitter {
|
|
|
385
389
|
this._lastHost = null // clear network cache check
|
|
386
390
|
|
|
387
391
|
if (this.adaptive) {
|
|
388
|
-
this
|
|
389
|
-
this.
|
|
392
|
+
// TODO: re-enable this as soon as we find out why this is over triggering in some edge cases
|
|
393
|
+
// this.firewalled = true
|
|
394
|
+
// this.io.firewalled = true
|
|
390
395
|
|
|
391
396
|
if (!this.ephemeral) {
|
|
392
397
|
this.ephemeral = true
|