This repository was archived by the owner on Feb 12, 2024. It is now read-only.
File tree 3 files changed +8
-7
lines changed
3 files changed +8
-7
lines changed Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ module.exports = function libp2p (self) {
19
19
webRTCStar : get ( config , 'Discovery.webRTCStar.Enabled' ) ,
20
20
bootstrap : get ( config , 'Bootstrap' ) ,
21
21
dht : get ( self . _options , 'EXPERIMENTAL.dht' ) ,
22
- modules : get ( self . _options , 'libp2p.modules' )
22
+ modules : self . _libp2pModules
23
23
}
24
24
25
25
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 {
27
27
}
28
28
29
29
options = options || { }
30
+ this . _libp2pModules = options . libp2p && options . libp2p . modules
30
31
31
32
extend ( this . _options , options )
32
33
Original file line number Diff line number Diff line change @@ -32,18 +32,17 @@ function HttpApi (repo, config) {
32
32
33
33
series ( [
34
34
( cb ) => {
35
- const libp2p = {
36
- modules : { }
37
- }
35
+ const libp2p = { modules : { } }
38
36
39
37
// Attempt to use any of the WebRTC versions available globally
40
38
let electronWebRTC
41
39
let wrtc
42
40
try { electronWebRTC = require ( 'electron-webrtc' ) ( ) } catch ( err ) { }
43
41
try { wrtc = require ( 'wrtc' ) } catch ( err ) { }
44
42
45
- if ( electronWebRTC || wrtc ) {
46
- const wstar = new WStar ( electronWebRTC || wrtc )
43
+ console . log ( ! ! wrtc , ! ! electronWebRTC )
44
+ if ( wrtc || electronWebRTC ) {
45
+ const wstar = new WStar ( { wrtc : ( wrtc || electronWebRTC ) } )
47
46
libp2p . modules . transport = [ wstar ]
48
47
libp2p . modules . discovery = [ wstar . discovery ]
49
48
}
@@ -59,7 +58,8 @@ function HttpApi (repo, config) {
59
58
EXPERIMENTAL : {
60
59
pubsub : true ,
61
60
sharding : config && config . enableShardingExperiment
62
- }
61
+ } ,
62
+ libp2p : libp2p
63
63
} )
64
64
} catch ( err ) {
65
65
return cb ( err )
You can’t perform that action at this time.
0 commit comments