From 09c28e0355c2d5be5328e76fe2e0e81d64291269 Mon Sep 17 00:00:00 2001 From: Dreamacro <8615343+Dreamacro@users.noreply.github.com> Date: Mon, 28 Dec 2020 22:24:58 +0800 Subject: [PATCH] Fix: fallback bind fn should not bind global unicast --- component/dialer/bind.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/component/dialer/bind.go b/component/dialer/bind.go index cb24a8b6..55e5f163 100644 --- a/component/dialer/bind.go +++ b/component/dialer/bind.go @@ -52,6 +52,10 @@ func lookupUDPAddr(ip net.IP, addrs []net.Addr) (*net.UDPAddr, error) { } func fallbackBindToDialer(dialer *net.Dialer, network string, ip net.IP, name string) error { + if !ip.IsGlobalUnicast() { + return nil + } + iface, err := net.InterfaceByName(name) if err != nil { return err