Skip to content

Commit 7cdf4d5

Browse files
authored
feat: deprecate async_std support in DNS crate
Pull-Request: #5959.
1 parent 7a4310d commit 7cdf4d5

File tree

11 files changed

+20
-251
lines changed

11 files changed

+20
-251
lines changed

Cargo.lock

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

libp2p/CHANGELOG.md

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

1616
- Remove QUIC from the `async-std` swarm builder, as `async-std` support was removed from `libp2p-quic` transport.
1717
See [PR 5954](https://github.com/libp2p/rust-libp2p/pull/5954)
18+
19+
- Remove DNS from the `async-std` swarm builder, as `async-std` support was removed from `libp2p-dns` transport.
20+
See [PR 5959](https://github.com/libp2p/rust-libp2p/pull/5959)
1821

1922
## 0.55.0
2023

libp2p/Cargo.toml

Lines changed: 1 addition & 1 deletion
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"]
56+
async-std = ["libp2p-swarm/async-std", "libp2p-tcp?/async-io"]
5757
autonat = ["dep:libp2p-autonat"]
5858
cbor = ["libp2p-request-response?/cbor"]
5959
dcutr = ["dep:libp2p-dcutr", "libp2p-metrics?/dcutr"]

libp2p/src/builder/phase/dns.rs

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -7,27 +7,6 @@ pub struct DnsPhase<T> {
77
pub(crate) transport: T,
88
}
99

10-
#[cfg(all(not(target_arch = "wasm32"), feature = "async-std", feature = "dns"))]
11-
impl<T: AuthenticatedMultiplexedTransport> SwarmBuilder<super::provider::AsyncStd, DnsPhase<T>> {
12-
pub fn with_dns(
13-
self,
14-
) -> Result<
15-
SwarmBuilder<
16-
super::provider::AsyncStd,
17-
WebsocketPhase<impl AuthenticatedMultiplexedTransport>,
18-
>,
19-
std::io::Error,
20-
> {
21-
Ok(SwarmBuilder {
22-
keypair: self.keypair,
23-
phantom: PhantomData,
24-
phase: WebsocketPhase {
25-
transport: libp2p_dns::async_std::Transport::system2(self.phase.transport)?,
26-
},
27-
})
28-
}
29-
}
30-
3110
#[cfg(all(not(target_arch = "wasm32"), feature = "tokio", feature = "dns"))]
3211
impl<T: AuthenticatedMultiplexedTransport> SwarmBuilder<super::provider::Tokio, DnsPhase<T>> {
3312
pub fn with_dns(
@@ -49,30 +28,6 @@ impl<T: AuthenticatedMultiplexedTransport> SwarmBuilder<super::provider::Tokio,
4928
}
5029
}
5130

52-
#[cfg(all(not(target_arch = "wasm32"), feature = "async-std", feature = "dns"))]
53-
impl<T: AuthenticatedMultiplexedTransport> SwarmBuilder<super::provider::AsyncStd, DnsPhase<T>> {
54-
pub fn with_dns_config(
55-
self,
56-
cfg: libp2p_dns::ResolverConfig,
57-
opts: libp2p_dns::ResolverOpts,
58-
) -> SwarmBuilder<
59-
super::provider::AsyncStd,
60-
WebsocketPhase<impl AuthenticatedMultiplexedTransport>,
61-
> {
62-
SwarmBuilder {
63-
keypair: self.keypair,
64-
phantom: PhantomData,
65-
phase: WebsocketPhase {
66-
transport: libp2p_dns::async_std::Transport::custom2(
67-
self.phase.transport,
68-
cfg,
69-
opts,
70-
),
71-
},
72-
}
73-
}
74-
}
75-
7631
#[cfg(all(not(target_arch = "wasm32"), feature = "tokio", feature = "dns"))]
7732
impl<T: AuthenticatedMultiplexedTransport> SwarmBuilder<super::provider::Tokio, DnsPhase<T>> {
7833
pub fn with_dns_config(

libp2p/src/builder/phase/other_transport.rs

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -66,22 +66,6 @@ impl<Provider, T: AuthenticatedMultiplexedTransport>
6666
}
6767

6868
// Shortcuts
69-
#[cfg(all(not(target_arch = "wasm32"), feature = "async-std", feature = "dns"))]
70-
impl<T: AuthenticatedMultiplexedTransport>
71-
SwarmBuilder<super::provider::AsyncStd, OtherTransportPhase<T>>
72-
{
73-
pub fn with_dns(
74-
self,
75-
) -> Result<
76-
SwarmBuilder<
77-
super::provider::AsyncStd,
78-
WebsocketPhase<impl AuthenticatedMultiplexedTransport>,
79-
>,
80-
std::io::Error,
81-
> {
82-
self.without_any_other_transports().with_dns()
83-
}
84-
}
8569
#[cfg(all(not(target_arch = "wasm32"), feature = "tokio", feature = "dns"))]
8670
impl<T: AuthenticatedMultiplexedTransport>
8771
SwarmBuilder<super::provider::Tokio, OtherTransportPhase<T>>
@@ -98,22 +82,6 @@ impl<T: AuthenticatedMultiplexedTransport>
9882
self.without_any_other_transports().with_dns()
9983
}
10084
}
101-
#[cfg(all(not(target_arch = "wasm32"), feature = "async-std", feature = "dns"))]
102-
impl<T: AuthenticatedMultiplexedTransport>
103-
SwarmBuilder<super::provider::AsyncStd, OtherTransportPhase<T>>
104-
{
105-
pub fn with_dns_config(
106-
self,
107-
cfg: libp2p_dns::ResolverConfig,
108-
opts: libp2p_dns::ResolverOpts,
109-
) -> SwarmBuilder<
110-
super::provider::AsyncStd,
111-
WebsocketPhase<impl AuthenticatedMultiplexedTransport>,
112-
> {
113-
self.without_any_other_transports()
114-
.with_dns_config(cfg, opts)
115-
}
116-
}
11785
#[cfg(all(not(target_arch = "wasm32"), feature = "tokio", feature = "dns"))]
11886
impl<T: AuthenticatedMultiplexedTransport>
11987
SwarmBuilder<super::provider::Tokio, OtherTransportPhase<T>>

libp2p/src/builder/phase/quic.rs

Lines changed: 1 addition & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -149,22 +149,6 @@ impl<Provider, T: AuthenticatedMultiplexedTransport> SwarmBuilder<Provider, Quic
149149
.with_behaviour(constructor)
150150
}
151151
}
152-
#[cfg(all(not(target_arch = "wasm32"), feature = "async-std", feature = "dns"))]
153-
impl<T: AuthenticatedMultiplexedTransport> SwarmBuilder<super::provider::AsyncStd, QuicPhase<T>> {
154-
pub fn with_dns(
155-
self,
156-
) -> Result<
157-
SwarmBuilder<
158-
super::provider::AsyncStd,
159-
WebsocketPhase<impl AuthenticatedMultiplexedTransport>,
160-
>,
161-
std::io::Error,
162-
> {
163-
self.without_quic()
164-
.without_any_other_transports()
165-
.with_dns()
166-
}
167-
}
168152
#[cfg(all(not(target_arch = "wasm32"), feature = "tokio", feature = "dns"))]
169153
impl<T: AuthenticatedMultiplexedTransport> SwarmBuilder<super::provider::Tokio, QuicPhase<T>> {
170154
pub fn with_dns(
@@ -181,21 +165,6 @@ impl<T: AuthenticatedMultiplexedTransport> SwarmBuilder<super::provider::Tokio,
181165
.with_dns()
182166
}
183167
}
184-
#[cfg(all(not(target_arch = "wasm32"), feature = "async-std", feature = "dns"))]
185-
impl<T: AuthenticatedMultiplexedTransport> SwarmBuilder<super::provider::AsyncStd, QuicPhase<T>> {
186-
pub fn with_dns_config(
187-
self,
188-
cfg: libp2p_dns::ResolverConfig,
189-
opts: libp2p_dns::ResolverOpts,
190-
) -> SwarmBuilder<
191-
super::provider::AsyncStd,
192-
WebsocketPhase<impl AuthenticatedMultiplexedTransport>,
193-
> {
194-
self.without_quic()
195-
.without_any_other_transports()
196-
.with_dns_config(cfg, opts)
197-
}
198-
}
199168
#[cfg(all(not(target_arch = "wasm32"), feature = "tokio", feature = "dns"))]
200169
impl<T: AuthenticatedMultiplexedTransport> SwarmBuilder<super::provider::Tokio, QuicPhase<T>> {
201170
pub fn with_dns_config(
@@ -263,13 +232,7 @@ macro_rules! impl_quic_phase_with_websocket {
263232
}
264233
}
265234
}
266-
impl_quic_phase_with_websocket!(
267-
"async-std",
268-
super::provider::AsyncStd,
269-
rw_stream_sink::RwStreamSink<
270-
libp2p_websocket::BytesConnection<libp2p_tcp::async_io::TcpStream>,
271-
>
272-
);
235+
273236
impl_quic_phase_with_websocket!(
274237
"tokio",
275238
super::provider::Tokio,

libp2p/src/builder/phase/tcp.rs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -215,13 +215,6 @@ macro_rules! impl_tcp_phase_with_websocket {
215215
}
216216
}
217217
}
218-
impl_tcp_phase_with_websocket!(
219-
"async-std",
220-
super::provider::AsyncStd,
221-
rw_stream_sink::RwStreamSink<
222-
libp2p_websocket::BytesConnection<libp2p_tcp::async_io::TcpStream>,
223-
>
224-
);
225218
impl_tcp_phase_with_websocket!(
226219
"tokio",
227220
super::provider::Tokio,

libp2p/src/builder/phase/websocket.rs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -115,16 +115,6 @@ macro_rules! impl_websocket_builder {
115115
};
116116
}
117117

