Skip to content

Commit

Permalink
feat: introduce libp2p-connection-limits connection management module
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
thomaseizinger committed Mar 21, 2023
1 parent 0341817 commit 48a70e5
Show file tree
Hide file tree
Showing 17 changed files with 643 additions and 18 deletions.
23 changes: 21 additions & 2 deletions Cargo.lock

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

18 changes: 9 additions & 9 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,43 +11,43 @@ members = [
"examples/ping-example",
"examples/rendezvous",
"identity",
"interop-tests",
"misc/connection-limits",
"misc/keygen",
"misc/metrics",
"misc/multistream-select",
"misc/rw-stream-sink",
"misc/keygen",
"misc/quick-protobuf-codec",
"misc/quickcheck-ext",
"misc/rw-stream-sink",
"muxers/mplex",
"muxers/yamux",
"muxers/test-harness",
"protocols/dcutr",
"muxers/yamux",
"protocols/autonat",
"protocols/dcutr",
"protocols/floodsub",
"protocols/gossipsub",
"protocols/rendezvous",
"protocols/identify",
"protocols/kad",
"protocols/mdns",
"protocols/perf",
"protocols/ping",
"protocols/relay",
"protocols/rendezvous",
"protocols/request-response",
"swarm",
"swarm-derive",
"interop-tests",
"swarm-test",
"transports/deflate",
"transports/dns",
"transports/noise",
"transports/tls",
"transports/plaintext",
"transports/pnet",
"transports/quic",
"transports/tcp",
"transports/tls",
"transports/uds",
"transports/websocket",
"transports/wasm-ext",
"transports/webrtc",
"interop-tests"
"transports/websocket",
]
resolver = "2"
7 changes: 7 additions & 0 deletions libp2p/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# 0.52.2 - unreleased

- Introduce `libp2p::connection_limits` module.
See [PR 3386].

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

# 0.51.1

- Depend on `libp2p-tls` `v0.1.0`.
Expand Down
3 changes: 2 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 = "1.65.0"
description = "Peer-to-peer networking library"
version = "0.51.1"
version = "0.51.2"
authors = ["Parity Technologies <admin@parity.io>"]
license = "MIT"
repository = "https://github.com/libp2p/rust-libp2p"
Expand Down Expand Up @@ -97,6 +97,7 @@ getrandom = "0.2.3" # Explicit dependency to be used in `wasm-bindgen` feature
instant = "0.1.11" # Explicit dependency to be used in `wasm-bindgen` feature

libp2p-autonat = { version = "0.10.0", path = "../protocols/autonat", optional = true }
libp2p-connection-limits = { version = "0.1.0", path = "../misc/connection-limits" }
libp2p-core = { version = "0.39.0", path = "../core" }
libp2p-dcutr = { version = "0.9.0", path = "../protocols/dcutr", optional = true }
libp2p-floodsub = { version = "0.42.0", path = "../protocols/floodsub", optional = true }
Expand Down
2 changes: 2 additions & 0 deletions libp2p/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ pub use multiaddr;
#[doc(inline)]
pub use libp2p_autonat as autonat;
#[doc(inline)]
pub use libp2p_connection_limits as connection_limits;
#[doc(inline)]
pub use libp2p_core as core;
#[cfg(feature = "dcutr")]
#[doc(inline)]
Expand Down
3 changes: 3 additions & 0 deletions misc/connection-limits/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# 0.1.0 - unreleased

- Initial release.
25 changes: 25 additions & 0 deletions misc/connection-limits/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
[package]
name = "libp2p-connection-limits"
edition = "2021"
rust-version = "1.62.0"
description = "Connection limits for libp2p."
version = "0.1.0"
license = "MIT"
repository = "https://github.com/libp2p/rust-libp2p"
keywords = ["peer-to-peer", "libp2p", "networking"]
categories = ["network-programming", "asynchronous"]

[dependencies]
libp2p-core = { version = "0.39.0", path = "../../core" }
libp2p-swarm = { version = "0.42.0", path = "../../swarm" }
libp2p-identity = { version = "0.1.0", path = "../../identity", features = ["peerid"] }
void = "1"

[dev-dependencies]
async-std = { version = "1.12.0", features = ["attributes"] }
libp2p-identify = { path = "../../protocols/identify" }
libp2p-ping = { path = "../../protocols/ping" }
libp2p-swarm-derive = { path = "../../swarm-derive" }
libp2p-swarm-test = { path = "../../swarm-test" }
quickcheck-ext = { path = "../quickcheck-ext" }
rand = "0.8.5"

0 comments on commit 48a70e5

Please sign in to comment.