Skip to content

Commit

Permalink
Merge branch 'master' into connection-limit-whitelist
Browse files Browse the repository at this point in the history
  • Loading branch information
dariusc93 authored Feb 1, 2025
2 parents 2836212 + fef298b commit 368313c
Show file tree
Hide file tree
Showing 23 changed files with 140 additions and 92 deletions.
15 changes: 8 additions & 7 deletions Cargo.lock

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

8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -72,15 +72,15 @@ resolver = "2"
rust-version = "1.83.0"

[workspace.dependencies]
libp2p = { version = "0.55.0", path = "libp2p" }
libp2p = { version = "0.55.1", path = "libp2p" }
libp2p-allow-block-list = { version = "0.5.0", path = "misc/allow-block-list" }
libp2p-autonat = { version = "0.14.0", path = "protocols/autonat" }
libp2p-connection-limits = { version = "0.5.0", path = "misc/connection-limits" }
libp2p-core = { version = "0.43.0", path = "core" }
libp2p-dcutr = { version = "0.13.0", path = "protocols/dcutr" }
libp2p-dns = { version = "0.43.0", path = "transports/dns" }
libp2p-floodsub = { version = "0.46.0", path = "protocols/floodsub" }
libp2p-gossipsub = { version = "0.48.0", path = "protocols/gossipsub" }
libp2p-gossipsub = { version = "0.48.1", path = "protocols/gossipsub" }
libp2p-identify = { version = "0.46.0", path = "protocols/identify" }
libp2p-identity = { version = "0.2.10" }
libp2p-kad = { version = "0.47.0", path = "protocols/kad" }
Expand All @@ -94,9 +94,9 @@ libp2p-ping = { version = "0.46.0", path = "protocols/ping" }
libp2p-plaintext = { version = "0.43.0", path = "transports/plaintext" }
libp2p-pnet = { version = "0.26.0", path = "transports/pnet" }
libp2p-quic = { version = "0.12.0", path = "transports/quic" }
libp2p-relay = { version = "0.19.0", path = "protocols/relay" }
libp2p-relay = { version = "0.19.1", path = "protocols/relay" }
libp2p-rendezvous = { version = "0.16.0", path = "protocols/rendezvous" }
libp2p-request-response = { version = "0.28.0", path = "protocols/request-response" }
libp2p-request-response = { version = "0.28.1", path = "protocols/request-response" }
libp2p-server = { version = "0.12.6", path = "misc/server" }
libp2p-stream = { version = "0.3.0-alpha", path = "protocols/stream" }
libp2p-swarm = { version = "0.46.0", path = "swarm" }
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).

(In alphabetical order.)

