libp2p/js-libp2p-bootstrap

example/try.js is not functional

jayarjo opened this issue · 2 comments

Example does not do anything:

var Bootstrap = require('./../src')
var b = new Bootstrap(Bootstrap.default)

console.log(b)

Apparently because Bootstrap.default is undefined.

What exactly does this module even do? I checked the source, it's kind of primitive, but what's the purpose?

Hello @jayarjo

The example is currently incorrect. Previous changes on the codebase made the .default not being used anymore. This should be:

var Bootstrap = require('./../src')
var b = new Bootstrap(Bootstrap)

console.log(b)

Thanks for reporting this. Are you willing to create a PR to update the example?

This module is used for bootstrapping a node in a network, through a list of addresses. It basically iterates through the received list, and if a valid address is found in each entry, an event is triggered, according to the libp2p/interface-peer-discovery.

Closing as all examples are in https://github.com/libp2p/js-libp2p repository and working^^