Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 6 additions & 7 deletions src/dns/hickory.rs
Original file line number Diff line number Diff line change
@@ -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;

Expand All @@ -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<OnceCell<TokioAsyncResolver>>,
state: Arc<OnceCell<TokioResolver>>,
}

struct SocketAddrs {
Expand Down Expand Up @@ -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<TokioAsyncResolver, HickoryDnsSystemConfError> {
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<TokioResolver, HickoryDnsSystemConfError> {
let mut builder = TokioResolver::builder_tokio().map_err(HickoryDnsSystemConfError)?;
builder.options_mut().ip_strategy = LookupIpStrategy::Ipv4AndIpv6;
Ok(builder.build())
}

impl fmt::Display for HickoryDnsSystemConfError {
Expand Down
Loading