Skip to content

Commit 4d45dea

Browse files
authored
Merge branch 'master' into feat/quic/deprecated-draft-29
2 parents f8050bf + 9907a94 commit 4d45dea

32 files changed

+356
-182
lines changed

.github/workflows/ci.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ jobs:
308308
RUSTFLAGS: ''
309309
steps:
310310
- uses: actions/checkout@v4
311-
- run: wget -q -O- https://github.com/obi1kenobi/cargo-semver-checks/releases/download/v0.36.0/cargo-semver-checks-x86_64-unknown-linux-gnu.tar.gz | tar -xz -C ~/.cargo/bin
311+
- run: wget -q -O- https://github.com/obi1kenobi/cargo-semver-checks/releases/download/v0.39.0/cargo-semver-checks-x86_64-unknown-linux-gnu.tar.gz | tar -xz -C ~/.cargo/bin
312312
shell: bash
313313
- uses: obi1kenobi/cargo-semver-checks-action@7272cc2caa468d3e009a2b0a9cc366839348237b # v2.6
314314

Cargo.lock

+4-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+4-4
Original file line numberDiff line numberDiff line change
@@ -81,25 +81,25 @@ libp2p-dcutr = { version = "0.13.0", path = "protocols/dcutr" }
8181
libp2p-dns = { version = "0.43.0", path = "transports/dns" }
8282
libp2p-floodsub = { version = "0.46.1", path = "protocols/floodsub" }
8383
libp2p-gossipsub = { version = "0.48.1", path = "protocols/gossipsub" }
84-
libp2p-identify = { version = "0.46.0", path = "protocols/identify" }
84+
libp2p-identify = { version = "0.47.0", path = "protocols/identify" }
8585
libp2p-identity = { version = "0.2.10" }
8686
libp2p-kad = { version = "0.47.0", path = "protocols/kad" }
8787
libp2p-mdns = { version = "0.47.0", path = "protocols/mdns" }
8888
libp2p-memory-connection-limits = { version = "0.4.0", path = "misc/memory-connection-limits" }
89-
libp2p-metrics = { version = "0.16.0", path = "misc/metrics" }
89+
libp2p-metrics = { version = "0.16.1", path = "misc/metrics" }
9090
libp2p-mplex = { version = "0.43.1", path = "muxers/mplex" }
9191
libp2p-noise = { version = "0.46.0", path = "transports/noise" }
9292
libp2p-perf = { version = "0.4.0", path = "protocols/perf" }
9393
libp2p-ping = { version = "0.46.0", path = "protocols/ping" }
9494
libp2p-plaintext = { version = "0.43.0", path = "transports/plaintext" }
9595
libp2p-pnet = { version = "0.26.0", path = "transports/pnet" }
9696
libp2p-quic = { version = "0.12.1", path = "transports/quic" }
97-
libp2p-relay = { version = "0.19.1", path = "protocols/relay" }
97+
libp2p-relay = { version = "0.20.0", path = "protocols/relay" }
9898
libp2p-rendezvous = { version = "0.16.0", path = "protocols/rendezvous" }
9999
libp2p-request-response = { version = "0.28.1", path = "protocols/request-response" }
100100
libp2p-server = { version = "0.12.6", path = "misc/server" }
101101
libp2p-stream = { version = "0.3.0-alpha", path = "protocols/stream" }
102-
libp2p-swarm = { version = "0.46.1", path = "swarm" }
102+
libp2p-swarm = { version = "0.47.0", path = "swarm" }
103103
libp2p-swarm-derive = { version = "=0.35.1", path = "swarm-derive" } # `libp2p-swarm-derive` may not be compatible with different `libp2p-swarm` non-breaking releases. E.g. `libp2p-swarm` might introduce a new enum variant `FromSwarm` (which is `#[non-exhaustive]`) in a non-breaking release. Older versions of `libp2p-swarm-derive` would not forward this enum variant within the `NetworkBehaviour` hierarchy. Thus the version pinning is required.
104104
libp2p-swarm-test = { version = "0.5.0", path = "swarm-test" }
105105
libp2p-tcp = { version = "0.43.0", path = "transports/tcp" }

ROADMAP.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
Below is a high level roadmap for the rust-libp2p project.
44
Items are ordered by priority (high to low).
55

6-
This is a living document.
6+
This is a living document. We believe the roadmap should be shaped by the needs of our user community. Many of the items below are contributions made by downstream users.
77
Input is always welcome e.g. via GitHub issues or pull requests.
88

99
This is the roadmap of the Rust implementation of libp2p.

libp2p/CHANGELOG.md

