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:
Jacob Heun
2018-10-19 16:28:28 +02:00
committed by GitHub
parent 3226632d83
commit a95389a28e
18 changed files with 1155 additions and 147 deletions

View File

@ -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