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

Commit 2db8470

Browse files
authored
Merge pull request #146 from ipfs/webrtc-opt
do not enable webrtc discovery by default
2 parents a57d8e8 + 9ddfa95 commit 2db8470

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

src/index.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,11 @@ class Node extends libp2p {
2525
secio
2626
]
2727
},
28-
discovery: [
29-
webRTCStar.discovery
30-
]
28+
discovery: []
29+
}
30+
31+
if (options.webRTCStar) {
32+
modules.discovery.push(webRTCStar.discovery)
3133
}
3234

3335
if (options.bootstrap && process.env.IPFS_BOOTSTRAP) {

test/webrtc-star-only.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ describe('libp2p-ipfs-browser (webrtc only)', () => {
3636
})
3737

3838
it('create two libp2p nodes with those peers', (done) => {
39-
node1 = new Node(peer1)
40-
node2 = new Node(peer2)
39+
node1 = new Node(peer1, null, { webRTCStar: true })
40+
node2 = new Node(peer2, null, { webRTCStar: true })
4141
done()
4242
})
4343

@@ -122,7 +122,7 @@ describe('libp2p-ipfs-browser (webrtc only)', () => {
122122
node1.discovery.on('peer', (peerInfo) => node1.dialByPeerInfo(peerInfo, check))
123123
node2.discovery.on('peer', (peerInfo) => node2.dialByPeerInfo(peerInfo, check))
124124

125-
const node3 = new Node(peer3)
125+
const node3 = new Node(peer3, null, { webRTCStar: true })
126126
node3.start(check)
127127
})
128128
})

0 commit comments

Comments
 (0)