Skip to content

Commit 67a6376

Browse files
authored
chore: update pubsub (#108)
BREAKING CHANGE: using libp2p-interface pubsub with new API
1 parent fcebc20 commit 67a6376

13 files changed

+416
-1371
lines changed

.aegir.js

+66
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
'use strict'
2+
3+
/**
4+
* This file uses aegir hooks to
5+
* set up a libp2p instance for browser nodes to relay through
6+
* before tests start
7+
*/
8+
9+
const Libp2p = require('libp2p')
10+
const PeerId = require('peer-id')
11+
12+
const WS = require('libp2p-websockets')
13+
const MPLEX = require('libp2p-mplex')
14+
const { NOISE } = require('libp2p-noise')
15+
16+
const RelayPeer = require('./test/fixtures/relay')
17+
18+
let libp2p
19+
20+
const before = async () => {
21+
// Use the last peer
22+
const peerId = await PeerId.createFromJSON(RelayPeer)
23+
24+
libp2p = new Libp2p({
25+
addresses: {
26+
listen: [RelayPeer.multiaddr]
27+
},
28+
peerId,
29+
modules: {
30+
transport: [WS],
31+
streamMuxer: [MPLEX],
32+
connEncryption: [NOISE]
33+
},
34+
config: {
35+
relay: {
36+
enabled: true,
37+
hop: {
38+
enabled: true,
39+
active: false
40+
}
41+
},
42+
pubsub: {
43+
enabled: false
44+
}
45+
}
46+
})
47+
48+
await libp2p.start()
49+
}
50+
51+
const after = async () => {
52+
await libp2p.stop()
53+
}
54+
55+
module.exports = {
56+
hooks: {
57+
pre: before,
58+
post: after
59+
},
60+
webpack: {
61+
node: {
62+
// this is needed until bcrypto stops using node buffers in browser code
63+
Buffer: true
64+
}
65+
}
66+
}

package.json

+12-14
Original file line numberDiff line numberDiff line change
@@ -42,30 +42,28 @@
4242
},
4343
"homepage": "https://github.com/libp2p/js-libp2p-floodsub#readme",
4444
"devDependencies": {
45-
"aegir": "^25.0.0",
45+
"aegir": "^26.0.0",
4646
"benchmark": "^2.1.4",
4747
"chai": "^4.2.0",
48-
"chai-spies": "^1.0.0",
49-
"detect-node": "^2.0.4",
50-
"dirty-chai": "^2.0.1",
51-
"it-pair": "^1.0.0",
52-
"lodash": "^4.17.15",
48+
"ipfs-utils": "^3.0.0",
49+
"libp2p": "https://github.com/libp2p/js-libp2p#0.29.x",
50+
"libp2p-mplex": "^0.10.0",
51+
"libp2p-noise": "^2.0.0",
52+
"libp2p-websockets": "^0.14.0",
5353
"multiaddr": "^8.0.0",
54-
"p-defer": "^3.0.0",
54+
"p-wait-for": "^3.1.0",
55+
"peer-id": "^0.14.00",
5556
"sinon": "^9.0.1"
5657
},
5758
"dependencies": {
58-
"async.nexttick": "^0.5.2",
5959
"debug": "^4.1.1",
60-
"it-length-prefixed": "^3.0.0",
61-
"it-pipe": "^1.0.1",
62-
"libp2p-pubsub": "~0.6.0",
63-
"p-map": "^4.0.0",
64-
"peer-id": "~0.14.0",
65-
"protons": "^2.0.0",
60+
"libp2p-interfaces": "^0.5.1",
6661
"time-cache": "^0.3.0",
6762
"uint8arrays": "^1.1.0"
6863
},
64+
"peerDependencies": {
65+
"libp2p": "https://github.com/libp2p/js-libp2p#0.29.x"
66+
},
6967
"contributors": [
7068
"David Dias <daviddias.p@gmail.com>",
7169
"Vasco Santos <vasco.santos@moxy.studio>",

0 commit comments

Comments
 (0)