Skip to content

Commit

Permalink
feat(yamux): rename symbols to follow module-based naming convention
Browse files Browse the repository at this point in the history
Implements our naming convention for the `libp2p-yamux` crate.

Related: libp2p#2217.

Pull-Request: libp2p#3852.
  • Loading branch information
thomaseizinger authored May 1, 2023
1 parent 193d2a1 commit b1cdf8d
Show file tree
Hide file tree
Showing 35 changed files with 108 additions and 92 deletions.
2 changes: 1 addition & 1 deletion 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/autonat/src/bin/autonat_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ async fn main() -> Result<(), Box<dyn Error>> {
let transport = tcp::async_io::Transport::default()
.upgrade(Version::V1Lazy)
.authenticate(noise::Config::new(&local_key)?)
.multiplex(yamux::YamuxConfig::default())
.multiplex(yamux::Config::default())
.boxed();

let behaviour = Behaviour::new(local_key.public());
Expand Down
2 changes: 1 addition & 1 deletion examples/autonat/src/bin/autonat_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ async fn main() -> Result<(), Box<dyn Error>> {
let transport = tcp::async_io::Transport::default()
.upgrade(Version::V1Lazy)
.authenticate(noise::Config::new(&local_key)?)
.multiplex(yamux::YamuxConfig::default())
.multiplex(yamux::Config::default())
.boxed();

let behaviour = Behaviour::new(local_key.public());
Expand Down
2 changes: 1 addition & 1 deletion examples/chat-example/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ async fn main() -> Result<(), Box<dyn Error>> {
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"))
.multiplex(yamux::YamuxConfig::default())
.multiplex(yamux::Config::default())
.timeout(std::time::Duration::from_secs(20))
.boxed();
let quic_transport = quic::async_std::Transport::new(quic::Config::new(&id_keys));
Expand Down
2 changes: 1 addition & 1 deletion examples/dcutr/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ fn main() -> Result<(), Box<dyn Error>> {
.authenticate(
noise::Config::new(&local_key).expect("Signing libp2p-noise static DH keypair failed."),
)
.multiplex(yamux::YamuxConfig::default())
.multiplex(yamux::Config::default())
.boxed();

#[derive(NetworkBehaviour)]
Expand Down
2 changes: 1 addition & 1 deletion examples/distributed-key-value-store/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ async fn main() -> Result<(), Box<dyn Error>> {
let transport = tcp::async_io::Transport::default()
.upgrade(Version::V1Lazy)
.authenticate(noise::Config::new(&local_key)?)
.multiplex(yamux::YamuxConfig::default())
.multiplex(yamux::Config::default())
.boxed();

// We create a custom network behaviour that combines Kademlia and mDNS.
Expand Down
2 changes: 1 addition & 1 deletion examples/file-sharing/src/network.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ pub(crate) async fn new(
let transport = tcp::async_io::Transport::default()
.upgrade(Version::V1Lazy)
.authenticate(noise::Config::new(&id_keys)?)
.multiplex(yamux::YamuxConfig::default())
.multiplex(yamux::Config::default())
.boxed();

// Build the Swarm, connecting the lower layer transport logic with the
Expand Down
2 changes: 1 addition & 1 deletion examples/identify/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ async fn main() -> Result<(), Box<dyn Error>> {
let transport = tcp::async_io::Transport::default()
.upgrade(Version::V1Lazy)
.authenticate(noise::Config::new(&local_key).unwrap())
.multiplex(yamux::YamuxConfig::default())
.multiplex(yamux::Config::default())
.boxed();

// Create a identify network behaviour.
Expand Down
6 changes: 2 additions & 4 deletions examples/ipfs-private/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,7 @@ use libp2p::{
noise, ping,
pnet::{PnetConfig, PreSharedKey},
swarm::{NetworkBehaviour, SwarmBuilder, SwarmEvent},
tcp,
yamux::YamuxConfig,
Multiaddr, PeerId, Transport,
tcp, yamux, Multiaddr, PeerId, Transport,
};
use std::{env, error::Error, fs, path::Path, str::FromStr, time::Duration};

Expand All @@ -53,7 +51,7 @@ pub fn build_transport(
psk: Option<PreSharedKey>,
) -> transport::Boxed<(PeerId, StreamMuxerBox)> {
let noise_config = noise::Config::new(&key_pair).unwrap();
let yamux_config = YamuxConfig::default();
let yamux_config = yamux::Config::default();

let base_transport = tcp::async_io::Transport::new(tcp::Config::default().nodelay(true));
let maybe_encrypted = match psk {
Expand Down
2 changes: 1 addition & 1 deletion examples/metrics/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ fn main() -> Result<(), Box<dyn Error>> {
tcp::async_io::Transport::default()
.upgrade(Version::V1Lazy)
.authenticate(noise::Config::new(&local_key)?)
.multiplex(yamux::YamuxConfig::default())
.multiplex(yamux::Config::default())
.boxed(),
Behaviour::new(local_pub_key),
local_peer_id,
Expand Down
2 changes: 1 addition & 1 deletion examples/ping-example/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ async fn main() -> Result<(), Box<dyn Error>> {
let transport = tcp::async_io::Transport::default()
.upgrade(Version::V1Lazy)
.authenticate(noise::Config::new(&local_key)?)
.multiplex(yamux::YamuxConfig::default())
.multiplex(yamux::Config::default())
.boxed();

let mut swarm =
Expand Down
2 changes: 1 addition & 1 deletion examples/relay-server/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ fn main() -> Result<(), Box<dyn Error>> {
.authenticate(
noise::Config::new(&local_key).expect("Signing libp2p-noise static DH keypair failed."),
)
.multiplex(libp2p::yamux::YamuxConfig::default())
.multiplex(libp2p::yamux::Config::default())
.boxed();

let behaviour = Behaviour {
Expand Down
2 changes: 1 addition & 1 deletion examples/rendezvous/src/bin/rzv-discover.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ async fn main() {
tcp::tokio::Transport::default()
.upgrade(Version::V1Lazy)
.authenticate(noise::Config::new(&key_pair).unwrap())
.multiplex(yamux::YamuxConfig::default())
.multiplex(yamux::Config::default())
.boxed(),
MyBehaviour {
rendezvous: rendezvous::client::Behaviour::new(key_pair.clone()),
Expand Down
2 changes: 1 addition & 1 deletion examples/rendezvous/src/bin/rzv-identify.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ async fn main() {
tcp::tokio::Transport::default()
.upgrade(Version::V1Lazy)
.authenticate(noise::Config::new(&key_pair).unwrap())
.multiplex(yamux::YamuxConfig::default())
.multiplex(yamux::Config::default())
.boxed(),
MyBehaviour {
identify: identify::Behaviour::new(identify::Config::new(
Expand Down
2 changes: 1 addition & 1 deletion examples/rendezvous/src/bin/rzv-register.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ async fn main() {
tcp::tokio::Transport::default()
.upgrade(Version::V1Lazy)
.authenticate(noise::Config::new(&key_pair).unwrap())
.multiplex(yamux::YamuxConfig::default())
.multiplex(yamux::Config::default())
.boxed(),
MyBehaviour {
rendezvous: rendezvous::client::Behaviour::new(key_pair.clone()),
Expand Down
2 changes: 1 addition & 1 deletion examples/rendezvous/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ async fn main() {
tcp::tokio::Transport::default()
.upgrade(Version::V1Lazy)
.authenticate(noise::Config::new(&key_pair).unwrap())
.multiplex(yamux::YamuxConfig::default())
.multiplex(yamux::Config::default())
.boxed(),
MyBehaviour {
identify: identify::Behaviour::new(identify::Config::new(
Expand Down
4 changes: 2 additions & 2 deletions interop-tests/src/bin/ping.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,9 +181,9 @@ async fn main() -> Result<()> {
Ok(())
}

fn muxer_protocol_from_env() -> Result<Either<yamux::YamuxConfig, mplex::MplexConfig>> {
fn muxer_protocol_from_env() -> Result<Either<yamux::Config, mplex::MplexConfig>> {
Ok(match from_env("muxer")? {
Muxer::Yamux => Either::Left(yamux::YamuxConfig::default()),
Muxer::Yamux => Either::Left(yamux::Config::default()),
Muxer::Mplex => Either::Right(mplex::MplexConfig::new()),
})
}
Expand Down
2 changes: 1 addition & 1 deletion libp2p/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ libp2p-rendezvous = { version = "0.12.0", path = "../protocols/rendezvous", opti
libp2p-request-response = { version = "0.24.0", path = "../protocols/request-response", optional = true }
libp2p-swarm = { version = "0.42.0", path = "../swarm" }
libp2p-wasm-ext = { version = "0.39.0", path = "../transports/wasm-ext", optional = true }
libp2p-yamux = { version = "0.43.0", path = "../muxers/yamux", optional = true }
libp2p-yamux = { version = "0.43.1", path = "../muxers/yamux", optional = true }
multiaddr = { version = "0.17.0" }
pin-project = "1.0.0"

Expand Down
4 changes: 2 additions & 2 deletions libp2p/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ pub async fn development_transport(
.upgrade(core::upgrade::Version::V1)
.authenticate(noise::Config::new(&keypair).unwrap())
.multiplex(core::upgrade::SelectUpgrade::new(
yamux::YamuxConfig::default(),
yamux::Config::default(),
#[allow(deprecated)]
mplex::MplexConfig::default(),
))
Expand Down Expand Up @@ -290,7 +290,7 @@ pub fn tokio_development_transport(
.upgrade(core::upgrade::Version::V1)
.authenticate(noise::Config::new(&keypair).unwrap())
.multiplex(core::upgrade::SelectUpgrade::new(
yamux::YamuxConfig::default(),
yamux::Config::default(),
#[allow(deprecated)]
mplex::MplexConfig::default(),
))
Expand Down
8 changes: 8 additions & 0 deletions muxers/yamux/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
## 0.43.1 - unreleased

- Drop `Yamux` prefix from all types.
Users are encouraged to import the `yamux` module and refer to types via `yamux::Muxer`, `yamux::Config` etc.
See [PR XXXX].

[PR XXXX]: https://github.com/libp2p/rust-libp2p/pull/XXXX

## 0.43.0

- Update to `libp2p-core` `v0.39.0`.
Expand Down
2 changes: 1 addition & 1 deletion muxers/yamux/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "libp2p-yamux"
edition = "2021"
rust-version = "1.60.0"
description = "Yamux multiplexing protocol for libp2p"
version = "0.43.0"
version = "0.43.1"
authors = ["Parity Technologies <[email protected]>"]
license = "MIT"
repository = "https://github.com/libp2p/rust-libp2p"
Expand Down
Loading

0 comments on commit b1cdf8d

Please sign in to comment.