Skip to content

Commit d3e88cf

Browse files
authored
feat: remove async_std support in QUIC crate
Pull-Request: #5954.
1 parent bee820e commit d3e88cf

File tree

14 files changed

+22
-255
lines changed

14 files changed

+22
-255
lines changed

Cargo.lock

Lines changed: 1 addition & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ libp2p-perf = { version = "0.4.0", path = "protocols/perf" }
9696
libp2p-ping = { version = "0.46.0", path = "protocols/ping" }
9797
libp2p-plaintext = { version = "0.43.0", path = "transports/plaintext" }
9898
libp2p-pnet = { version = "0.26.0", path = "transports/pnet" }
99-
libp2p-quic = { version = "0.12.1", path = "transports/quic" }
99+
libp2p-quic = { version = "0.13.0", path = "transports/quic" }
100100
libp2p-relay = { version = "0.20.0", path = "protocols/relay" }
101101
libp2p-rendezvous = { version = "0.16.1", path = "protocols/rendezvous" }
102102
libp2p-request-response = { version = "0.28.1", path = "protocols/request-response" }

libp2p/CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212

1313
- Make the `*-websys` variants (`libp2p-webrtc-websys`, `libp2p-websocket-websys`, `libp2p-webtransport-websys`) only available on wasm32 target architecture.
1414
See [PR 5891](https://github.com/libp2p/rust-libp2p/pull/5891).
15+
16+
- Remove QUIC from the `async-std` swarm builder, as `async-std` support was removed from `libp2p-quic` transport.
17+
See [PR 5954](https://github.com/libp2p/rust-libp2p/pull/5954)
1518

1619
## 0.55.0
1720

libp2p/Cargo.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ full = [
5353
"upnp",
5454
]
5555

56-
async-std = [ "libp2p-swarm/async-std", "libp2p-tcp?/async-io", "libp2p-dns?/async-std", "libp2p-quic?/async-std",]
56+
async-std = ["libp2p-swarm/async-std", "libp2p-tcp?/async-io", "libp2p-dns?/async-std"]
5757
autonat = ["dep:libp2p-autonat"]
5858
cbor = ["libp2p-request-response?/cbor"]
5959
dcutr = ["dep:libp2p-dcutr", "libp2p-metrics?/dcutr"]
@@ -83,9 +83,9 @@ secp256k1 = ["libp2p-identity/secp256k1"]
8383
serde = ["libp2p-core/serde", "libp2p-kad?/serde", "libp2p-gossipsub?/serde"]
8484
tcp = ["dep:libp2p-tcp"]
8585
tls = ["dep:libp2p-tls"]
86-
tokio = [ "libp2p-swarm/tokio", "libp2p-mdns?/tokio", "libp2p-tcp?/tokio", "libp2p-dns?/tokio", "libp2p-quic?/tokio", "libp2p-upnp?/tokio"]
86+
tokio = ["libp2p-swarm/tokio", "libp2p-mdns?/tokio", "libp2p-tcp?/tokio", "libp2p-dns?/tokio", "libp2p-quic?/tokio", "libp2p-upnp?/tokio"]
8787
uds = ["dep:libp2p-uds"]
88-
wasm-bindgen = [ "futures-timer/wasm-bindgen", "getrandom/js", "libp2p-swarm/wasm-bindgen", "libp2p-gossipsub?/wasm-bindgen"]
88+
wasm-bindgen = ["futures-timer/wasm-bindgen", "getrandom/js", "libp2p-swarm/wasm-bindgen", "libp2p-gossipsub?/wasm-bindgen"]
8989
webrtc-websys = ['dep:libp2p-webrtc-websys']
9090
websocket-websys = ["dep:libp2p-websocket-websys"]
9191
websocket = ["dep:libp2p-websocket"]
@@ -144,7 +144,7 @@ libp2p-websocket = { workspace = true, optional = true }
144144

145145
[dev-dependencies]
146146
async-std = { version = "1.6.2", features = ["attributes"] }
147-
tokio = { workspace = true, features = [ "io-util", "io-std", "macros", "rt", "rt-multi-thread"] }
147+
tokio = { workspace = true, features = ["io-util", "io-std", "macros", "rt", "rt-multi-thread"] }
148148

149149
libp2p-mplex = { workspace = true }
150150
libp2p-tcp = { workspace = true, features = ["tokio"] }

libp2p/src/builder.rs

Lines changed: 0 additions & 98 deletions
Original file line numberDiff line numberDiff line change
@@ -135,17 +135,6 @@ mod tests {
135135
.build();
136136
}
137137

138-
#[test]
139-
#[cfg(all(feature = "async-std", feature = "quic"))]
140-
fn async_std_quic() {
141-
let _ = SwarmBuilder::with_new_identity()
142-
.with_async_std()
143-
.with_quic()
144-
.with_behaviour(|_| libp2p_swarm::dummy::Behaviour)
145-
.unwrap()
146-
.build();
147-
}
148-
149138
#[test]
150139
#[cfg(all(feature = "tokio", feature = "quic"))]
151140
fn quic_config() {
@@ -157,17 +146,6 @@ mod tests {
157146
.build();
158147
}
159148

160-
#[test]
161-
#[cfg(all(feature = "async-std", feature = "quic"))]
162-
fn async_std_quic_config() {
163-
let _ = SwarmBuilder::with_new_identity()
164-
.with_async_std()
165-
.with_quic_config(|config| config)
166-
.with_behaviour(|_| libp2p_swarm::dummy::Behaviour)
167-
.unwrap()
168-
.build();
169-
}
170-
171149
#[test]
172150
#[cfg(all(feature = "tokio", feature = "tcp", feature = "tls", feature = "yamux"))]
173151
fn tcp_yamux_mplex() {
@@ -230,30 +208,6 @@ mod tests {
230208
.build();
231209
}
232210

233-
#[test]
234-
#[cfg(all(
235-
feature = "async-std",
236-
feature = "tcp",
237-
feature = "tls",
238-
feature = "noise",
239-
feature = "yamux",
240-
feature = "quic"
241-
))]
242-
fn async_std_tcp_quic() {
243-
let _ = SwarmBuilder::with_new_identity()
244-
.with_async_std()
245-
.with_tcp(
246-
Default::default(),
247-
(libp2p_tls::Config::new, libp2p_noise::Config::new),
248-
libp2p_yamux::Config::default,
249-
)
250-
.unwrap()
251-
.with_quic()
252-
.with_behaviour(|_| libp2p_swarm::dummy::Behaviour)
253-
.unwrap()
254-
.build();
255-
}
256-
257211
#[test]
258212
#[cfg(all(
259213
feature = "tokio",
@@ -278,30 +232,6 @@ mod tests {
278232
.build();
279233
}
280234

281-
#[test]
282-
#[cfg(all(
283-
feature = "async-std",
284-
feature = "tcp",
285-
feature = "tls",
286-
feature = "noise",
287-
feature = "yamux",
288-
feature = "quic"
289-
))]
290-
fn async_std_tcp_quic_config() {
291-
let _ = SwarmBuilder::with_new_identity()
292-
.with_async_std()
293-
.with_tcp(
294-
Default::default(),
295-
(libp2p_tls::Config::new, libp2p_noise::Config::new),
296-
libp2p_yamux::Config::default,
297-
)
298-
.unwrap()
299-
.with_quic_config(|config| config)
300-
.with_behaviour(|_| libp2p_swarm::dummy::Behaviour)
301-
.unwrap()
302-
.build();
303-
}
304-
305235
#[test]
306236
#[cfg(all(
307237
feature = "tokio",
@@ -431,34 +361,6 @@ mod tests {
431361
.build();
432362
}
433363

