Skip to content

Commit

Permalink
make clippy happy, ResolverOpts initlalize with Default::default()
Browse files Browse the repository at this point in the history
  • Loading branch information
zonyitoo committed Sep 26, 2021
1 parent 94ba553 commit 3c63ecc
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions crates/shadowsocks/src/dns_resolver/trust_dns_resolver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,12 @@ pub async fn create_resolver(dns: Option<ResolverConfig>, _ipv6_first: bool) ->
// Customized dns resolution
match dns {
Some(conf) => {
let mut resolver_opts = ResolverOpts::default();

// Use Ipv4AndIpv6 strategy. Because Ipv4ThenIpv6 or Ipv6ThenIpv4 will return if the first query returned.
// Since we want to use Happy Eyeballs to connnect to both IPv4 and IPv6 addresses, we need both A and AAAA records.
resolver_opts.ip_strategy = LookupIpStrategy::Ipv4AndIpv6;
let resolver_opts = ResolverOpts {
// Use Ipv4AndIpv6 strategy. Because Ipv4ThenIpv6 or Ipv6ThenIpv4 will return if the first query returned.
// Since we want to use Happy Eyeballs to connnect to both IPv4 and IPv6 addresses, we need both A and AAAA records.
ip_strategy: LookupIpStrategy::Ipv4AndIpv6,
..ResolverOpts::default()
};

trace!(
"initializing DNS resolver with config {:?} opts {:?}",
Expand Down

0 comments on commit 3c63ecc

Please sign in to comment.