File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed
Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -25,9 +25,12 @@ func WithInterface(iface *net.Interface) SocketOption {
2525 err = bindSocketToInterface6 (windows .Handle (fd ), uint32 (index ))
2626 }
2727 if network == "udp6" {
28- // The underlying IP net maybe IPv4 even if the `network` param is `udp6`,
29- // so we should bind socket to interface4 at the same time.
30- _ = bindSocketToInterface4 (windows .Handle (fd ), uint32 (index ))
28+ host , _ , _ := net .SplitHostPort (address )
29+ if ip := net .ParseIP (host ); ip == nil || ip .IsUnspecified () {
30+ // The underlying IP net maybe IPv4 even if the `network` param is
31+ // `udp6`, so we should bind socket to interface4 at the same time.
32+ _ = bindSocketToInterface4 (windows .Handle (fd ), uint32 (index ))
33+ }
3134 }
3235 return
3336 })
You can’t perform that action at this time.
0 commit comments