434-
#[tokio::test]
435-
#[cfg(all(
436-
feature = "async-std",
437-
feature = "tcp",
438-
feature = "noise",
439-
feature = "yamux",
440-
feature = "quic",
441-
feature = "dns"
442-
))]
443-
async fn async_std_tcp_quic_dns_config() {
444-
SwarmBuilder::with_new_identity()
445-
.with_async_std()
446-
.with_tcp(
447-
Default::default(),
448-
(libp2p_tls::Config::new, libp2p_noise::Config::new),
449-
libp2p_yamux::Config::default,
450-
)
451-
.unwrap()
452-
.with_quic()
453-
.with_dns_config(
454-
libp2p_dns::ResolverConfig::default(),
455-
libp2p_dns::ResolverOpts::default(),
456-
)
457-
.with_behaviour(|_| libp2p_swarm::dummy::Behaviour)
458-
.unwrap()
459-
.build();
460-
}
461-
462364
/// Showcases how to provide custom transports unknown to the libp2p crate, e.g. WebRTC.
463365
#[test]
464366
#[cfg(feature = "tokio")]

libp2p/src/builder/phase/quic.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ macro_rules! impl_quic_builder {
5959
};
6060
}
6161

62-
impl_quic_builder!("async-std", AsyncStd, async_std);
6362
impl_quic_builder!("tokio", super::provider::Tokio, tokio);
6463

6564
impl<Provider, T> SwarmBuilder<Provider, QuicPhase<T>> {

libp2p/src/builder/phase/tcp.rs

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -114,18 +114,6 @@ impl<Provider> SwarmBuilder<Provider, TcpPhase> {
114114
}
115115
}
116116

