diff --git a/1-dht.js b/1-dht.js index edae5ab..a5efc9a 100644 --- a/1-dht.js +++ b/1-dht.js @@ -5,7 +5,6 @@ import { yamux } from '@chainsafe/libp2p-yamux' import { bootstrap } from '@libp2p/bootstrap' import { identify } from '@libp2p/identify' import { kadDHT, removePublicAddressesMapper } from '@libp2p/kad-dht' -import { mplex } from '@libp2p/mplex' import { tcp } from '@libp2p/tcp' import { createLibp2p } from 'libp2p' import bootstrappers from './bootstrappers.js' @@ -15,8 +14,8 @@ const node = await createLibp2p({ listen: ['/ip4/0.0.0.0/tcp/0'] }, transports: [tcp()], - streamMuxers: [yamux(), mplex()], - connectionEncryption: [noise()], + streamMuxers: [yamux()], + connectionEncrypters: [noise()], peerDiscovery: [ bootstrap({ list: bootstrappers diff --git a/2-mdns.js b/2-mdns.js index 3a80cd5..03b7255 100644 --- a/2-mdns.js +++ b/2-mdns.js @@ -3,7 +3,6 @@ import { noise } from '@chainsafe/libp2p-noise' import { yamux } from '@chainsafe/libp2p-yamux' import { mdns } from '@libp2p/mdns' -import { mplex } from '@libp2p/mplex' import { tcp } from '@libp2p/tcp' import { createLibp2p } from 'libp2p' @@ -16,9 +15,9 @@ const createNode = async () => { tcp() ], streamMuxers: [ - yamux(), mplex() + yamux() ], - connectionEncryption: [ + connectionEncrypters: [ noise() ], peerDiscovery: [ diff --git a/3-pubsub.js b/3-pubsub.js index 8f4122d..4522829 100644 --- a/3-pubsub.js +++ b/3-pubsub.js @@ -1,11 +1,10 @@ /* eslint-disable no-console */ +import { gossipsub } from '@chainsafe/libp2p-gossipsub' import { noise } from '@chainsafe/libp2p-noise' import { yamux } from '@chainsafe/libp2p-yamux' import { bootstrap } from '@libp2p/bootstrap' -import { floodsub } from '@libp2p/floodsub' import { identify } from '@libp2p/identify' -import { mplex } from '@libp2p/mplex' import { pubsubPeerDiscovery } from '@libp2p/pubsub-peer-discovery' import { tcp } from '@libp2p/tcp' import { createLibp2p } from 'libp2p' @@ -16,15 +15,15 @@ const createNode = async (bootstrappers = []) => { listen: ['/ip4/0.0.0.0/tcp/0'] }, transports: [tcp()], - streamMuxers: [yamux(), mplex()], - connectionEncryption: [noise()], + streamMuxers: [yamux()], + connectionEncrypters: [noise()], peerDiscovery: [ pubsubPeerDiscovery({ interval: 1000 }) ], services: { - pubsub: floodsub(), + pubsub: gossipsub(), identify: identify() } } diff --git a/README.md b/README.md index 78dbea3..7d5c28b 100644 --- a/README.md +++ b/README.md @@ -72,7 +72,6 @@ Update your libp2p configuration to include MulticastDNS. import { createLibp2p } from 'libp2p' import { mdns } from '@libp2p/mdns' import { tcp } from '@libp2p/tcp' -import { mplex } from '@libp2p/mplex' import { yamux } from '@chainsafe/libp2p-yamux' import { noise } from '@chainsafe/libp2p-noise' @@ -85,9 +84,9 @@ const createNode = () => { tcp() ], streamMuxers: [ - yamux(),mplex() + yamux(), ], - connectionEncryption: [ + connectionEncrypters: [ noise() ], peerDiscovery: [ diff --git a/package.json b/package.json index 5ac54ed..1bc4ed2 100644 --- a/package.json +++ b/package.json @@ -16,18 +16,17 @@ "test": "test-node-example test/*" }, "dependencies": { - "@chainsafe/libp2p-noise": "^15.0.0", - "@chainsafe/libp2p-yamux": "^6.0.1", - "@libp2p/bootstrap": "^10.1.0", - "@libp2p/circuit-relay-v2": "^1.0.5", - "@libp2p/floodsub": "^9.1.0", - "@libp2p/identify": "^2.1.0", - "@libp2p/kad-dht": "^12.1.0", - "@libp2p/mdns": "^10.0.5", - "@libp2p/mplex": "^10.1.0", - "@libp2p/pubsub-peer-discovery": "^10.0.1", - "@libp2p/tcp": "^9.0.4", - "libp2p": "^1.0.8" + "@chainsafe/libp2p-gossipsub": "^14.1.0", + "@chainsafe/libp2p-noise": "^16.0.0", + "@chainsafe/libp2p-yamux": "^7.0.0", + "@libp2p/bootstrap": "^11.0.0", + "@libp2p/circuit-relay-v2": "^2.0.0", + "@libp2p/identify": "^3.0.0", + "@libp2p/kad-dht": "^13.0.0", + "@libp2p/mdns": "^11.0.0", + "@libp2p/pubsub-peer-discovery": "^11.0.0", + "@libp2p/tcp": "^10.0.0", + "libp2p": "^2.0.0" }, "devDependencies": { "execa": "^9.2.0",