Skip to content

Commit

Permalink
Merge branch 'master' into feat/3591-remove-close
Browse files Browse the repository at this point in the history
  • Loading branch information
mergify[bot] authored Nov 2, 2023
2 parents a473af5 + e6905fe commit f23b208
Show file tree
Hide file tree
Showing 7 changed files with 78 additions and 101 deletions.
126 changes: 52 additions & 74 deletions 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 protocols/mdns/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ smallvec = "1.11.1"
socket2 = { version = "0.5.5", features = ["all"] }
tokio = { version = "1.33", default-features = false, features = ["net", "time"], optional = true}
tracing = "0.1.37"
trust-dns-proto = { version = "0.23.0", default-features = false, features = ["mdns"] }
hickory-proto = { version = "0.24.0", default-features = false, features = ["mdns"] }
void = "1.0.2"

[features]
Expand Down
2 changes: 1 addition & 1 deletion protocols/mdns/src/behaviour/iface/dns.rs
Original file line number Diff line number Diff line change
Expand Up @@ -395,9 +395,9 @@ impl error::Error for MdnsResponseError {}
#[cfg(test)]
mod tests {
use super::*;
use hickory_proto::op::Message;
use libp2p_identity as identity;
use std::time::Duration;
use trust_dns_proto::op::Message;

#[test]
fn build_query_correct() {
Expand Down
10 changes: 5 additions & 5 deletions protocols/mdns/src/behaviour/iface/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,17 @@

use super::dns;
use crate::{META_QUERY_SERVICE_FQDN, SERVICE_NAME_FQDN};
use hickory_proto::{
op::Message,
rr::{Name, RData},
};
use libp2p_core::{
address_translation,
multiaddr::{Multiaddr, Protocol},
};
use libp2p_identity::PeerId;
use std::time::Instant;
use std::{fmt, net::SocketAddr, str, time::Duration};
use trust_dns_proto::{
op::Message,
rr::{Name, RData},
};

/// A valid mDNS packet received by the service.
#[derive(Debug)]
Expand All @@ -47,7 +47,7 @@ impl MdnsPacket {
pub(crate) fn new_from_bytes(
buf: &[u8],
from: SocketAddr,
) -> Result<Option<MdnsPacket>, trust_dns_proto::error::ProtoError> {
) -> Result<Option<MdnsPacket>, hickory_proto::error::ProtoError> {
let packet = Message::from_vec(buf)?;

if packet.query().is_none() {
Expand Down
4 changes: 4 additions & 0 deletions transports/dns/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
See [PR 4464](https://github.com/libp2p/rust-libp2p/pull/4464).
- Remove deprecated type-aliases.
See [PR 4739](https://github.com/libp2p/rust-libp2p/pull/4739).
- Migrate to the `hickory-dns` project which has rebranded from `trust-dns`.
We also remove the `tokio-dns-over-rustls` and `tokio-dns-over-https-rustls` features.
Users should activate these features themselves on `hickory-resolver` if so desired.
See [PR 4780](https://github.com/libp2p/rust-libp2p/pull/4780).

## 0.40.1

Expand Down
11 changes: 3 additions & 8 deletions transports/dns/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ keywords = ["peer-to-peer", "libp2p", "networking"]
categories = ["network-programming", "asynchronous"]

[dependencies]
async-std-resolver = { version = "0.23", optional = true }
async-std-resolver = { version = "0.24", optional = true }
async-trait = "0.1.74"
futures = "0.3.28"
libp2p-core = { workspace = true }
libp2p-identity = { workspace = true }
parking_lot = "0.12.0"
hickory-resolver = { version = "0.24.0", default-features = false, features = ["system-config"] }
smallvec = "1.11.1"
tracing = "0.1.37"
trust-dns-resolver = { version = "0.23", default-features = false, features = ["system-config"] }

[dev-dependencies]
libp2p-identity = { workspace = true, features = ["rand"] }
Expand All @@ -29,12 +29,7 @@ tracing-subscriber = { version = "0.3", features = ["env-filter"] }

[features]
async-std = ["async-std-resolver"]
tokio = ["trust-dns-resolver/tokio-runtime"]
# The `tokio-` prefix and feature dependency is just to be explicit,
# since these features of `trust-dns-resolver` are currently only
# available for `tokio`.
tokio-dns-over-rustls = ["tokio", "trust-dns-resolver/dns-over-rustls"]
tokio-dns-over-https-rustls = ["tokio", "trust-dns-resolver/dns-over-https-rustls"]
tokio = ["hickory-resolver/tokio-runtime"]

# Passing arguments to the docsrs builder in order to properly document cfg's.
# More information: https://docs.rs/about/builds#cross-compiling
Expand Down
24 changes: 12 additions & 12 deletions transports/dns/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,12 @@
#[cfg(feature = "async-std")]
pub mod async_std {
use async_std_resolver::AsyncStdResolver;
use parking_lot::Mutex;
use std::{io, sync::Arc};
use trust_dns_resolver::{
use hickory_resolver::{
config::{ResolverConfig, ResolverOpts},
system_conf,
};
use parking_lot::Mutex;
use std::{io, sync::Arc};

/// A `Transport` wrapper for performing DNS lookups when dialing `Multiaddr`esses
/// using `async-std` for all async I/O.
Expand All @@ -90,9 +90,9 @@ pub mod async_std {

#[cfg(feature = "tokio")]
pub mod tokio {
use hickory_resolver::{system_conf, TokioAsyncResolver};
use parking_lot::Mutex;
use std::sync::Arc;
use trust_dns_resolver::{system_conf, TokioAsyncResolver};

/// A `Transport` wrapper for performing DNS lookups when dialing `Multiaddr`esses
/// using `tokio` for all async I/O.
Expand All @@ -109,8 +109,8 @@ pub mod tokio {
/// and options.
pub fn custom(
inner: T,
cfg: trust_dns_resolver::config::ResolverConfig,
opts: trust_dns_resolver::config::ResolverOpts,
cfg: hickory_resolver::config::ResolverConfig,
opts: hickory_resolver::config::ResolverOpts,
) -> Transport<T> {
Transport {
inner: Arc::new(Mutex::new(inner)),
Expand Down Expand Up @@ -141,12 +141,12 @@ use std::{
task::{Context, Poll},
};

pub use trust_dns_resolver::config::{ResolverConfig, ResolverOpts};
pub use trust_dns_resolver::error::{ResolveError, ResolveErrorKind};
use trust_dns_resolver::lookup::{Ipv4Lookup, Ipv6Lookup, TxtLookup};
use trust_dns_resolver::lookup_ip::LookupIp;
use trust_dns_resolver::name_server::ConnectionProvider;
use trust_dns_resolver::AsyncResolver;
pub use hickory_resolver::config::{ResolverConfig, ResolverOpts};
pub use hickory_resolver::error::{ResolveError, ResolveErrorKind};
use hickory_resolver::lookup::{Ipv4Lookup, Ipv6Lookup, TxtLookup};
use hickory_resolver::lookup_ip::LookupIp;
use hickory_resolver::name_server::ConnectionProvider;
use hickory_resolver::AsyncResolver;

/// The prefix for `dnsaddr` protocol TXT record lookups.
const DNSADDR_PREFIX: &str = "_dnsaddr.";
Expand Down

0 comments on commit f23b208

Please sign in to comment.