mirror of
https://github.com/fluencelabs/js-libp2p
synced 2025-06-23 14:01:35 +00:00
feat: prepare for new randomWalk config parameters
As per: https://github.com/libp2p/js-libp2p-kad-dht/issues/76 fix: pass whole dht config into DHT constructor
This commit is contained in:
committed by
Jacob Heun
parent
679d446daa
commit
91e60d4253
@ -34,7 +34,12 @@ const OptionsSchema = Joi.object({
|
||||
dht: Joi.object().keys({
|
||||
kBucketSize: Joi.number().default(20),
|
||||
enabled: Joi.boolean().default(true),
|
||||
enabledDiscovery: Joi.boolean().default(true),
|
||||
randomWalk: Joi.object().keys({
|
||||
enabled: Joi.boolean().default(true),
|
||||
queriesPerPeriod: Joi.number().default(1),
|
||||
interval: Joi.number().default(30000),
|
||||
timeout: Joi.number().default(10000)
|
||||
}).default(),
|
||||
validators: Joi.object().allow(null),
|
||||
selectors: Joi.object().allow(null)
|
||||
}).default(),
|
||||
|
@ -105,14 +105,10 @@ class Node extends EventEmitter {
|
||||
// dht provided components (peerRouting, contentRouting, dht)
|
||||
if (this._config.dht.enabled) {
|
||||
const DHT = this._modules.dht
|
||||
const enabledDiscovery = this._config.dht.enabledDiscovery !== false
|
||||
|
||||
this._dht = new DHT(this._switch, {
|
||||
kBucketSize: this._config.dht.kBucketSize,
|
||||
enabledDiscovery,
|
||||
datastore: this.datastore,
|
||||
validators: this._config.dht.validators,
|
||||
selectors: this._config.dht.selectors
|
||||
...this._config.dht
|
||||
})
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user