mirror of
https://github.com/fluencelabs/js-libp2p
synced 2025-06-14 09:41:22 +00:00
feat: add delegated peer and content routing support (#242)
* feat: allow for configuring content and peer routing * feat: support multiple peer and content routing modules * docs: add delegated routing example
This commit is contained in:
@ -21,8 +21,7 @@ function createNode (multiaddrs, options, callback) {
|
||||
}
|
||||
|
||||
waterfall([
|
||||
(cb) => PeerId.create({ bits: 512 }, cb),
|
||||
(peerId, cb) => PeerInfo.create(peerId, cb),
|
||||
(cb) => createPeerInfo(cb),
|
||||
(peerInfo, cb) => {
|
||||
multiaddrs.map((ma) => peerInfo.multiaddrs.add(ma))
|
||||
options.peerInfo = peerInfo
|
||||
@ -31,4 +30,12 @@ function createNode (multiaddrs, options, callback) {
|
||||
], callback)
|
||||
}
|
||||
|
||||
function createPeerInfo (callback) {
|
||||
waterfall([
|
||||
(cb) => PeerId.create({ bits: 512 }, cb),
|
||||
(peerId, cb) => PeerInfo.create(peerId, cb)
|
||||
], callback)
|
||||
}
|
||||
|
||||
module.exports = createNode
|
||||
module.exports.createPeerInfo = createPeerInfo
|
||||
|
Reference in New Issue
Block a user