Skip to content

Commit ab9555c

Browse files
feat: deprecate webrtc and quic features in libp2p crate
We currently expose `libp2p-quic` and `libp2p-webrtc` as submodules from the `libp2p` crate despite those only being "alpha" status. This causes problems because we need to pin those dependencies due to `cargo` automatically upgrading alphas (which are allowed to incur breaking changes as per semver spec). Additionally, exposing these modules practically hides the "alpha" state of those modules, rendering it kind of obsolete. The "alpha" state is still true for those modules, thus to properly communicate this to users, we deprecate the modules and require users to spell out the dependency and the alpha version in their manifest. Pull-Request: #3580.
1 parent 48a70e5 commit ab9555c

File tree

5 files changed

+27
-7
lines changed

5 files changed

+27
-7
lines changed

Cargo.lock

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

interop-tests/Cargo.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@ anyhow = "1"
1010
either = "1.8.0"
1111
env_logger = "0.10.0"
1212
futures = "0.3.27"
13-
libp2p = { path = "../libp2p", features = ["websocket", "quic", "mplex", "yamux", "tcp", "tokio", "ping", "noise", "tls", "dns", "rsa", "macros", "webrtc"] }
13+
libp2p = { path = "../libp2p", features = ["websocket", "mplex", "yamux", "tcp", "tokio", "ping", "noise", "tls", "dns", "rsa", "macros"] }
14+
libp2p-quic = { path = "../transports/quic", features = ["tokio"] }
15+
libp2p-webrtc = { path = "../transports/webrtc", features = ["tokio"] }
1416
log = "0.4"
1517
rand = "0.8.5"
1618
redis = { version = "0.22.1", default-features = false, features = ["tokio-comp"] }

interop-tests/src/bin/ping.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,11 @@ use libp2p::swarm::{keep_alive, NetworkBehaviour, SwarmEvent};
1313
use libp2p::tls::TlsStream;
1414
use libp2p::websocket::WsConfig;
1515
use libp2p::{
16-
identity, mplex, noise, ping, quic, swarm::SwarmBuilder, tcp, tls, webrtc, yamux,
17-
InboundUpgradeExt, Multiaddr, OutboundUpgradeExt, PeerId, Transport as _,
16+
identity, mplex, noise, ping, swarm::SwarmBuilder, tcp, tls, yamux, InboundUpgradeExt,
17+
Multiaddr, OutboundUpgradeExt, PeerId, Transport as _,
1818
};
19+
use libp2p_quic as quic;
20+
use libp2p_webrtc as webrtc;
1921
use redis::AsyncCommands;
2022

2123
#[tokio::main]

libp2p/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,13 @@
33
- Introduce `libp2p::connection_limits` module.
44
See [PR 3386].
55

6+
- Deprecate the `quic` and `webrtc` feature.
7+
These two crates are only in alpha state.
8+
To properly communicate this to users, we want them to add the dependency directly which makes the `alpha` version visible.
9+
See [PR 3580].
10+
611
[PR 3386]: https://github.com/libp2p/rust-libp2p/pull/3386
12+
[PR 3580]: https://github.com/libp2p/rust-libp2p/pull/3580
713

814
# 0.51.1
915

libp2p/src/lib.rs

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,12 @@ pub use libp2p_plaintext as plaintext;
9797
pub use libp2p_pnet as pnet;
9898
#[cfg(feature = "quic")]
9999
#[cfg(not(target_arch = "wasm32"))]
100-
#[doc(inline)]
101-
pub use libp2p_quic as quic;
100+
#[deprecated(
101+
note = "`quic` is only in alpha status. Please depend on `libp2p-quic` directly and don't ues the `quic` feature of `libp2p`."
102+
)]
103+
pub mod quic {
104+
pub use libp2p_quic::*;
105+
}
102106
#[cfg(feature = "relay")]
103107
#[doc(inline)]
104108
pub use libp2p_relay as relay;
@@ -131,8 +135,12 @@ pub use libp2p_wasm_ext as wasm_ext;
131135
#[cfg(feature = "webrtc")]
132136
#[cfg_attr(docsrs, doc(cfg(feature = "webrtc")))]
133137
#[cfg(not(target_arch = "wasm32"))]
134-
#[doc(inline)]
135-
pub use libp2p_webrtc as webrtc;
138+
#[deprecated(
139+
note = "`webrtc` is only in alpha status. Please depend on `libp2p-webrtc` directly and don't ues the `webrtc` feature of `libp2p`."
140+
)]
141+
pub mod webrtc {
142+
pub use libp2p_webrtc::*;
143+
}
136144
#[cfg(feature = "websocket")]
137145
#[cfg(not(target_arch = "wasm32"))]
138146
#[doc(inline)]

0 commit comments

Comments
 (0)