This repository was archived by the owner on Feb 12, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +7
-7
lines changed
Expand file tree Collapse file tree 3 files changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ module.exports = function libp2p (self) {
1919 webRTCStar : get ( config , 'Discovery.webRTCStar.Enabled' ) ,
2020 bootstrap : get ( config , 'Bootstrap' ) ,
2121 dht : get ( self . _options , 'EXPERIMENTAL.dht' ) ,
22- modules : get ( self . _options , 'libp2p.modules' )
22+ modules : self . _libp2pModules
2323 }
2424
2525 self . _libp2pNode = new Node ( self . _peerInfo , self . _peerInfoBook , options )
Original file line number Diff line number Diff line change @@ -27,6 +27,7 @@ class IPFS extends EventEmitter {
2727 }
2828
2929 options = options || { }
30+ this . _libp2pModules = options . libp2p && options . libp2p . modules
3031
3132 extend ( this . _options , options )
3233
Original file line number Diff line number Diff line change @@ -32,18 +32,16 @@ function HttpApi (repo, config) {
3232
3333 series ( [
3434 ( cb ) => {
35- const libp2p = {
36- modules : { }
37- }
35+ const libp2p = { modules : { } }
3836
3937 // Attempt to use any of the WebRTC versions available globally
4038 let electronWebRTC
4139 let wrtc
4240 try { electronWebRTC = require ( 'electron-webrtc' ) ( ) } catch ( err ) { }
4341 try { wrtc = require ( 'wrtc' ) } catch ( err ) { }
4442
45- if ( electronWebRTC || wrtc ) {
46- const wstar = new WStar ( electronWebRTC || wrtc )
43+ if ( wrtc || electronWebRTC ) {
44+ const wstar = new WStar ( { wrtc : ( wrtc || electronWebRTC ) } )
4745 libp2p . modules . transport = [ wstar ]
4846 libp2p . modules . discovery = [ wstar . discovery ]
4947 }
@@ -59,7 +57,8 @@ function HttpApi (repo, config) {
5957 EXPERIMENTAL : {
6058 pubsub : true ,
6159 sharding : config && config . enableShardingExperiment
62- }
60+ } ,
61+ libp2p : libp2p
6362 } )
6463 } catch ( err ) {
6564 return cb ( err )
You can’t perform that action at this time.
0 commit comments