From 81be2675b24e8a7ecbe71c19fa5fb1db56c486f8 Mon Sep 17 00:00:00 2001 From: Quentin McGaw Date: Thu, 4 Jun 2026 19:16:25 +0200 Subject: [PATCH] Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- internal/socks5/udp_router.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/internal/socks5/udp_router.go b/internal/socks5/udp_router.go index f8e739d7..e4ffef4a 100644 --- a/internal/socks5/udp_router.go +++ b/internal/socks5/udp_router.go @@ -336,11 +336,14 @@ func (r *udpRouter) writeClientPacketToDestination(ctx context.Context, return fmt.Errorf("splitting destination host and port: %w", err) } - if _, err := netip.ParseAddr(destination); err != nil { // domain name + if _, err := netip.ParseAddr(host); err != nil { // domain name addrs, err := net.DefaultResolver.LookupHost(ctx, host) if err != nil { return fmt.Errorf("resolving destination host: %w", err) } + if len(addrs) == 0 { + return fmt.Errorf("resolving destination host: no addresses found for %q", host) + } destination = net.JoinHostPort(addrs[0], portStr) }