mirror of
https://github.com/fluencelabs/js-libp2p
synced 2025-06-26 07:21:36 +00:00
fix: start kad dht random walk (#251)
* fix: start kad dht random walk * chore: added tests and stop random walk * chore: allows to disable discovery for dht * chore: upgrade kad-dht version
This commit is contained in:
@ -29,7 +29,8 @@ const OptionsSchema = Joi.object({
|
||||
})
|
||||
}).default(),
|
||||
dht: Joi.object().keys({
|
||||
kBucketSize: Joi.number().allow(null)
|
||||
kBucketSize: Joi.number().allow(null),
|
||||
enabledDiscovery: Joi.boolean().default(true)
|
||||
}),
|
||||
EXPERIMENTAL: Joi.object().keys({
|
||||
dht: Joi.boolean().default(false),
|
||||
|
@ -85,8 +85,11 @@ class Node extends EventEmitter {
|
||||
// dht provided components (peerRouting, contentRouting, dht)
|
||||
if (this._config.EXPERIMENTAL.dht) {
|
||||
const DHT = this._modules.dht
|
||||
const enabledDiscovery = this._config.dht.enabledDiscovery !== false
|
||||
|
||||
this._dht = new DHT(this._switch, {
|
||||
kBucketSize: this._config.dht.kBucketSize || 20,
|
||||
enabledDiscovery,
|
||||
// TODO make datastore an option of libp2p itself so
|
||||
// that other things can use it as well
|
||||
datastore: dht.datastore
|
||||
|
Reference in New Issue
Block a user