Skip to content
This repository has been archived by the owner on Apr 29, 2020. It is now read-only.

Commit

Permalink
feat: enable bootstrap to be an option
Browse files Browse the repository at this point in the history
  • Loading branch information
daviddias committed Jan 29, 2017
1 parent 00bd3e3 commit 179021f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
"libp2p": "^0.5.1",
"libp2p-mdns": "^0.6.0",
"libp2p-multiplex": "^0.3.5",
"libp2p-railing": "^0.4.0",
"libp2p-secio": "^0.6.5",
"libp2p-spdy": "^0.10.3",
"libp2p-swarm": "^0.26.13",
Expand All @@ -70,4 +71,4 @@
"greenkeeperio-bot <support@greenkeeper.io>",
"varunagarwal315 <varunagarwal315@gmail.com>"
]
}
}
9 changes: 8 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ const TCP = require('libp2p-tcp')
const WebRTCStar = require('libp2p-webrtc-star')
const MulticastDNS = require('libp2p-mdns')
const WS = require('libp2p-websockets')
const Railing = require('libp2p-railing')
const spdy = require('libp2p-spdy')
const multiplex = require('libp2p-multiplex')
const secio = require('libp2p-secio')
Expand Down Expand Up @@ -42,7 +43,13 @@ class Node extends libp2p {
}

if (options.mdns) {
modules.discovery.push(new MulticastDNS(peerInfo, 'ipfs.local'))
const mdns = new MulticastDNS(peerInfo, 'ipfs.local')
modules.discovery.push(mdns)
}

if (options.bootstrap && process.env.IPFS_BOOTSTRAP) {
const r = new Railing(options.bootstrap)
modules.discovery.push(r)
}

super(modules, peerInfo, peerBook, options)
Expand Down

0 comments on commit 179021f

Please sign in to comment.