Skip to content

Commit

Permalink
feat: deprecate webrtc and quic features in libp2p crate
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
thomaseizinger committed Mar 21, 2023
1 parent 48a70e5 commit ab9555c
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 7 deletions.
2 changes: 2 additions & 0 deletions Cargo.lock

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

4 changes: 3 additions & 1 deletion interop-tests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ anyhow = "1"
either = "1.8.0"
env_logger = "0.10.0"
futures = "0.3.27"
libp2p = { path = "../libp2p", features = ["websocket", "quic", "mplex", "yamux", "tcp", "tokio", "ping", "noise", "tls", "dns", "rsa", "macros", "webrtc"] }
libp2p = { path = "../libp2p", features = ["websocket", "mplex", "yamux", "tcp", "tokio", "ping", "noise", "tls", "dns", "rsa", "macros"] }
libp2p-quic = { path = "../transports/quic", features = ["tokio"] }
libp2p-webrtc = { path = "../transports/webrtc", features = ["tokio"] }
log = "0.4"
rand = "0.8.5"
redis = { version = "0.22.1", default-features = false, features = ["tokio-comp"] }
Expand Down
6 changes: 4 additions & 2 deletions interop-tests/src/bin/ping.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,11 @@ use libp2p::swarm::{keep_alive, NetworkBehaviour, SwarmEvent};
use libp2p::tls::TlsStream;
use libp2p::websocket::WsConfig;
use libp2p::{
identity, mplex, noise, ping, quic, swarm::SwarmBuilder, tcp, tls, webrtc, yamux,
InboundUpgradeExt, Multiaddr, OutboundUpgradeExt, PeerId, Transport as _,
identity, mplex, noise, ping, swarm::SwarmBuilder, tcp, tls, yamux, InboundUpgradeExt,
Multiaddr, OutboundUpgradeExt, PeerId, Transport as _,
};
use libp2p_quic as quic;
use libp2p_webrtc as webrtc;
use redis::AsyncCommands;

#[tokio::main]
Expand Down
6 changes: 6 additions & 0 deletions libp2p/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,13 @@
- Introduce `libp2p::connection_limits` module.
See [PR 3386].

- Deprecate the `quic` and `webrtc` feature.
These two crates are only in alpha state.
To properly communicate this to users, we want them to add the dependency directly which makes the `alpha` version visible.
See [PR 3580].

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

# 0.51.1

Expand Down
16 changes: 12 additions & 4 deletions libp2p/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,12 @@ pub use libp2p_plaintext as plaintext;
pub use libp2p_pnet as pnet;
#[cfg(feature = "quic")]
#[cfg(not(target_arch = "wasm32"))]
#[doc(inline)]
pub use libp2p_quic as quic;
#[deprecated(
note = "`quic` is only in alpha status. Please depend on `libp2p-quic` directly and don't ues the `quic` feature of `libp2p`."
)]
pub mod quic {
pub use libp2p_quic::*;
}
#[cfg(feature = "relay")]
#[doc(inline)]
pub use libp2p_relay as relay;
Expand Down Expand Up @@ -131,8 +135,12 @@ pub use libp2p_wasm_ext as wasm_ext;
#[cfg(feature = "webrtc")]
#[cfg_attr(docsrs, doc(cfg(feature = "webrtc")))]
#[cfg(not(target_arch = "wasm32"))]
#[doc(inline)]
pub use libp2p_webrtc as webrtc;
#[deprecated(
note = "`webrtc` is only in alpha status. Please depend on `libp2p-webrtc` directly and don't ues the `webrtc` feature of `libp2p`."
)]
pub mod webrtc {
pub use libp2p_webrtc::*;
}
#[cfg(feature = "websocket")]
#[cfg(not(target_arch = "wasm32"))]
#[doc(inline)]
Expand Down

0 comments on commit ab9555c

Please sign in to comment.