Fix: fallback bind fn should not bind global unicast

This commit is contained in:
Dreamacro 2020-12-28 22:24:58 +08:00
parent 3600077f3b
commit 09c28e0355

View File

@ -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