118-
impl_websocket_builder!(
119-
"async-std",
120-
super::provider::AsyncStd,
121-
libp2p_dns::async_std::Transport::system(libp2p_tcp::async_io::Transport::new(
122-
libp2p_tcp::Config::default(),
123-
)),
124-
rw_stream_sink::RwStreamSink<
125-
libp2p_websocket::BytesConnection<libp2p_tcp::async_io::TcpStream>,
126-
>
127-
);
128118
impl_websocket_builder!(
129119
"tokio",
130120
super::provider::Tokio,

transports/dns/CHANGELOG.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
## 0.44.0
2-
3-
- Report all transport errors in a dial attempt instead of only returning the last error.
2+
3+
- Removed `async_std` module [PR 5959](https://github.com/libp2p/rust-libp2p/pull/5959)
4+
5+
- Report all transport errors in a dial attempt instead of only returning the last error.
46
See [PR 5899](https://github.com/libp2p/rust-libp2p/pull/5899).
5-
7+
68
## 0.43.0
79

810
- Upgrade `async-std-resolver` and `hickory-resolver`.

transports/dns/Cargo.toml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ keywords = ["peer-to-peer", "libp2p", "networking"]
1111
categories = ["network-programming", "asynchronous"]
1212

1313
[dependencies]
14-
async-std-resolver = { workspace = true, features = ["system-config"], optional = true }
1514
async-trait = "0.1.80"
1615
futures = { workspace = true }
1716
libp2p-core = { workspace = true }
@@ -24,11 +23,9 @@ tracing = { workspace = true }
2423
[dev-dependencies]
2524
libp2p-identity = { workspace = true, features = ["rand"] }
2625
tokio = { workspace = true, features = ["rt", "time"] }
27-
async-std-crate = { package = "async-std", version = "1.6" }
2826
tracing-subscriber = { workspace = true, features = ["env-filter"] }
2927

3028
[features]
31-
async-std = ["async-std-resolver"]
3229
tokio = ["hickory-resolver/tokio-runtime"]
3330

3431
# Passing arguments to the docsrs builder in order to properly document cfg's.

0 commit comments

Comments
 (0)