Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion examples/chat-example/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ async fn main() -> Result<(), Box<dyn Error>> {
let local_peer_id = PeerId::from(id_keys.public());
println!("Local peer id: {local_peer_id}");

// Set up an encrypted DNS-enabled TCP Transport over the Mplex protocol.
// Set up an encrypted DNS-enabled TCP Transport over the yamux protocol.
let tcp_transport = tcp::async_io::Transport::new(tcp::Config::default().nodelay(true))
.upgrade(upgrade::Version::V1Lazy)
.authenticate(noise::Config::new(&id_keys).expect("signing libp2p-noise static keypair"))
Expand Down
2 changes: 1 addition & 1 deletion examples/ipfs-kad/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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", "noise", "tcp", "websocket", "yamux"] }
2 changes: 1 addition & 1 deletion examples/ipfs-kad/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ async fn main() -> Result<(), Box<dyn Error>> {
let local_key = identity::Keypair::generate_ed25519();
let local_peer_id = PeerId::from(local_key.public());

// Set up a an encrypted DNS-enabled TCP Transport over the Mplex protocol
// Set up a an encrypted DNS-enabled TCP Transport over the yamux protocol
let transport = development_transport(local_key).await?;

// Create a swarm to manage peers and events.
Expand Down
8 changes: 7 additions & 1 deletion libp2p/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,15 @@

- Rename `NetworkBehaviour::OutEvent` to `NetworkBehaviour::ToSwarm`, `ConnectionHandler::InEvent` to `ConnectionHandler::FromBehaviour`, `ConnectionHandler::OutEvent` to `ConnectionHandler::ToBehaviour`. See [PR 3848].

[PR 3746]: https://github.com/libp2p/rust-libp2p/pull/3746
- Remove deprecated `mplex` module.
You can still depend on `libp2p-mplex` directly but we strongly encourage to migrate to `yamux`.
This also removes `mplex` from the `development_transport` and `tokio_development_transport` functions.
See [PR 3920].

[PR 3715]: https://github.com/libp2p/rust-libp2p/pull/3715
[PR 3746]: https://github.com/libp2p/rust-libp2p/pull/3746
[PR 3848]: https://github.com/libp2p/rust-libp2p/pull/3848
[PR 3920]: https://github.com/libp2p/rust-libp2p/pull/3920

## 0.51.3

Expand Down
4 changes: 0 additions & 4 deletions libp2p/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ full = [
"macros",
"mdns",
"metrics",
"mplex",
"noise",
"perf",
"ping",
Expand Down Expand Up @@ -65,7 +64,6 @@ kad = ["dep:libp2p-kad", "libp2p-metrics?/kad"]
macros = ["libp2p-swarm/macros"]
mdns = ["dep:libp2p-mdns"]
metrics = ["dep:libp2p-metrics"]
mplex = ["dep:libp2p-mplex"]
noise = ["dep:libp2p-noise"]
perf = ["dep:libp2p-perf"]
ping = ["dep:libp2p-ping", "libp2p-metrics?/ping"]
Expand Down Expand Up @@ -106,7 +104,6 @@ libp2p-identify = { workspace = true, optional = true }
libp2p-identity = { workspace = true }
libp2p-kad = { workspace = true, optional = true }
libp2p-metrics = { workspace = true, optional = true }
libp2p-mplex = { workspace = true, optional = true }
libp2p-noise = { workspace = true, optional = true }
libp2p-ping = { workspace = true, optional = true }
libp2p-plaintext = { workspace = true, optional = true }
Expand Down Expand Up @@ -144,7 +141,6 @@ env_logger = "0.10.0"
clap = { version = "4.1.6", features = ["derive"] }
tokio = { version = "1.15", features = ["io-util", "io-std", "macros", "rt", "rt-multi-thread"] }

libp2p-mplex = { workspace = true }
libp2p-noise = { workspace = true }
libp2p-tcp = { workspace = true, features = ["tokio"] }

Expand Down
25 changes: 4 additions & 21 deletions libp2p/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,6 @@ pub use libp2p_mdns as mdns;
#[cfg(feature = "metrics")]
#[doc(inline)]
pub use libp2p_metrics as metrics;
#[cfg(feature = "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;
Expand Down Expand Up @@ -184,7 +177,7 @@ pub use libp2p_swarm::{Stream, StreamProtocol};
/// * DNS resolution.
/// * Noise protocol encryption.
/// * Websockets.
/// * Both Yamux and Mplex for substream multiplexing.
/// * Yamux for substream multiplexing.
///
/// All async I/O of the transport is based on `async-std`.
///
Expand All @@ -198,7 +191,6 @@ pub use libp2p_swarm::{Stream, StreamProtocol};
),
feature = "websocket",
feature = "noise",
feature = "mplex",
feature = "yamux"
))]
#[cfg_attr(
Expand Down Expand Up @@ -231,11 +223,7 @@ pub async fn development_transport(
Ok(transport
.upgrade(core::upgrade::Version::V1)
.authenticate(noise::Config::new(&keypair).unwrap())
.multiplex(core::upgrade::SelectUpgrade::new(
yamux::Config::default(),
#[allow(deprecated)]
mplex::MplexConfig::default(),
))
.multiplex(yamux::Config::default())
.timeout(std::time::Duration::from_secs(20))
.boxed())
}
Expand All @@ -245,7 +233,7 @@ pub async fn development_transport(
/// * DNS resolution.
/// * Noise protocol encryption.
/// * Websockets.
/// * Both Yamux and Mplex for substream multiplexing.
/// * Yamux for substream multiplexing.
///
/// All async I/O of the transport is based on `tokio`.
///
Expand All @@ -259,7 +247,6 @@ pub async fn development_transport(
),
feature = "websocket",
feature = "noise",
feature = "mplex",
feature = "yamux"
))]
#[cfg_attr(
Expand Down Expand Up @@ -288,11 +275,7 @@ pub fn tokio_development_transport(
Ok(transport
.upgrade(core::upgrade::Version::V1)
.authenticate(noise::Config::new(&keypair).unwrap())
.multiplex(core::upgrade::SelectUpgrade::new(
yamux::Config::default(),
#[allow(deprecated)]
mplex::MplexConfig::default(),
))
.multiplex(yamux::Config::default())
.timeout(std::time::Duration::from_secs(20))
.boxed())
}
4 changes: 2 additions & 2 deletions libp2p/src/transport_ext.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ pub trait TransportExt: Transport {
/// # Example
///
/// ```
/// use libp2p_mplex as mplex;
/// use libp2p_yamux as yamux;
/// use libp2p_noise as noise;
/// use libp2p_tcp as tcp;
/// use libp2p::{
Expand All @@ -61,7 +61,7 @@ pub trait TransportExt: Transport {
/// noise::Config::new(&id_keys)
/// .expect("Signing libp2p-noise static DH keypair failed."),
/// )
/// .multiplex(mplex::MplexConfig::new())
/// .multiplex(yamux::Config::default())
/// .boxed();
///
/// let (transport, sinks) = transport.with_bandwidth_logging();
Expand Down
2 changes: 1 addition & 1 deletion libp2p/src/tutorials/ping.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
//! edition = "2021"
//!
//! [dependencies]
//! libp2p = { version = "0.50", features = ["tcp", "dns", "async-std", "noise", "mplex", "yamux", "websocket", "ping", "macros"] }
//! libp2p = { version = "0.50", features = ["tcp", "dns", "async-std", "noise", "yamux", "websocket", "ping", "macros"] }
//! futures = "0.3.21"
//! async-std = { version = "1.12.0", features = ["attributes"] }
//! ```
Expand Down
2 changes: 1 addition & 1 deletion protocols/gossipsub/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ async-std = { version = "1.6.3", features = ["unstable"] }
env_logger = "0.10.0"
hex = "0.4.2"
libp2p-core = { workspace = true }
libp2p-mplex = { workspace = true }
libp2p-yamux = { workspace = true }
libp2p-noise = { workspace = true }
libp2p-swarm-test = { workspace = true }
quickcheck = { workspace = true }
Expand Down
4 changes: 2 additions & 2 deletions protocols/gossipsub/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,12 +99,12 @@
//! let local_key = identity::Keypair::generate_ed25519();
//! let local_peer_id = local_key.public().to_peer_id();
//!
//! // Set up an encrypted TCP Transport over the Mplex
//! // Set up an encrypted TCP Transport over yamux
//! // This is test transport (memory).
//! let transport = MemoryTransport::default()
//! .upgrade(libp2p_core::upgrade::Version::V1)
//! .authenticate(libp2p_noise::Config::new(&local_key).unwrap())
//! .multiplex(libp2p_mplex::MplexConfig::new())
//! .multiplex(libp2p_yamux::Config::default())
//! .boxed();
//!
//! // Create a Gossipsub topic
Expand Down