From c02c98a19e2c9906627ed6ed1b0c597d5dfc6d3c Mon Sep 17 00:00:00 2001 From: xkeyC <3334969096@qq.com> Date: Sat, 5 Apr 2025 14:34:56 +0800 Subject: [PATCH] bump: hickory_resolver 0.25 --- rust/src/http_package/dns.rs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/rust/src/http_package/dns.rs b/rust/src/http_package/dns.rs index adea52e..720b1c3 100644 --- a/rust/src/http_package/dns.rs +++ b/rust/src/http_package/dns.rs @@ -1,5 +1,6 @@ use hickory_resolver::config::{NameServerConfigGroup, ResolverConfig, ResolverOpts}; -use hickory_resolver::{lookup_ip::LookupIpIntoIter, TokioAsyncResolver}; +use hickory_resolver::name_server::TokioConnectionProvider; +use hickory_resolver::{lookup_ip::LookupIpIntoIter, TokioResolver}; use once_cell::sync::{Lazy, OnceCell}; use reqwest::dns::{Addrs, Name, Resolve, Resolving}; use std::collections::HashMap; @@ -16,7 +17,7 @@ pub(crate) struct MyHickoryDnsResolver { /// 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 { @@ -71,7 +72,7 @@ impl Iterator for SocketAddrs { } } -fn new_resolver() -> io::Result { +fn new_resolver() -> io::Result { let group = NameServerConfigGroup::from_ips_clear( &[ IpAddr::V4(Ipv4Addr::new(119, 29, 29, 29)), @@ -94,5 +95,8 @@ fn new_resolver() -> io::Result { opts.try_tcp_on_error = true; opts.ip_strategy = hickory_resolver::config::LookupIpStrategy::Ipv4thenIpv6; opts.num_concurrent_reqs = 3; - Ok(TokioAsyncResolver::tokio(cfg, opts)) + let provider = TokioConnectionProvider::default(); + let mut builder = TokioResolver::builder_with_config(cfg, provider); + *builder.options_mut() = opts; + Ok(builder.build()) }