From def0092b20a2aeef46cf8e9973efca8345da98b9 Mon Sep 17 00:00:00 2001 From: Astro Date: Thu, 17 Jan 2019 01:38:24 +0100 Subject: [PATCH] happy_eyeballs: set LookupIpStrategy::Ipv4AndIpv6 this is what happy_eyeballs are all about --- src/happy_eyeballs.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/happy_eyeballs.rs b/src/happy_eyeballs.rs index a47ddd98..fc4e0280 100644 --- a/src/happy_eyeballs.rs +++ b/src/happy_eyeballs.rs @@ -9,6 +9,7 @@ use std::net::SocketAddr; use tokio::net::tcp::ConnectFuture; use tokio::net::TcpStream; use trust_dns_resolver::{AsyncResolver, Name, IntoName, Background, BackgroundLookup}; +use trust_dns_resolver::config::LookupIpStrategy; use trust_dns_resolver::lookup::SrvLookupFuture; use trust_dns_resolver::lookup_ip::LookupIpFuture; @@ -30,7 +31,9 @@ pub struct Connecter { } fn resolver() -> Result { - let (resolver, resolver_background) = AsyncResolver::from_system_conf()?; + let (config, mut opts) = trust_dns_resolver::system_conf::read_system_conf()?; + opts.ip_strategy = LookupIpStrategy::Ipv4AndIpv6; + let (resolver, resolver_background) = AsyncResolver::new(config, opts); tokio::runtime::current_thread::spawn(resolver_background); Ok(resolver) }