- Guillaume Michel ([@guillaumemichel](https://github.com/guillaumemichel))
- João Oliveira ([@jxs](https://github.com/jxs))

## Notable users
Expand All @@ -102,5 +101,6 @@ Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).
- [Subspace](https://github.com/subspace/subspace) - Subspace Network reference implementation
- [Substrate](https://github.com/paritytech/substrate) - Framework for blockchain innovation,
used by [Polkadot](https://www.parity.io/technologies/polkadot/).
- [Swarm NL](https://github.com/algorealmInc/SwarmNL) - A library that makes it easy to configure the networking requirements for any distributed application.
- [Taple](https://github.com/opencanarias/taple-core) - Sustainable DLT for asset and process traceability by [OpenCanarias](https://www.opencanarias.com/en/).
- [Ceylon](https://github.com/ceylonai/ceylon) - A Multi-Agent System (MAS) Development Framework.
2 changes: 1 addition & 1 deletion core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ tracing = { workspace = true }
unsigned-varint = { workspace = true }

[dev-dependencies]
async-std = { version = "1.6.2", features = ["attributes"] }
tokio = { workspace = true, features = ["rt", "macros"] }
libp2p-mplex = { path = "../muxers/mplex" } # Using `path` here because this is a cyclic dev-dependency which otherwise breaks releasing.
libp2p-noise = { path = "../transports/noise" } # Using `path` here because this is a cyclic dev-dependency which otherwise breaks releasing.
multihash = { workspace = true, features = ["arb"] }
Expand Down
9 changes: 5 additions & 4 deletions core/tests/transport_upgrade.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ where
}
}

#[test]
fn upgrade_pipeline() {
#[tokio::test]
async fn upgrade_pipeline() {
let listener_keys = identity::Keypair::generate_ed25519();
let listener_id = listener_keys.public().to_peer_id();
let mut listener_transport = MemoryTransport::default()
Expand Down Expand Up @@ -137,6 +137,7 @@ fn upgrade_pipeline() {
assert_eq!(peer, listener_id);
};

async_std::task::spawn(server);
async_std::task::block_on(client);
tokio::spawn(server);

client.await;
}
4 changes: 4 additions & 0 deletions libp2p/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.55.1
- Introduce `libp2p-webrtc-websys` behind `webrtc-websys` feature flag.
See [PR 5819](https://github.com/libp2p/rust-libp2p/pull/5819).

## 0.55.0

- Raise MSRV to 1.83.0.
Expand Down
5 changes: 4 additions & 1 deletion libp2p/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "libp2p"
edition = "2021"
rust-version = { workspace = true }
description = "Peer-to-peer networking library"
version = "0.55.0"
version = "0.55.1"
authors = ["Parity Technologies <admin@parity.io>"]
license = "MIT"
repository = "https://github.com/libp2p/rust-libp2p"
Expand Down Expand Up @@ -44,6 +44,7 @@ full = [
"tokio",
"uds",
"wasm-bindgen",
"webrtc-websys",
"websocket-websys",
"websocket",
"webtransport-websys",
Expand Down Expand Up @@ -83,6 +84,7 @@ tls = ["dep:libp2p-tls"]
tokio = [ "libp2p-swarm/tokio", "libp2p-mdns?/tokio", "libp2p-tcp?/tokio", "libp2p-dns?/tokio", "libp2p-quic?/tokio", "libp2p-upnp?/tokio"]
uds = ["dep:libp2p-uds"]
wasm-bindgen = [ "futures-timer/wasm-bindgen", "getrandom/js", "libp2p-swarm/wasm-bindgen", "libp2p-gossipsub?/wasm-bindgen"]
webrtc-websys = ['dep:libp2p-webrtc-websys']
websocket-websys = ["dep:libp2p-websocket-websys"]
websocket = ["dep:libp2p-websocket"]
webtransport-websys = ["dep:libp2p-webtransport-websys"]
Expand Down Expand Up @@ -117,6 +119,7 @@ libp2p-relay = { workspace = true, optional = true }
libp2p-rendezvous = { workspace = true, optional = true }
libp2p-request-response = { workspace = true, optional = true }
libp2p-swarm = { workspace = true }
libp2p-webrtc-websys = { workspace = true, optional = true }
libp2p-websocket-websys = { workspace = true, optional = true }
libp2p-webtransport-websys = { workspace = true, optional = true }
libp2p-yamux = { workspace = true, optional = true }
Expand Down
3 changes: 3 additions & 0 deletions libp2p/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,9 @@ pub use libp2p_uds as uds;
#[cfg(not(target_arch = "wasm32"))]
#[doc(inline)]
pub use libp2p_upnp as upnp;
#[cfg(feature = "webrtc-websys")]
#[doc(inline)]
pub use libp2p_webrtc_websys as webrtc_websys;
#[cfg(feature = "websocket")]
#[cfg(not(target_arch = "wasm32"))]
#[doc(inline)]
Expand Down
2 changes: 1 addition & 1 deletion misc/allow-block-list/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ libp2p-swarm = { workspace = true }
libp2p-identity = { workspace = true, features = ["peerid"] }

[dev-dependencies]
async-std = { version = "1.12.0", features = ["attributes"] }
tokio = { workspace = true, features = ["rt", "macros"] }
libp2p-swarm-derive = { path = "../../swarm-derive" }
libp2p-swarm-test = { path = "../../swarm-test" }

Expand Down
18 changes: 9 additions & 9 deletions misc/allow-block-list/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ mod tests {

use super::*;

#[async_std::test]
#[tokio::test]
async fn cannot_dial_blocked_peer() {
let mut dialer = Swarm::new_ephemeral(|_| Behaviour::<BlockedPeers>::default());
let mut listener = Swarm::new_ephemeral(|_| Behaviour::<BlockedPeers>::default());
Expand All @@ -319,7 +319,7 @@ mod tests {
assert!(cause.downcast::<Blocked>().is_ok());
}

#[async_std::test]
#[tokio::test]
async fn can_dial_unblocked_peer() {
let mut dialer = Swarm::new_ephemeral(|_| Behaviour::<BlockedPeers>::default());
let mut listener = Swarm::new_ephemeral(|_| Behaviour::<BlockedPeers>::default());
Expand All @@ -333,15 +333,15 @@ mod tests {
dial(&mut dialer, &listener).unwrap();
}

#[async_std::test]
#[tokio::test]
async fn blocked_peer_cannot_dial_us() {
let mut dialer = Swarm::new_ephemeral(|_| Behaviour::<BlockedPeers>::default());
let mut listener = Swarm::new_ephemeral(|_| Behaviour::<BlockedPeers>::default());
listener.listen().with_memory_addr_external().await;

listener.behaviour_mut().block_peer(*dialer.local_peer_id());
dial(&mut dialer, &listener).unwrap();
async_std::task::spawn(dialer.loop_on_next());
tokio::spawn(dialer.loop_on_next());

let cause = listener
.wait(|e| match e {
Expand All @@ -355,7 +355,7 @@ mod tests {
assert!(cause.downcast::<Blocked>().is_ok());
}

#[async_std::test]
#[tokio::test]
async fn connections_get_closed_upon_blocked() {
let mut dialer = Swarm::new_ephemeral(|_| Behaviour::<BlockedPeers>::default());
let mut listener = Swarm::new_ephemeral(|_| Behaviour::<BlockedPeers>::default());
Expand All @@ -381,7 +381,7 @@ mod tests {
assert_eq!(closed_listener_peer, *dialer.local_peer_id());
}

#[async_std::test]
#[tokio::test]
async fn cannot_dial_peer_unless_allowed() {
let mut dialer = Swarm::new_ephemeral(|_| Behaviour::<AllowedPeers>::default());
let mut listener = Swarm::new_ephemeral(|_| Behaviour::<AllowedPeers>::default());
Expand All @@ -396,7 +396,7 @@ mod tests {
assert!(dial(&mut dialer, &listener).is_ok());
}

#[async_std::test]
#[tokio::test]
async fn cannot_dial_disallowed_peer() {
let mut dialer = Swarm::new_ephemeral(|_| Behaviour::<AllowedPeers>::default());
let mut listener = Swarm::new_ephemeral(|_| Behaviour::<AllowedPeers>::default());
Expand All @@ -413,7 +413,7 @@ mod tests {
assert!(cause.downcast::<NotAllowed>().is_ok());
}

#[async_std::test]
#[tokio::test]
async fn not_allowed_peer_cannot_dial_us() {
let mut dialer = Swarm::new_ephemeral(|_| Behaviour::<AllowedPeers>::default());
let mut listener = Swarm::new_ephemeral(|_| Behaviour::<AllowedPeers>::default());
Expand Down Expand Up @@ -450,7 +450,7 @@ mod tests {
assert!(incoming_cause.downcast::<NotAllowed>().is_ok());
}

#[async_std::test]
#[tokio::test]
async fn connections_get_closed_upon_disallow() {
let mut dialer = Swarm::new_ephemeral(|_| Behaviour::<AllowedPeers>::default());
let mut listener = Swarm::new_ephemeral(|_| Behaviour::<AllowedPeers>::default());
Expand Down
2 changes: 1 addition & 1 deletion misc/connection-limits/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ libp2p-swarm = { workspace = true }
libp2p-identity = { workspace = true, features = ["peerid"] }

[dev-dependencies]
async-std = { version = "1.12.0", features = ["attributes"] }
tokio = { workspace = true, features = ["macros", "rt-multi-thread"] }
libp2p-identify = { workspace = true }
libp2p-ping = { workspace = true }
libp2p-swarm-derive = { path = "../../swarm-derive" }
Expand Down
Loading

0 comments on commit 368313c

Please sign in to comment.