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

Commit 179021f

Browse files
committed
feat: enable bootstrap to be an option
1 parent 00bd3e3 commit 179021f

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
"libp2p": "^0.5.1",
4848
"libp2p-mdns": "^0.6.0",
4949
"libp2p-multiplex": "^0.3.5",
50+
"libp2p-railing": "^0.4.0",
5051
"libp2p-secio": "^0.6.5",
5152
"libp2p-spdy": "^0.10.3",
5253
"libp2p-swarm": "^0.26.13",
@@ -70,4 +71,4 @@
7071
"greenkeeperio-bot <support@greenkeeper.io>",
7172
"varunagarwal315 <varunagarwal315@gmail.com>"
7273
]
73-
}
74+
}

src/index.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ const TCP = require('libp2p-tcp')
55
const WebRTCStar = require('libp2p-webrtc-star')
66
const MulticastDNS = require('libp2p-mdns')
77
const WS = require('libp2p-websockets')
8+
const Railing = require('libp2p-railing')
89
const spdy = require('libp2p-spdy')
910
const multiplex = require('libp2p-multiplex')
1011
const secio = require('libp2p-secio')
@@ -42,7 +43,13 @@ class Node extends libp2p {
4243
}
4344

4445
if (options.mdns) {
45-
modules.discovery.push(new MulticastDNS(peerInfo, 'ipfs.local'))
46+
const mdns = new MulticastDNS(peerInfo, 'ipfs.local')
47+
modules.discovery.push(mdns)
48+
}
49+
50+
if (options.bootstrap && process.env.IPFS_BOOTSTRAP) {
51+
const r = new Railing(options.bootstrap)
52+
modules.discovery.push(r)
4653
}
4754

4855
super(modules, peerInfo, peerBook, options)

0 commit comments

Comments
 (0)