117-
// Shortcuts
118-
#[cfg(all(not(target_arch = "wasm32"), feature = "quic", feature = "async-std"))]
119-
impl SwarmBuilder<super::provider::AsyncStd, TcpPhase> {
120-
pub fn with_quic(
121-
self,
122-
) -> SwarmBuilder<
123-
super::provider::AsyncStd,
124-
OtherTransportPhase<impl AuthenticatedMultiplexedTransport>,
125-
> {
126-
self.without_tcp().with_quic()
127-
}
128-
}
129117
#[cfg(all(not(target_arch = "wasm32"), feature = "quic", feature = "tokio"))]
130118
impl SwarmBuilder<super::provider::Tokio, TcpPhase> {
131119
pub fn with_quic(
@@ -137,18 +125,6 @@ impl SwarmBuilder<super::provider::Tokio, TcpPhase> {
137125
self.without_tcp().with_quic()
138126
}
139127
}
140-
#[cfg(all(not(target_arch = "wasm32"), feature = "quic", feature = "async-std"))]
141-
impl SwarmBuilder<super::provider::AsyncStd, TcpPhase> {
142-
pub fn with_quic_config(
143-
self,
144-
constructor: impl FnOnce(libp2p_quic::Config) -> libp2p_quic::Config,
145-
) -> SwarmBuilder<
146-
super::provider::AsyncStd,
147-
OtherTransportPhase<impl AuthenticatedMultiplexedTransport>,
148-
> {
149-
self.without_tcp().with_quic_config(constructor)
150-
}
151-
}
152128
#[cfg(all(not(target_arch = "wasm32"), feature = "quic", feature = "tokio"))]
153129
impl SwarmBuilder<super::provider::Tokio, TcpPhase> {
154130
pub fn with_quic_config(

transports/quic/CHANGELOG.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
## 0.12.1
1+
## 0.13.0
2+
3+
- Remove `async-std` support.
4+
See [PR 5954](https://github.com/libp2p/rust-libp2p/pull/5954)
25

36
- Deprecate `Config::support_draft_29`.
47
See [PR 5786](https://github.com/libp2p/rust-libp2p/pull/5786).

transports/quic/Cargo.toml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "libp2p-quic"
3-
version = "0.12.1"
3+
version = "0.13.0"
44
authors = ["Parity Technologies <[email protected]>"]
55
edition.workspace = true
66
rust-version = { workspace = true }
@@ -9,7 +9,6 @@ repository = "https://github.com/libp2p/rust-libp2p"
99
license = "MIT"
1010

1111
[dependencies]
12-
async-std = { version = "1.12.0", optional = true }
1312
futures = { workspace = true }
1413
futures-timer = "3.0.3"
1514
if-watch = { workspace = true }
@@ -27,7 +26,6 @@ ring = { workspace = true }
2726

2827
[features]
2928
tokio = ["dep:tokio", "if-watch/tokio", "quinn/runtime-tokio"]
30-
async-std = ["dep:async-std", "if-watch/smol", "quinn/runtime-async-std"]
3129

3230
# Passing arguments to the docsrs builder in order to properly document cfg's.
3331
# More information: https://docs.rs/about/builds#cross-compiling

transports/quic/src/lib.rs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,26 +25,26 @@
2525
//! Example:
2626
//!
2727
//! ```
28-
//! # #[cfg(not(feature = "async-std"))]
28+
//! # #[cfg(not(feature = "tokio"))]
2929
//! # fn main() {}
3030
//! #
31-
//! # #[cfg(feature = "async-std")]
32-
//! # fn main() -> std::io::Result<()> {
31+
//! # #[cfg(feature = "tokio")]
32+
//! # #[tokio::main]
33+
//! # async fn main() -> std::io::Result<()> {
3334
//! #
3435
//! use libp2p_core::{transport::ListenerId, Multiaddr, Transport};
3536
//! use libp2p_quic as quic;
3637
//!
3738
//! let keypair = libp2p_identity::Keypair::generate_ed25519();
3839
//! let quic_config = quic::Config::new(&keypair);
39-
//!
40-
//! let mut quic_transport = quic::async_std::Transport::new(quic_config);
41-
//!
40+
//! let mut quic_transport = quic::tokio::Transport::new(quic_config);
4241
//! let addr = "/ip4/127.0.0.1/udp/12345/quic-v1"
4342
//! .parse()
4443
//! .expect("address should be valid");
4544
//! quic_transport
4645
//! .listen_on(ListenerId::next(), addr)
4746
//! .expect("listen error.");
47+
//!
4848
//! #
4949
//! # Ok(())
5050
//! # }
@@ -70,8 +70,6 @@ use std::net::SocketAddr;
7070

7171
pub use config::Config;
7272
pub use connection::{Connecting, Connection, Stream};
73-
#[cfg(feature = "async-std")]
74-
pub use provider::async_std;
7573
#[cfg(feature = "tokio")]
7674
pub use provider::tokio;
7775
pub use provider::Provider;

0 commit comments

Comments
 (0)