mirror of
https://github.com/fluencelabs/js-libp2p
synced 2025-04-25 10:32:14 +00:00
docs: Add bootstrap to custom peer discovery (#859)
This commit is contained in:
parent
42b51d8f01
commit
d60922b799
@ -261,13 +261,14 @@ const TCP = require('libp2p-tcp')
|
|||||||
const MPLEX = require('libp2p-mplex')
|
const MPLEX = require('libp2p-mplex')
|
||||||
const { NOISE } = require('libp2p-noise')
|
const { NOISE } = require('libp2p-noise')
|
||||||
const MulticastDNS = require('libp2p-mdns')
|
const MulticastDNS = require('libp2p-mdns')
|
||||||
|
const Bootstrap = require('libp2p-bootstrap')
|
||||||
|
|
||||||
const node = await Libp2p.create({
|
const node = await Libp2p.create({
|
||||||
modules: {
|
modules: {
|
||||||
transport: [TCP],
|
transport: [TCP],
|
||||||
streamMuxer: [MPLEX],
|
streamMuxer: [MPLEX],
|
||||||
connEncryption: [NOISE],
|
connEncryption: [NOISE],
|
||||||
peerDiscovery: [MulticastDNS]
|
peerDiscovery: [MulticastDNS, Bootstrap]
|
||||||
},
|
},
|
||||||
config: {
|
config: {
|
||||||
peerDiscovery: {
|
peerDiscovery: {
|
||||||
@ -277,6 +278,15 @@ const node = await Libp2p.create({
|
|||||||
[MulticastDNS.tag]: {
|
[MulticastDNS.tag]: {
|
||||||
interval: 1000,
|
interval: 1000,
|
||||||
enabled: true
|
enabled: true
|
||||||
|
},
|
||||||
|
[Bootstrap.tag:] {
|
||||||
|
list: [ // A list of bootstrap peers to connect to starting up the node
|
||||||
|
"/ip4/104.131.131.82/tcp/4001/ipfs/QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLuvuJ",
|
||||||
|
"/dnsaddr/bootstrap.libp2p.io/ipfs/QmNnooDu7bfjPFoTZYxMNLWUQJyrVwtbZg5gBMjTezGAJN",
|
||||||
|
"/dnsaddr/bootstrap.libp2p.io/ipfs/QmQCU2EcMqAqQPR2i9bChDtGNJchTbq5TbXJJ16u19uLTa",
|
||||||
|
],
|
||||||
|
interval: 2000,
|
||||||
|
enabled: true
|
||||||
}
|
}
|
||||||
// .. other discovery module options.
|
// .. other discovery module options.
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user