Package Exports
- libp2p-bootstrap
- libp2p-bootstrap/src/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (libp2p-bootstrap) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
js-libp2p-bootstrap
JavaScript libp2p Implementation of the railing process of a Node through a bootstrap peer list
Lead Maintainer
Usage
const Libp2p = require('libp2p')
const Bootstrap = require('libp2p-bootstrap')
const TCP = require('libp2p-tcp')
const { NOISE } = require('libp2p-noise')
const MPLEX = require('libp2p-mplex')
let options = {
modules: {
transport: [ TCP ],
peerDiscovery: [ Bootstrap ],
streamMuxer: [ MPLEX ],
encryption: [ NOISE ]
},
config: {
peerDiscovery: {
[Bootstrap.tag]: {
list: [ // a list of bootstrap peer multiaddrs to connect to on node startup
"/ip4/104.131.131.82/tcp/4001/ipfs/QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLuvuJ",
"/dnsaddr/bootstrap.libp2p.io/ipfs/QmNnooDu7bfjPFoTZYxMNLWUQJyrVwtbZg5gBMjTezGAJN",
"/dnsaddr/bootstrap.libp2p.io/ipfs/QmQCU2EcMqAqQPR2i9bChDtGNJchTbq5TbXJJ16u19uLTa"
],
interval: 5000 // default is 10 ms,
enabled: true
}
}
}
}
async function start () {
let libp2p = await Libp2p.create(options)
libp2p.on('peer:discovery', function (peerId) {
console.log('found peer: ', peerId.toB58String())
})
await libp2p.start()
}
start()