Skip to content
This repository has been archived by the owner on Jun 27, 2023. It is now read-only.

Commit

Permalink
chore: update pubsub (#108)
Browse files Browse the repository at this point in the history
BREAKING CHANGE: using libp2p-interface pubsub with new API
  • Loading branch information
vasco-santos committed Aug 25, 2020
1 parent fcebc20 commit 67a6376
Show file tree
Hide file tree
Showing 13 changed files with 416 additions and 1,371 deletions.
66 changes: 66 additions & 0 deletions .aegir.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
'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
},
webpack: {
node: {
// this is needed until bcrypto stops using node buffers in browser code
Buffer: true
}
}
}
26 changes: 12 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,30 +42,28 @@
},
"homepage": "https://github.com/libp2p/js-libp2p-floodsub#readme",
"devDependencies": {
"aegir": "^25.0.0",
"aegir": "^26.0.0",
"benchmark": "^2.1.4",
"chai": "^4.2.0",
"chai-spies": "^1.0.0",
"detect-node": "^2.0.4",
"dirty-chai": "^2.0.1",
"it-pair": "^1.0.0",
"lodash": "^4.17.15",
"ipfs-utils": "^3.0.0",
"libp2p": "https://github.com/libp2p/js-libp2p#0.29.x",
"libp2p-mplex": "^0.10.0",
"libp2p-noise": "^2.0.0",
"libp2p-websockets": "^0.14.0",
"multiaddr": "^8.0.0",
"p-defer": "^3.0.0",
"p-wait-for": "^3.1.0",
"peer-id": "^0.14.00",
"sinon": "^9.0.1"
},
"dependencies": {
"async.nexttick": "^0.5.2",
"debug": "^4.1.1",
"it-length-prefixed": "^3.0.0",
"it-pipe": "^1.0.1",
"libp2p-pubsub": "~0.6.0",
"p-map": "^4.0.0",
"peer-id": "~0.14.0",
"protons": "^2.0.0",
"libp2p-interfaces": "^0.5.1",
"time-cache": "^0.3.0",
"uint8arrays": "^1.1.0"
},
"peerDependencies": {
"libp2p": "https://github.com/libp2p/js-libp2p#0.29.x"
},
"contributors": [
"David Dias <daviddias.p@gmail.com>",
"Vasco Santos <vasco.santos@moxy.studio>",
Expand Down
Loading

0 comments on commit 67a6376

Please sign in to comment.