diff --git a/package.json b/package.json index a2aac71..038895d 100644 --- a/package.json +++ b/package.json @@ -50,13 +50,12 @@ "libp2p": "^0.30.0", "libp2p-mplex": "^0.10.1", "libp2p-noise": "^2.0.1", - "libp2p-websockets": "^0.14.0", - "multiaddr": "^8.1.1", + "libp2p-websockets": "^0.15.4", + "multiaddr": "^9.0.1", "os": "^0.1.1", "p-wait-for": "^3.1.0", "peer-id": "^0.14.2", - "sinon": "^10.0.0", - "url": "^0.11.0" + "sinon": "^10.0.0" }, "dependencies": { "debug": "^4.2.0", diff --git a/test/utils/create-peer.js b/test/utils/create-peer.js index a844213..b8383f7 100644 --- a/test/utils/create-peer.js +++ b/test/utils/create-peer.js @@ -9,10 +9,11 @@ */ const Libp2p = require('libp2p') -const multiaddr = require('multiaddr') +const { Multiaddr } = require('multiaddr') const PeerId = require('peer-id') const WS = require('libp2p-websockets') +const filters = require('libp2p-websockets/src/filters') const MPLEX = require('libp2p-mplex') const { NOISE } = require('libp2p-noise') @@ -21,6 +22,8 @@ const { isNode } = require('ipfs-utils/src/env') const Peers = require('../fixtures/peers') const RelayPeer = require('../fixtures/relay') +const transportKey = WS.prototype[Symbol.toStringTag] + const defaultConfig = { modules: { transport: [WS], @@ -33,6 +36,11 @@ const defaultConfig = { }, peerDiscovery: { autoDial: false + }, + transport: { + [transportKey]: { + filter: filters.all + } } } } @@ -109,10 +117,10 @@ async function createPeers ({ number = 1, started = true, seedAddressBook = true function getListenAddress (peerId) { if (isNode) { // node - return multiaddr('/ip4/127.0.0.1/tcp/0/ws') + return new Multiaddr('/ip4/127.0.0.1/tcp/0/ws') } else { // browser - return multiaddr(`${RelayPeer.multiaddr}/p2p-circuit/p2p/${peerId.toB58String()}`) + return new Multiaddr(`${RelayPeer.multiaddr}/p2p-circuit/p2p/${peerId.toB58String()}`) } }