+3
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
- Introduce `libp2p-webrtc-websys` behind `webrtc-websys` feature flag.
33
See [PR 5819](https://github.com/libp2p/rust-libp2p/pull/5819).
44

5+
- Make the `*-websys` variants (`libp2p-webrtc-websys`, `libp2p-websocket-websys`, `libp2p-webtransport-websys`) only available on wasm32 target architecture.
6+
See [PR 5891](https://github.com/libp2p/rust-libp2p/pull/5891).
7+
58
## 0.55.0
69

710
- Raise MSRV to 1.83.0.

libp2p/Cargo.toml

+5-4
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,6 @@ futures-timer = "3.0.2" # Explicit dependency to be used in `wasm-bindgen` featu
9999
getrandom = { workspace = true } # Explicit dependency to be used in `wasm-bindgen` feature
100100
# TODO feature flag?
101101
rw-stream-sink = { workspace = true }
102-
103102
libp2p-allow-block-list = { workspace = true }
104103
libp2p-autonat = { workspace = true, optional = true }
105104
libp2p-connection-limits = { workspace = true }
@@ -119,14 +118,16 @@ libp2p-relay = { workspace = true, optional = true }
119118
libp2p-rendezvous = { workspace = true, optional = true }
120119
libp2p-request-response = { workspace = true, optional = true }
121120
libp2p-swarm = { workspace = true }
122-
libp2p-webrtc-websys = { workspace = true, optional = true }
123-
libp2p-websocket-websys = { workspace = true, optional = true }
124-
libp2p-webtransport-websys = { workspace = true, optional = true }
125121
libp2p-yamux = { workspace = true, optional = true }
126122
multiaddr = { workspace = true }
127123
pin-project = "1.0.0"
128124
thiserror = { workspace = true }
129125

126+
[target.'cfg(target_arch = "wasm32")'.dependencies]
127+
libp2p-webrtc-websys = { workspace = true, optional = true }
128+
libp2p-websocket-websys = { workspace = true, optional = true }
129+
libp2p-webtransport-websys = { workspace = true, optional = true }
130+
130131
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
131132
libp2p-dns = { workspace = true, optional = true }
132133
libp2p-mdns = { workspace = true, optional = true }

libp2p/src/lib.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -123,17 +123,17 @@ pub use libp2p_uds as uds;
123123
#[cfg(not(target_arch = "wasm32"))]
124124
#[doc(inline)]
125125
pub use libp2p_upnp as upnp;
126-
#[cfg(feature = "webrtc-websys")]
126+
#[cfg(all(feature = "webrtc-websys", target_arch = "wasm32"))]
127127
#[doc(inline)]
128128
pub use libp2p_webrtc_websys as webrtc_websys;
129129
#[cfg(feature = "websocket")]
130130
#[cfg(not(target_arch = "wasm32"))]
131131
#[doc(inline)]
132132
pub use libp2p_websocket as websocket;
133-
#[cfg(feature = "websocket-websys")]
133+
#[cfg(all(feature = "websocket-websys", target_arch = "wasm32"))]
134134
#[doc(inline)]
135135
pub use libp2p_websocket_websys as websocket_websys;
136-
#[cfg(feature = "webtransport-websys")]
136+
#[cfg(all(feature = "webtransport-websys", target_arch = "wasm32"))]
137137
#[cfg_attr(docsrs, doc(cfg(feature = "webtransport-websys")))]
138138
#[doc(inline)]
139139
pub use libp2p_webtransport_websys as webtransport_websys;

libp2p/src/tutorials/ping.rs

+11-2
Original file line numberDiff line numberDiff line change
@@ -205,12 +205,12 @@
205205
//! ## Idle connection timeout
206206
//!
207207
//! Now, for this example in particular, we need set the idle connection timeout.
208-
//! Otherwise, the connection will be closed immediately.
208+
//! The default connection timeout is 10 seconds.
209209
//!
210210
//! Whether you need to set this in your application too depends on your usecase.
211211
//! Typically, connections are kept alive if they are "in use" by a certain protocol.
212212
//! The ping protocol however is only an "auxiliary" kind of protocol.
213-
//! Thus, without any other behaviour in place, we would not be able to observe the pings.
213+
//! Thus, without any other behaviour in place, we would not be able to observe any pings after 10s.
214214
//!
215215
//! ```rust
216216
//! use std::{error::Error, time::Duration};
@@ -232,6 +232,9 @@
232232
//! yamux::Config::default,
233233
//! )?
234234
//! .with_behaviour(|_| ping::Behaviour::default())?
235+
//! .with_swarm_config(|cfg| {
236+
//! cfg.with_idle_connection_timeout(Duration::from_secs(u64::MAX))
237+
//! }) // Allows us to observe pings indefinitely.
235238
//! .build();
236239
//!
237240
//! Ok(())
@@ -284,6 +287,9 @@
284287
//! yamux::Config::default,
285288
//! )?
286289
//! .with_behaviour(|_| ping::Behaviour::default())?
290+
//! .with_swarm_config(|cfg| {
291+
//! cfg.with_idle_connection_timeout(Duration::from_secs(u64::MAX))
292+
//! }) // Allows us to observe pings indefinitely.
287293
//! .build();
288294
//!
289295
//! // Tell the swarm to listen on all interfaces and a random, OS-assigned
@@ -329,6 +335,9 @@
329335
//! yamux::Config::default,
330336
//! )?
331337
//! .with_behaviour(|_| ping::Behaviour::default())?
338+
//! .with_swarm_config(|cfg| {
339+
//! cfg.with_idle_connection_timeout(Duration::from_secs(u64::MAX))
340+
//! }) // Allows us to observe pings indefinitely.
332341
//! .build();
333342
//!
334343
//! // Tell the swarm to listen on all interfaces and a random, OS-assigned

misc/metrics/CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 0.16.1
2+
- Add `ReservationClosed` as a relay metric.
3+
See [PR 5869](https://github.com/libp2p/rust-libp2p/pull/5869).
4+
15
## 0.16.0
26

37
<!-- Update to libp2p-core v0.43.0 -->

misc/metrics/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name = "libp2p-metrics"
33
edition = "2021"
44
rust-version = { workspace = true }
55
description = "Metrics for libp2p"
6-
version = "0.16.0"
6+
version = "0.16.1"
77
authors = ["Max Inden <[email protected]>"]
88
license = "MIT"
99
repository = "https://github.com/libp2p/rust-libp2p"

misc/metrics/src/relay.rs

+2
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ enum EventType {
5454
ReservationReqAcceptFailed,
5555
ReservationReqDenied,
5656
ReservationReqDenyFailed,
57+
ReservationClosed,
5758
ReservationTimedOut,
5859
CircuitReqDenied,
5960
CircuitReqDenyFailed,
@@ -76,6 +77,7 @@ impl From<&libp2p_relay::Event> for EventType {
7677
libp2p_relay::Event::ReservationReqDenyFailed { .. } => {
7778
EventType::ReservationReqDenyFailed
7879
}
80+
libp2p_relay::Event::ReservationClosed { .. } => EventType::ReservationClosed,
7981
libp2p_relay::Event::ReservationTimedOut { .. } => EventType::ReservationTimedOut,
8082
libp2p_relay::Event::CircuitReqDenied { .. } => EventType::CircuitReqDenied,
8183
#[allow(deprecated)]

protocols/gossipsub/CHANGELOG.md

+3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
## 0.48.1
2+
- Allow whitelisting topics for metrics to ensure metrics are recorded correctly for these topics.
3+
See [PR 5895](https://github.com/libp2p/rust-libp2p/pull/5895)
4+
25
- Improve `max_messages_per_rpc` consistency by ensuring RPC control messages also adhere to the existing limits.
36
See [PR 5826](https://github.com/libp2p/rust-libp2p/pull/5826)
47

protocols/gossipsub/src/behaviour.rs

+7
Original file line numberDiff line numberDiff line change
@@ -3053,6 +3053,13 @@ where
30533053
}
30543054
}
30553055
}
3056+
3057+
/// Register topics to ensure metrics are recorded correctly for these topics.
3058+
pub fn register_topics_for_metrics(&mut self, topics: Vec<TopicHash>) {
3059+
if let Some(metrics) = &mut self.metrics {
3060+
metrics.register_allowed_topics(topics);
3061+
}
3062+
}
30563063
}
30573064

30583065
fn get_ip_addr(addr: &Multiaddr) -> Option<IpAddr> {

protocols/gossipsub/src/metrics.rs

+7
Original file line numberDiff line numberDiff line change
@@ -648,6 +648,13 @@ impl Metrics {
648648
metric.set(metric.get() - 1);
649649
}
650650
}
651+
652+
/// Registers a set of topics that we want to store calculate metrics for.
653+
pub(crate) fn register_allowed_topics(&mut self, topics: Vec<TopicHash>) {
654+
for topic_hash in topics {
655+
self.topic_info.insert(topic_hash, true);
656+
}
657+
}
651658
}
652659

653660
/// Reasons why a peer was included in the mesh.

protocols/identify/CHANGELOG.md

+5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
## 0.47.0
2+
3+
- Implement optional `signedPeerRecord` support for identify messages.
4+
See [PR 5785](https://github.com/libp2p/rust-libp2p/pull/5785)
5+
16
## 0.46.0
27

38
- Add `hide_listen_addrs` option to prevent leaking (local) listen addresses.

protocols/identify/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name = "libp2p-identify"
33
edition = "2021"
44
rust-version = { workspace = true }
55
description = "Nodes identification protocol for libp2p"
6-
version = "0.46.0"
6+
version = "0.47.0"
77
authors = ["Parity Technologies <[email protected]>"]
88
license = "MIT"
99
repository = "https://github.com/libp2p/rust-libp2p"

0 commit comments

Comments
 (0)