This repository has been archived by the owner on Jun 27, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4d22e0d
commit 2e7c1b3
Showing
11 changed files
with
301 additions
and
356 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
'use strict' | ||
|
||
/** | ||
* This file uses aegir hooks to | ||
* set up a libp2p instance for browser nodes to relay through | ||
* before tests start | ||
*/ | ||
|
||
const Libp2p = require('libp2p') | ||
const PeerId = require('peer-id') | ||
|
||
const WS = require('libp2p-websockets') | ||
const MPLEX = require('libp2p-mplex') | ||
const { NOISE } = require('libp2p-noise') | ||
|
||
const RelayPeer = require('./test/fixtures/relay') | ||
|
||
let libp2p | ||
|
||
const before = async () => { | ||
// Use the last peer | ||
const peerId = await PeerId.createFromJSON(RelayPeer) | ||
|
||
libp2p = new Libp2p({ | ||
addresses: { | ||
listen: [RelayPeer.multiaddr] | ||
}, | ||
peerId, | ||
modules: { | ||
transport: [WS], | ||
streamMuxer: [MPLEX], | ||
connEncryption: [NOISE] | ||
}, | ||
config: { | ||
relay: { | ||
enabled: true, | ||
hop: { | ||
enabled: true, | ||
active: false | ||
} | ||
}, | ||
pubsub: { | ||
enabled: false | ||
} | ||
} | ||
}) | ||
|
||
await libp2p.start() | ||
} | ||
|
||
const after = async () => { | ||
await libp2p.stop() | ||
} | ||
|
||
module.exports = { | ||
hooks: { | ||
pre: before, | ||
post: after | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -48,14 +48,17 @@ | |
"chai-spies": "^1.0.0", | ||
"detect-node": "^2.0.4", | ||
"dirty-chai": "^2.0.1", | ||
"it-pair": "^1.0.0", | ||
"libp2p": "https://github.com/libp2p/js-libp2p#0.29.x", | ||
"libp2p-mplex": "^0.9.5", | ||
"libp2p-noise": "^1.1.2", | ||
"libp2p-websockets": "^0.13.6", | ||
"lodash": "^4.17.15", | ||
"multiaddr": "^7.1.0", | ||
"p-defer": "^3.0.0", | ||
"p-wait-for": "^3.1.0", | ||
"sinon": "^9.0.1" | ||
}, | ||
"dependencies": { | ||
"async.nexttick": "^0.5.2", | ||
"buffer": "^5.6.0", | ||
"debug": "^4.1.1", | ||
"it-pipe": "^1.0.1", | ||
|
@@ -65,6 +68,9 @@ | |
"protons": "^1.0.1", | ||
"time-cache": "^0.3.0" | ||
}, | ||
"peerDependencies": { | ||
"libp2p": "https://github.com/libp2p/js-libp2p#0.29.x" | ||
}, | ||
"contributors": [ | ||
"David Dias <[email protected]>", | ||
"Vasco Santos <[email protected]>", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.