diff --git a/Cargo.lock b/Cargo.lock index cdaa217..9b8e91c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1031,9 +1031,9 @@ dependencies = [ [[package]] name = "rs-utilities" -version = "0.4.0" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e0b59825beb0a196edd58b00d055e3859c231bb2c331100430a8db9f4a55f86" +checksum = "3992b92ab54cd07d1f0dd3112a4e1709d44373879223be17b5912590cb776c8e" dependencies = [ "android_logger", "anyhow", diff --git a/Cargo.toml b/Cargo.toml index 106fd9d..bf81302 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -23,7 +23,7 @@ bincode = "1.3.3" pin-utils = "0.1.0" enum-as-inner = "0.6" num_cpus = "1.13.1" -rs-utilities = "0.4.0" +rs-utilities = "0.4.2" # rs-utilities = { path = "../rs-utilities" } serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" diff --git a/src/client.rs b/src/client.rs index d9f04c7..6b5e0a7 100644 --- a/src/client.rs +++ b/src/client.rs @@ -10,7 +10,10 @@ use log::{debug, error, info, warn}; use quinn::{congestion, TransportConfig}; use quinn::{RecvStream, SendStream}; use quinn_proto::{IdleTimeout, VarInt}; -use rs_utilities::{dns, log_and_bail}; +use rs_utilities::{ + dns::{self, DNSQueryOrdering, DNSResolverConfig, DNSResolverLookupIpStrategy}, + log_and_bail, +}; use rustls::{client::ServerCertVerified, Certificate, RootCertStore, ServerName}; use rustls_platform_verifier::{self, Verifier}; use serde::Serialize; @@ -589,12 +592,18 @@ impl Client { dot_server: &str, name_servers: Vec, ) -> Result { + let dns_config = DNSResolverConfig { + strategy: DNSResolverLookupIpStrategy::Ipv6thenIpv4, + num_conccurent_reqs: 3, + ordering: DNSQueryOrdering::QueryStatistics, + }; + let resolver = if !dot_server.is_empty() { - dns::resolver(dot_server, vec![]) + dns::resolver2(dot_server, vec![], dns_config) } else if !name_servers.is_empty() { - dns::resolver("", name_servers) + dns::resolver2("", name_servers, dns_config) } else { - rs_utilities::dns::resolver("", vec![]) + dns::resolver2("", vec![], dns_config) }; let ip = resolver.await.lookup_first(domain).await?;