diff --git a/package.json b/package.json index 3124e1a..5bb9284 100644 --- a/package.json +++ b/package.json @@ -44,6 +44,7 @@ }, "dependencies": { "libp2p": "^0.5.1", + "libp2p-railing": "^0.4.0", "libp2p-secio": "^0.6.5", "libp2p-spdy": "^0.10.3", "libp2p-swarm": "^0.26.13", @@ -61,4 +62,4 @@ "Richard Littauer ", "greenkeeperio-bot " ] -} \ No newline at end of file +} diff --git a/src/index.js b/src/index.js index 3b9f0bc..d480a48 100644 --- a/src/index.js +++ b/src/index.js @@ -4,10 +4,12 @@ const WS = require('libp2p-websockets') const WebRTCStar = require('libp2p-webrtc-star') const spdy = require('libp2p-spdy') const secio = require('libp2p-secio') +const Railing = require('libp2p-railing') const libp2p = require('libp2p') class Node extends libp2p { constructor (peerInfo, peerBook, options) { + options = options || {} const webRTCStar = new WebRTCStar() const modules = { @@ -27,6 +29,12 @@ class Node extends libp2p { webRTCStar.discovery ] } + + if (options.bootstrap && process.env.IPFS_BOOTSTRAP) { + const r = new Railing(options.bootstrap) + modules.discovery.push(r) + } + super(modules, peerInfo, peerBook, options) } }