Skip to content

Commit 95890b5

Browse files
authored
refactor(dns): unify symbol naming
Renamed the following - `dns::GenDnsConfig` -> `dns::Config` - `dns::DnsConfig` -> `dns::async_std::Config` - `dns::TokioDnsConfig` -> `dns::tokio::Config` If async-std feature is enable, use `dns::async_std::Config`. When using tokio, import `dns::tokio::Config` . There is no need to use `dns::Config` directly. Resolves #4486. Related: #2217. Pull-Request: #4505.
1 parent b4d9e52 commit 95890b5

File tree

11 files changed

+153
-126
lines changed

11 files changed

+153
-126
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
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
@@ -78,7 +78,7 @@ libp2p-connection-limits = { version = "0.2.1", path = "misc/connection-limits"
7878
libp2p-core = { version = "0.40.1", path = "core" }
7979
libp2p-dcutr = { version = "0.10.0", path = "protocols/dcutr" }
8080
libp2p-deflate = { version = "0.40.0", path = "transports/deflate" }
81-
libp2p-dns = { version = "0.40.0", path = "transports/dns" }
81+
libp2p-dns = { version = "0.40.1", path = "transports/dns" }
8282
libp2p-floodsub = { version = "0.43.0", path = "protocols/floodsub" }
8383
libp2p-gossipsub = { version = "0.45.1", path = "protocols/gossipsub" }
8484
libp2p-identify = { version = "0.43.0", path = "protocols/identify" }

examples/dcutr/src/main.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,7 @@ use libp2p::{
3333
transport::Transport,
3434
upgrade,
3535
},
36-
dcutr,
37-
dns::DnsConfig,
38-
identify, identity, noise, ping, quic, relay,
36+
dcutr, dns, identify, identity, noise, ping, quic, relay,
3937
swarm::{NetworkBehaviour, SwarmBuilder, SwarmEvent},
4038
tcp, yamux, PeerId,
4139
};
@@ -102,7 +100,7 @@ fn main() -> Result<(), Box<dyn Error>> {
102100
&local_key,
103101
)));
104102

105-
block_on(DnsConfig::system(relay_tcp_quic_transport))
103+
block_on(dns::async_std::Transport::system(relay_tcp_quic_transport))
106104
.unwrap()
107105
.map(|either_output, _| match either_output {
108106
Either::Left((peer_id, muxer)) => (peer_id, StreamMuxerBox::new(muxer)),

libp2p/src/lib.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -189,12 +189,12 @@ pub async fn development_transport(
189189
keypair: identity::Keypair,
190190
) -> std::io::Result<core::transport::Boxed<(PeerId, core::muxing::StreamMuxerBox)>> {
191191
let transport = {
192-
let dns_tcp = dns::DnsConfig::system(tcp::async_io::Transport::new(
192+
let dns_tcp = dns::async_std::Transport::system(tcp::async_io::Transport::new(
193193
tcp::Config::new().nodelay(true),
194194
))
195195
.await?;
196196
let ws_dns_tcp = websocket::WsConfig::new(
197-
dns::DnsConfig::system(tcp::async_io::Transport::new(
197+
dns::async_std::Transport::system(tcp::async_io::Transport::new(
198198
tcp::Config::new().nodelay(true),
199199
))
200200
.await?,
@@ -234,10 +234,10 @@ pub fn tokio_development_transport(
234234
keypair: identity::Keypair,
235235
) -> std::io::Result<core::transport::Boxed<(PeerId, core::muxing::StreamMuxerBox)>> {
236236
let transport = {
237-
let dns_tcp = dns::TokioDnsConfig::system(tcp::tokio::Transport::new(
237+
let dns_tcp = dns::tokio::Transport::system(tcp::tokio::Transport::new(
238238
tcp::Config::new().nodelay(true),
239239
))?;
240-
let ws_dns_tcp = websocket::WsConfig::new(dns::TokioDnsConfig::system(
240+
let ws_dns_tcp = websocket::WsConfig::new(dns::tokio::Transport::system(
241241
tcp::tokio::Transport::new(tcp::Config::new().nodelay(true)),
242242
)?);
243243
dns_tcp.or_transport(ws_dns_tcp)

misc/server/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ async fn main() -> Result<(), Box<dyn Error>> {
8888

8989
let quic_transport = quic::tokio::Transport::new(quic::Config::new(&local_keypair));
9090

91-
dns::TokioDnsConfig::system(libp2p::core::transport::OrTransport::new(
91+
dns::tokio::Transport::system(libp2p::core::transport::OrTransport::new(
9292
quic_transport,
9393
tcp_transport,
9494
))?

protocols/perf/src/bin/perf.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,7 @@ async fn swarm<B: NetworkBehaviour + Default>() -> Result<Swarm<B>> {
405405
libp2p_quic::tokio::Transport::new(config)
406406
};
407407

408-
let dns = libp2p_dns::TokioDnsConfig::system(OrTransport::new(quic, tcp))?;
408+
let dns = libp2p_dns::tokio::Transport::system(OrTransport::new(quic, tcp))?;
409409

410410
dns.map(|either_output, _| match either_output {
411411
Either::Left((peer_id, muxer)) => (peer_id, StreamMuxerBox::new(muxer)),

transports/dns/CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
## 0.40.1 - unreleased
2+
3+
- Remove `Dns` prefix from types like `TokioDnsConfig` and `DnsConfig` in favor of modules that describe the different variants.
4+
Users are encouraged to import the `libp2p::dns` module and refer to types as `dns::tokio::Transport` and `dns::async_std::Transport`.
5+
See [PR 4505].
6+
7+
[PR 4505]: https://github.com/libp2p/rust-libp2p/pull/4505
8+
19
## 0.40.0
210

311
- Raise MSRV to 1.65.

transports/dns/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name = "libp2p-dns"
33
edition = "2021"
44
rust-version = { workspace = true }
55
description = "DNS transport implementation for libp2p"
6-
version = "0.40.0"
6+
version = "0.40.1"
77
authors = ["Parity Technologies <admin@parity.io>"]
88
license = "MIT"
99
repository = "https://github.com/libp2p/rust-libp2p"
@@ -35,7 +35,7 @@ tokio = ["trust-dns-resolver/tokio-runtime"]
3535
tokio-dns-over-rustls = ["tokio", "trust-dns-resolver/dns-over-rustls"]
3636
tokio-dns-over-https-rustls = ["tokio", "trust-dns-resolver/dns-over-https-rustls"]
3737

38-
# Passing arguments to the docsrs builder in order to properly document cfg's.
38+
# Passing arguments to the docsrs builder in order to properly document cfg's.
3939
# More information: https://docs.rs/about/builds#cross-compiling
4040
[package.metadata.docs.rs]
4141
all-features = true

0 commit comments

Comments
 (0)