Browse Source

support setting id

v4
Mathias Buus 5 years ago
parent
commit
bfce70c8b2
  1. 3
      index.js

3
index.js

@ -27,7 +27,7 @@ class DHT extends EventEmitter {
this.concurrency = 16
this.concurrencyRPS = 50
this.socket = opts.socket || dgram.createSocket('udp4')
this.id = randomBytes(32)
this.id = opts.id || randomBytes(32)
this.inflightQueries = 0
this.ephemeral = !!opts.ephemeral
@ -410,6 +410,7 @@ class DHT extends EventEmitter {
}
}
exports.id = () => randomBytes(32)
exports.QUERY = DHT.QUERY = IO.QUERY
exports.UPDATE = DHT.UPDATE = IO.UPDATE
exports.DHT = DHT

Loading…
Cancel
Save