Skip to content

Commit 48a70e5

Browse files
feat: introduce libp2p-connection-limits connection management module
This patch deprecates the existing connection limits within `Swarm` and uses the new `NetworkBehaviour` APIs to implement it as a plugin instead. Related #2824. Pull-Request: #3386.
1 parent 0341817 commit 48a70e5

File tree

17 files changed

+643
-18
lines changed

17 files changed

+643
-18
lines changed

Cargo.lock

Lines changed: 21 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,43 +11,43 @@ members = [
1111
"examples/ping-example",
1212
"examples/rendezvous",
1313
"identity",
14+
"interop-tests",
15+
"misc/connection-limits",
16+
"misc/keygen",
1417
"misc/metrics",
1518
"misc/multistream-select",
16-
"misc/rw-stream-sink",
17-
"misc/keygen",
1819
"misc/quick-protobuf-codec",
1920
"misc/quickcheck-ext",
21+
"misc/rw-stream-sink",
2022
"muxers/mplex",
21-
"muxers/yamux",
2223
"muxers/test-harness",
23-
"protocols/dcutr",
24+
"muxers/yamux",
2425
"protocols/autonat",
26+
"protocols/dcutr",
2527
"protocols/floodsub",
2628
"protocols/gossipsub",
27-
"protocols/rendezvous",
2829
"protocols/identify",
2930
"protocols/kad",
3031
"protocols/mdns",
3132
"protocols/perf",
3233
"protocols/ping",
3334
"protocols/relay",
35+
"protocols/rendezvous",
3436
"protocols/request-response",
3537
"swarm",
3638
"swarm-derive",
37-
"interop-tests",
3839
"swarm-test",
3940
"transports/deflate",
4041
"transports/dns",
4142
"transports/noise",
42-
"transports/tls",
4343
"transports/plaintext",
4444
"transports/pnet",
4545
"transports/quic",
4646
"transports/tcp",
47+
"transports/tls",
4748
"transports/uds",
48-
"transports/websocket",
4949
"transports/wasm-ext",
5050
"transports/webrtc",
51-
"interop-tests"
51+
"transports/websocket",
5252
]
5353
resolver = "2"

libp2p/CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
# 0.52.2 - unreleased
2+
3+
- Introduce `libp2p::connection_limits` module.
4+
See [PR 3386].
5+
6+
[PR 3386]: https://github.com/libp2p/rust-libp2p/pull/3386
7+
18
# 0.51.1
29

310
- Depend on `libp2p-tls` `v0.1.0`.

libp2p/Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name = "libp2p"
33
edition = "2021"
44
rust-version = "1.65.0"
55
description = "Peer-to-peer networking library"
6-
version = "0.51.1"
6+
version = "0.51.2"
77
authors = ["Parity Technologies <[email protected]>"]
88
license = "MIT"
99
repository = "https://github.com/libp2p/rust-libp2p"
@@ -97,6 +97,7 @@ getrandom = "0.2.3" # Explicit dependency to be used in `wasm-bindgen` feature
9797
instant = "0.1.11" # Explicit dependency to be used in `wasm-bindgen` feature
9898

9999
libp2p-autonat = { version = "0.10.0", path = "../protocols/autonat", optional = true }
100+
libp2p-connection-limits = { version = "0.1.0", path = "../misc/connection-limits" }
100101
libp2p-core = { version = "0.39.0", path = "../core" }
101102
libp2p-dcutr = { version = "0.9.0", path = "../protocols/dcutr", optional = true }
102103
libp2p-floodsub = { version = "0.42.0", path = "../protocols/floodsub", optional = true }

libp2p/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ pub use multiaddr;
4444
#[doc(inline)]
4545
pub use libp2p_autonat as autonat;
4646
#[doc(inline)]
47+
pub use libp2p_connection_limits as connection_limits;
48+
#[doc(inline)]
4749
pub use libp2p_core as core;
4850
#[cfg(feature = "dcutr")]
4951
#[doc(inline)]
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# 0.1.0 - unreleased
2+
3+
- Initial release.

misc/connection-limits/Cargo.toml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
[package]
2+
name = "libp2p-connection-limits"
3+
edition = "2021"
4+
rust-version = "1.62.0"
5+
description = "Connection limits for libp2p."
6+
version = "0.1.0"
7+
license = "MIT"
8+
repository = "https://github.com/libp2p/rust-libp2p"
9+
keywords = ["peer-to-peer", "libp2p", "networking"]
10+
categories = ["network-programming", "asynchronous"]
11+
12+
[dependencies]
13+
libp2p-core = { version = "0.39.0", path = "../../core" }
14+
libp2p-swarm = { version = "0.42.0", path = "../../swarm" }
15+
libp2p-identity = { version = "0.1.0", path = "../../identity", features = ["peerid"] }
16+
void = "1"
17+
18+
[dev-dependencies]
19+
async-std = { version = "1.12.0", features = ["attributes"] }
20+
libp2p-identify = { path = "../../protocols/identify" }
21+
libp2p-ping = { path = "../../protocols/ping" }
22+
libp2p-swarm-derive = { path = "../../swarm-derive" }
23+
libp2p-swarm-test = { path = "../../swarm-test" }
24+
quickcheck-ext = { path = "../quickcheck-ext" }
25+
rand = "0.8.5"

0 commit comments

Comments
 (0)