From 843e1c0f27b908a3fec2982a46fe3ad4d7faa027 Mon Sep 17 00:00:00 2001 From: gVisor bot Date: Mon, 29 Aug 2022 13:04:48 +0800 Subject: [PATCH] fix: resolve ip of udp proxy error --- adapter/outbound/util.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/adapter/outbound/util.go b/adapter/outbound/util.go index 0b859630..d5219131 100644 --- a/adapter/outbound/util.go +++ b/adapter/outbound/util.go @@ -104,7 +104,7 @@ func resolveUDPAddrWithPrefer(network, address string, prefer C.DNSPrefer) (*net ip = fallback } default: - // C.IPv4Prefer, C.DualStack and other + // C.IPv4Prefer, C.DualStack and other var ips []netip.Addr ips, err = resolver.ResolveAllIPProxyServerHost(host) var fallback netip.Addr @@ -119,7 +119,10 @@ func resolveUDPAddrWithPrefer(network, address string, prefer C.DNSPrefer) (*net } } } - ip = fallback + + if !ip.IsValid() && fallback.IsValid() { + ip = fallback + } } }