diff --git a/Cargo.lock b/Cargo.lock index d05dad61..1d1a8d73 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2081,6 +2081,7 @@ dependencies = [ "env_logger 0.10.0", "futures", "libp2p", + "libp2p-mplex", "libp2p-quic", "libp2p-webrtc", "log", @@ -2228,7 +2229,7 @@ checksum = "7fc7aa29613bd6a620df431842069224d8bc9011086b1db4c0e0cd47fa03ec9a" [[package]] name = "libp2p" -version = "0.51.2" +version = "0.51.3" dependencies = [ "async-std", "async-trait", diff --git a/examples/chat-example/Cargo.toml b/examples/chat-example/Cargo.toml index 32a38f6b..1d865711 100644 --- a/examples/chat-example/Cargo.toml +++ b/examples/chat-example/Cargo.toml @@ -10,5 +10,5 @@ async-std = { version = "1.12", features = ["attributes"] } async-trait = "0.1" env_logger = "0.10.0" futures = "0.3.28" -libp2p = { path = "../../libp2p", features = ["async-std", "gossipsub", "mdns", "mplex", "noise", "macros", "tcp", "yamux"] } +libp2p = { path = "../../libp2p", features = ["async-std", "gossipsub", "mdns", "noise", "macros", "tcp", "yamux"] } libp2p-quic = { path = "../../transports/quic", features = ["async-std"] } diff --git a/examples/dcutr/Cargo.toml b/examples/dcutr/Cargo.toml index c4cb2248..f2ad3b82 100644 --- a/examples/dcutr/Cargo.toml +++ b/examples/dcutr/Cargo.toml @@ -10,5 +10,5 @@ clap = { version = "4.2.1", features = ["derive"] } env_logger = "0.10.0" futures = "0.3.28" futures-timer = "3.0" -libp2p = { path = "../../libp2p", features = ["async-std", "dns", "dcutr", "identify", "macros", "mplex", "noise", "ping", "relay", "rendezvous", "tcp", "tokio", "yamux"] } +libp2p = { path = "../../libp2p", features = ["async-std", "dns", "dcutr", "identify", "macros", "noise", "ping", "relay", "rendezvous", "tcp", "tokio", "yamux"] } log = "0.4" diff --git a/examples/distributed-key-value-store/Cargo.toml b/examples/distributed-key-value-store/Cargo.toml index 259dc843..b8fcb9ba 100644 --- a/examples/distributed-key-value-store/Cargo.toml +++ b/examples/distributed-key-value-store/Cargo.toml @@ -10,5 +10,5 @@ async-std = { version = "1.12", features = ["attributes"] } async-trait = "0.1" env_logger = "0.10" futures = "0.3.28" -libp2p = { path = "../../libp2p", features = ["async-std", "dns", "kad", "mdns", "mplex", "noise", "macros", "tcp", "websocket", "yamux"] } +libp2p = { path = "../../libp2p", features = ["async-std", "dns", "kad", "mdns", "noise", "macros", "tcp", "websocket", "yamux"] } multiaddr = { version = "0.17.0" } diff --git a/examples/file-sharing/Cargo.toml b/examples/file-sharing/Cargo.toml index 5db8fdb7..534c914d 100644 --- a/examples/file-sharing/Cargo.toml +++ b/examples/file-sharing/Cargo.toml @@ -12,5 +12,5 @@ clap = { version = "4.2.1", features = ["derive"] } either = "1.8" env_logger = "0.10" futures = "0.3.28" -libp2p = { path = "../../libp2p", features = ["async-std", "dns", "kad", "mplex", "noise", "macros", "request-response", "tcp", "websocket", "yamux"] } +libp2p = { path = "../../libp2p", features = ["async-std", "dns", "kad", "noise", "macros", "request-response", "tcp", "websocket", "yamux"] } multiaddr = { version = "0.17.0" } diff --git a/examples/identify/Cargo.toml b/examples/identify/Cargo.toml index a760dffe..b11ea227 100644 --- a/examples/identify/Cargo.toml +++ b/examples/identify/Cargo.toml @@ -9,4 +9,4 @@ license = "MIT" async-std = { version = "1.12", features = ["attributes"] } async-trait = "0.1" futures = "0.3.28" -libp2p = { path = "../../libp2p", features = ["async-std", "dns", "dcutr", "identify", "macros", "mplex", "noise", "ping", "relay", "rendezvous", "tcp", "tokio", "yamux"] } +libp2p = { path = "../../libp2p", features = ["async-std", "dns", "dcutr", "identify", "macros", "noise", "ping", "relay", "rendezvous", "tcp", "tokio", "yamux"] } diff --git a/examples/ipfs-kad/Cargo.toml b/examples/ipfs-kad/Cargo.toml index bdecbe9f..7e156572 100644 --- a/examples/ipfs-kad/Cargo.toml +++ b/examples/ipfs-kad/Cargo.toml @@ -10,4 +10,4 @@ async-std = { version = "1.12", features = ["attributes"] } async-trait = "0.1" env_logger = "0.10" futures = "0.3.28" -libp2p = { path = "../../libp2p", features = ["async-std", "dns", "kad", "mplex", "noise", "tcp", "websocket", "yamux"] } +libp2p = { path = "../../libp2p", features = ["async-std", "dns", "kad", "mplex", "noise", "tcp", "websocket", "yamux"] } diff --git a/examples/ipfs-private/Cargo.toml b/examples/ipfs-private/Cargo.toml index e5ca80b4..d7685195 100644 --- a/examples/ipfs-private/Cargo.toml +++ b/examples/ipfs-private/Cargo.toml @@ -11,5 +11,5 @@ async-trait = "0.1" either = "1.8" env_logger = "0.10" futures = "0.3.28" -libp2p = { path = "../../libp2p", features = ["async-std", "gossipsub", "dns", "identify", "kad", "macros", "mplex", "noise", "ping", "pnet", "tcp", "websocket", "yamux"] } +libp2p = { path = "../../libp2p", features = ["async-std", "gossipsub", "dns", "identify", "kad", "macros", "noise", "ping", "pnet", "tcp", "websocket", "yamux"] } multiaddr = { version = "0.17.0" } diff --git a/examples/ping-example/Cargo.toml b/examples/ping-example/Cargo.toml index 31952ef1..0e2c79af 100644 --- a/examples/ping-example/Cargo.toml +++ b/examples/ping-example/Cargo.toml @@ -9,5 +9,5 @@ license = "MIT" async-std = { version = "1.12", features = ["attributes"] } async-trait = "0.1" futures = "0.3.28" -libp2p = { path = "../../libp2p", features = ["async-std", "dns", "macros", "mplex", "noise", "ping", "tcp", "websocket", "yamux"] } +libp2p = { path = "../../libp2p", features = ["async-std", "dns", "macros", "noise", "ping", "tcp", "websocket", "yamux"] } multiaddr = { version = "0.17.0" } diff --git a/examples/rendezvous/Cargo.toml b/examples/rendezvous/Cargo.toml index 9931a49f..ae3231d6 100644 --- a/examples/rendezvous/Cargo.toml +++ b/examples/rendezvous/Cargo.toml @@ -10,6 +10,6 @@ async-std = { version = "1.12", features = ["attributes"] } async-trait = "0.1" env_logger = "0.10.0" futures = "0.3.28" -libp2p = { path = "../../libp2p", features = ["async-std", "identify", "macros", "mplex", "noise", "ping", "rendezvous", "tcp", "tokio", "yamux"] } +libp2p = { path = "../../libp2p", features = ["async-std", "identify", "macros", "noise", "ping", "rendezvous", "tcp", "tokio", "yamux"] } log = "0.4" tokio = { version = "1.25", features = [ "rt-multi-thread", "macros", "time" ] } diff --git a/interop-tests/Cargo.toml b/interop-tests/Cargo.toml index bd673832..984c2631 100644 --- a/interop-tests/Cargo.toml +++ b/interop-tests/Cargo.toml @@ -10,9 +10,10 @@ anyhow = "1" either = "1.8.0" env_logger = "0.10.0" futures = "0.3.28" -libp2p = { path = "../libp2p", features = ["websocket", "mplex", "yamux", "tcp", "tokio", "ping", "noise", "tls", "dns", "rsa", "macros"] } +libp2p = { path = "../libp2p", features = ["websocket", "yamux", "tcp", "tokio", "ping", "noise", "tls", "dns", "rsa", "macros"] } libp2p-quic = { path = "../transports/quic", features = ["tokio"] } libp2p-webrtc = { path = "../transports/webrtc", features = ["tokio"] } +libp2p-mplex = { path = "../muxers/mplex" } log = "0.4" rand = "0.8.5" redis = { version = "0.22.1", default-features = false, features = ["tokio-comp"] } diff --git a/interop-tests/src/bin/ping.rs b/interop-tests/src/bin/ping.rs index 25d4459d..ba29f9c5 100644 --- a/interop-tests/src/bin/ping.rs +++ b/interop-tests/src/bin/ping.rs @@ -13,9 +13,10 @@ use libp2p::swarm::{keep_alive, NetworkBehaviour, SwarmEvent}; use libp2p::tls::TlsStream; use libp2p::websocket::WsConfig; use libp2p::{ - identity, mplex, noise, ping, swarm::SwarmBuilder, tcp, tls, yamux, InboundUpgradeExt, - Multiaddr, OutboundUpgradeExt, PeerId, Transport as _, + identity, noise, ping, swarm::SwarmBuilder, tcp, tls, yamux, InboundUpgradeExt, Multiaddr, + OutboundUpgradeExt, PeerId, Transport as _, }; +use libp2p_mplex as mplex; use libp2p_quic as quic; use libp2p_webrtc as webrtc; use redis::AsyncCommands; diff --git a/libp2p/CHANGELOG.md b/libp2p/CHANGELOG.md index 643574f3..d9ad1e87 100644 --- a/libp2p/CHANGELOG.md +++ b/libp2p/CHANGELOG.md @@ -1,3 +1,11 @@ +## 0.51.3 - unreleased + +- Deprecate the `mplex` feature. +The recommended baseline stream multiplexer is `yamux`. +See [PR 3689]. + +[PR 3689]: https://github.com/libp2p/rust-libp2p/pull/3689 + ## 0.51.2 - Introduce `libp2p::connection_limits` module. diff --git a/libp2p/Cargo.toml b/libp2p/Cargo.toml index 33176cfa..aa35c2b8 100644 --- a/libp2p/Cargo.toml +++ b/libp2p/Cargo.toml @@ -3,7 +3,7 @@ name = "libp2p" edition = "2021" rust-version = "1.65.0" description = "Peer-to-peer networking library" -version = "0.51.2" +version = "0.51.3" authors = ["Parity Technologies "] license = "MIT" repository = "https://github.com/libp2p/rust-libp2p" diff --git a/libp2p/src/lib.rs b/libp2p/src/lib.rs index 93519ead..93378478 100644 --- a/libp2p/src/lib.rs +++ b/libp2p/src/lib.rs @@ -83,8 +83,12 @@ pub use libp2p_mdns as mdns; #[doc(inline)] pub use libp2p_metrics as metrics; #[cfg(feature = "mplex")] -#[doc(inline)] -pub use libp2p_mplex as mplex; +#[deprecated( + note = "`mplex` is not recommended anymore. Please use `yamux` instead or depend on `libp2p-mplex` directly if you need it for legacy use cases." +)] +pub mod mplex { + pub use libp2p_mplex::*; +} #[cfg(feature = "noise")] #[doc(inline)] pub use libp2p_noise as noise; @@ -228,6 +232,7 @@ pub async fn development_transport( .authenticate(noise::NoiseAuthenticated::xx(&keypair).unwrap()) .multiplex(core::upgrade::SelectUpgrade::new( yamux::YamuxConfig::default(), + #[allow(deprecated)] mplex::MplexConfig::default(), )) .timeout(std::time::Duration::from_secs(20)) @@ -284,6 +289,7 @@ pub fn tokio_development_transport( .authenticate(noise::NoiseAuthenticated::xx(&keypair).unwrap()) .multiplex(core::upgrade::SelectUpgrade::new( yamux::YamuxConfig::default(), + #[allow(deprecated)] mplex::MplexConfig::default(), )) .timeout(std::time::Duration::from_secs(20))