Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(dns): unify symbol naming #4505

Merged
merged 18 commits into from
Sep 24, 2023
Merged
Show file tree
Hide file tree
Changes from 15 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.lock

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

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ libp2p-connection-limits = { version = "0.2.1", path = "misc/connection-limits"
libp2p-core = { version = "0.40.1", path = "core" }
libp2p-dcutr = { version = "0.10.0", path = "protocols/dcutr" }
libp2p-deflate = { version = "0.40.0", path = "transports/deflate" }
libp2p-dns = { version = "0.40.0", path = "transports/dns" }
libp2p-dns = { version = "0.40.1", path = "transports/dns" }
libp2p-floodsub = { version = "0.43.0", path = "protocols/floodsub" }
libp2p-gossipsub = { version = "0.45.1", path = "protocols/gossipsub" }
libp2p-identify = { version = "0.43.0", path = "protocols/identify" }
Expand Down
6 changes: 2 additions & 4 deletions examples/dcutr/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,7 @@ use libp2p::{
transport::Transport,
upgrade,
},
dcutr,
dns::DnsConfig,
identify, identity, noise, ping, quic, relay,
dcutr, dns, identify, identity, noise, ping, quic, relay,
swarm::{NetworkBehaviour, SwarmBuilder, SwarmEvent},
tcp, yamux, PeerId,
};
Expand Down Expand Up @@ -102,7 +100,7 @@ fn main() -> Result<(), Box<dyn Error>> {
&local_key,
)));

block_on(DnsConfig::system(relay_tcp_quic_transport))
block_on(dns::async_std::Transport::system(relay_tcp_quic_transport))
.unwrap()
.map(|either_output, _| match either_output {
Either::Left((peer_id, muxer)) => (peer_id, StreamMuxerBox::new(muxer)),
Expand Down
8 changes: 4 additions & 4 deletions libp2p/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -189,12 +189,12 @@ pub async fn development_transport(
keypair: identity::Keypair,
) -> std::io::Result<core::transport::Boxed<(PeerId, core::muxing::StreamMuxerBox)>> {
let transport = {
let dns_tcp = dns::DnsConfig::system(tcp::async_io::Transport::new(
let dns_tcp = dns::async_std::Transport::system(tcp::async_io::Transport::new(
tcp::Config::new().nodelay(true),
))
.await?;
let ws_dns_tcp = websocket::WsConfig::new(
dns::DnsConfig::system(tcp::async_io::Transport::new(
dns::async_std::Transport::system(tcp::async_io::Transport::new(
tcp::Config::new().nodelay(true),
))
.await?,
Expand Down Expand Up @@ -234,10 +234,10 @@ pub fn tokio_development_transport(
keypair: identity::Keypair,
) -> std::io::Result<core::transport::Boxed<(PeerId, core::muxing::StreamMuxerBox)>> {
let transport = {
let dns_tcp = dns::TokioDnsConfig::system(tcp::tokio::Transport::new(
let dns_tcp = dns::tokio::Transport::system(tcp::tokio::Transport::new(
tcp::Config::new().nodelay(true),
))?;
let ws_dns_tcp = websocket::WsConfig::new(dns::TokioDnsConfig::system(
let ws_dns_tcp = websocket::WsConfig::new(dns::tokio::Transport::system(
tcp::tokio::Transport::new(tcp::Config::new().nodelay(true)),
)?);
dns_tcp.or_transport(ws_dns_tcp)
Expand Down
2 changes: 1 addition & 1 deletion misc/server/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ async fn main() -> Result<(), Box<dyn Error>> {

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

dns::TokioDnsConfig::system(libp2p::core::transport::OrTransport::new(
dns::tokio::Transport::system(libp2p::core::transport::OrTransport::new(
quic_transport,
tcp_transport,
))?
Expand Down
2 changes: 1 addition & 1 deletion protocols/perf/src/bin/perf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ async fn swarm<B: NetworkBehaviour + Default>() -> Result<Swarm<B>> {
libp2p_quic::tokio::Transport::new(config)
};

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

dns.map(|either_output, _| match either_output {
Either::Left((peer_id, muxer)) => (peer_id, StreamMuxerBox::new(muxer)),
Expand Down
7 changes: 7 additions & 0 deletions transports/dns/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
## 0.40.1 - unreleased

- Remove `Dns` prefix from types like `TokioDnsConfig` and `DnsConfig` in favor of modules that describe the different variants. Users are encouraged to import the `libp2p::dns` module and refer to types as `dns::tokio::Transport` and `dns::async_std::Transport`.
thomaseizinger marked this conversation as resolved.
Show resolved Hide resolved
See [PR 4505].

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

## 0.40.0

- Raise MSRV to 1.65.
Expand Down
4 changes: 2 additions & 2 deletions transports/dns/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "libp2p-dns"
edition = "2021"
rust-version = { workspace = true }
description = "DNS transport implementation for libp2p"
version = "0.40.0"
version = "0.40.1"
authors = ["Parity Technologies <admin@parity.io>"]
license = "MIT"
repository = "https://github.com/libp2p/rust-libp2p"
Expand Down Expand Up @@ -35,7 +35,7 @@ tokio = ["trust-dns-resolver/tokio-runtime"]
tokio-dns-over-rustls = ["tokio", "trust-dns-resolver/dns-over-rustls"]
tokio-dns-over-https-rustls = ["tokio", "trust-dns-resolver/dns-over-https-rustls"]

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