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

Commit c304b65

Browse files
committed
feat: enable bootstrap to be an option
1 parent 990f1a7 commit c304b65

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
},
4545
"dependencies": {
4646
"libp2p": "^0.5.1",
47+
"libp2p-railing": "^0.4.0",
4748
"libp2p-secio": "^0.6.5",
4849
"libp2p-spdy": "^0.10.3",
4950
"libp2p-swarm": "^0.26.13",
@@ -61,4 +62,4 @@
6162
"Richard Littauer <richard.littauer@gmail.com>",
6263
"greenkeeperio-bot <support@greenkeeper.io>"
6364
]
64-
}
65+
}

src/index.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ const WS = require('libp2p-websockets')
44
const WebRTCStar = require('libp2p-webrtc-star')
55
const spdy = require('libp2p-spdy')
66
const secio = require('libp2p-secio')
7+
const Railing = require('libp2p-railing')
78
const libp2p = require('libp2p')
89

910
class Node extends libp2p {
@@ -27,6 +28,12 @@ class Node extends libp2p {
2728
webRTCStar.discovery
2829
]
2930
}
31+
32+
if (options.bootstrap && process.env.IPFS_BOOTSTRAP) {
33+
const r = new Railing(options.bootstrap)
34+
modules.discovery.push(r)
35+
}
36+
3037
super(modules, peerInfo, peerBook, options)
3138
}
3239
}

0 commit comments

Comments
 (0)