2019-11-26 16:40:04 +01:00
|
|
|
'use strict'
|
|
|
|
|
|
|
|
const KadDht = require('libp2p-kad-dht')
|
|
|
|
const { multicodec } = require('libp2p-kad-dht')
|
2019-12-01 22:54:59 +01:00
|
|
|
const Crypto = require('../../../src/insecure/plaintext')
|
2019-11-26 16:40:04 +01:00
|
|
|
const Muxer = require('libp2p-mplex')
|
|
|
|
const Transport = require('libp2p-tcp')
|
|
|
|
|
|
|
|
const mergeOptions = require('merge-options')
|
|
|
|
|
|
|
|
const baseOptions = {
|
|
|
|
modules: {
|
|
|
|
transport: [Transport],
|
|
|
|
streamMuxer: [Muxer],
|
|
|
|
connEncryption: [Crypto]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
module.exports.baseOptions = baseOptions
|
|
|
|
|
|
|
|
const subsystemOptions = mergeOptions(baseOptions, {
|
|
|
|
modules: {
|
|
|
|
dht: KadDht
|
|
|
|
},
|
|
|
|
config: {
|
|
|
|
dht: {
|
|
|
|
kBucketSize: 20,
|
|
|
|
randomWalk: {
|
|
|
|
enabled: true
|
|
|
|
},
|
|
|
|
enabled: true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
|
|
|
module.exports.subsystemOptions = subsystemOptions
|
|
|
|
module.exports.subsystemMulticodecs = [multicodec]
|