Skip to content

Commit

Permalink
deps: update libp2p deps to v2 (#170)
Browse files Browse the repository at this point in the history
Updates examples to use the new libp2p release
  • Loading branch information
achingbrain authored Sep 18, 2024
1 parent cc74d43 commit 1d4c526
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 22 deletions.
5 changes: 1 addition & 4 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ const libp2p = await createLibp2p({
})
],
// a connection encrypter is necessary to dial the relay
connectionEncryption: [noise()],
connectionEncrypters: [noise()],
// a stream muxer is necessary to dial the relay
streamMuxers: [yamux()],
connectionGater: {
Expand All @@ -75,9 +75,6 @@ const libp2p = await createLibp2p({
identify: identify(),
pubsub: gossipsub(),
dcutr: dcutr()
},
connectionManager: {
minConnections: 0
}
})

Expand Down
21 changes: 10 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,16 @@
"test": "npm run build && test-browser-example test"
},
"dependencies": {
"@chainsafe/libp2p-gossipsub": "^13.0.0",
"@chainsafe/libp2p-noise": "^15.0.0",
"@chainsafe/libp2p-yamux": "^6.0.1",
"@libp2p/circuit-relay-v2": "^1.0.4",
"@libp2p/dcutr": "^1.0.3",
"@libp2p/identify": "^2.1.0",
"@libp2p/mplex": "^10.1.0",
"@libp2p/webrtc": "^4.0.5",
"@libp2p/websockets": "^8.0.4",
"@multiformats/multiaddr": "^12.1.11",
"libp2p": "^1.0.8",
"@chainsafe/libp2p-gossipsub": "^14.0.0",
"@chainsafe/libp2p-noise": "^16.0.0",
"@chainsafe/libp2p-yamux": "^7.0.0",
"@libp2p/circuit-relay-v2": "^2.0.0",
"@libp2p/dcutr": "^2.0.0",
"@libp2p/identify": "^3.0.0",
"@libp2p/webrtc": "^5.0.0",
"@libp2p/websockets": "^9.0.0",
"@multiformats/multiaddr": "^12.3.1",
"libp2p": "^2.0.0",
"vite": "^5.3.1"
},
"devDependencies": {
Expand Down
8 changes: 2 additions & 6 deletions relay.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { noise } from '@chainsafe/libp2p-noise'
import { yamux } from '@chainsafe/libp2p-yamux'
import { circuitRelayServer } from '@libp2p/circuit-relay-v2'
import { identify } from '@libp2p/identify'
import { mplex } from '@libp2p/mplex'
import { webSockets } from '@libp2p/websockets'
import * as filters from '@libp2p/websockets/filters'
import { createLibp2p } from 'libp2p'
Expand All @@ -18,18 +17,15 @@ const server = await createLibp2p({
filter: filters.all
})
],
connectionEncryption: [noise()],
streamMuxers: [yamux(), mplex()],
connectionEncrypters: [noise()],
streamMuxers: [yamux()],
services: {
identify: identify(),
relay: circuitRelayServer({
reservations: {
maxReservations: Infinity
}
})
},
connectionManager: {
minConnections: 0
}
})

Expand Down
2 changes: 1 addition & 1 deletion test/index.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ async function spawnRelay () {
filter: filters.all
})
],
connectionEncryption: [noise()],
connectionEncrypters: [noise()],
streamMuxers: [yamux()],
services: {
identify: identify(),
Expand Down

0 comments on commit 1d4c526

Please sign in to comment.