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

@ -20,8 +20,6 @@ const pubsub = require('./pubsub')
const getPeerInfo = require('./get-peer-info')
const validateConfig = require('./config').validate
exports = module.exports
const NOT_STARTED_ERROR_MESSAGE = 'The libp2p node is not started yet'
class Node extends EventEmitter {
@ -102,6 +100,7 @@ class Node extends EventEmitter {
}
// Attach remaining APIs
// peer and content routing will automatically get modules from _modules and _dht
this.peerRouting = peerRouting(this)
this.contentRouting = contentRouting(this)
this.dht = dht(this)