diff --git a/Cargo.toml b/Cargo.toml index fac6229ac..bcfda7c9b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -163,7 +163,7 @@ async-compression = { version = "0.4.0", default-features = false, features = [" tokio-util = { version = "0.7.9", default-features = false, features = ["codec", "io"], optional = true } ## hickory-dns -hickory-resolver = { version = "0.24", optional = true, features = ["tokio-runtime"] } +hickory-resolver = { version = "0.25", optional = true, features = ["tokio"] } once_cell = { version = "1.18", optional = true } # HTTP/3 experimental support diff --git a/src/dns/hickory.rs b/src/dns/hickory.rs index a94160b2d..f720e3613 100644 --- a/src/dns/hickory.rs +++ b/src/dns/hickory.rs @@ -1,8 +1,7 @@ //! DNS resolution via the [hickory-resolver](https://github.com/hickory-dns/hickory-dns) crate use hickory_resolver::{ - config::LookupIpStrategy, error::ResolveError, lookup_ip::LookupIpIntoIter, system_conf, - TokioAsyncResolver, + config::LookupIpStrategy, lookup_ip::LookupIpIntoIter, ResolveError, TokioResolver, }; use once_cell::sync::OnceCell; @@ -18,7 +17,7 @@ pub(crate) struct HickoryDnsResolver { /// Since we might not have been called in the context of a /// Tokio Runtime in initialization, so we must delay the actual /// construction of the resolver. - state: Arc>, + state: Arc>, } struct SocketAddrs { @@ -55,10 +54,10 @@ impl Iterator for SocketAddrs { /// which reads from `/etc/resolve.conf`. The options are /// overridden to look up for both IPv4 and IPv6 addresses /// to work with "happy eyeballs" algorithm. -fn new_resolver() -> Result { - let (config, mut opts) = system_conf::read_system_conf().map_err(HickoryDnsSystemConfError)?; - opts.ip_strategy = LookupIpStrategy::Ipv4AndIpv6; - Ok(TokioAsyncResolver::tokio(config, opts)) +fn new_resolver() -> Result { + let mut builder = TokioResolver::builder_tokio().map_err(HickoryDnsSystemConfError)?; + builder.options_mut().ip_strategy = LookupIpStrategy::Ipv4AndIpv6; + Ok(builder.build()) } impl fmt::Display for HickoryDnsSystemConfError {