From d9453589ac75fed383a9962e1dd75c49fb3b206c Mon Sep 17 00:00:00 2001 From: Hs_Yeah Date: Wed, 9 Oct 2024 22:40:01 +0800 Subject: [PATCH] Fix panic when DNS resolution for STUN server returns only IPv6 addrs. (#402) --- easytier/src/common/stun.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/easytier/src/common/stun.rs b/easytier/src/common/stun.rs index fedf404..86b957e 100644 --- a/easytier/src/common/stun.rs +++ b/easytier/src/common/stun.rs @@ -56,6 +56,8 @@ impl HostResolverIter { self.ips = ips .filter(|x| x.is_ipv4()) .choose_multiple(&mut rand::thread_rng(), self.max_ip_per_domain as usize); + + if self.ips.is_empty() {return self.next().await;} } Err(e) => { tracing::warn!(?host, ?e, "lookup host for stun failed");