diff --git a/transport/internet/sockopt_windows.go b/transport/internet/sockopt_windows.go index fa45011d..e1c1d25e 100644 --- a/transport/internet/sockopt_windows.go +++ b/transport/internet/sockopt_windows.go @@ -13,6 +13,8 @@ const ( TCP_FASTOPEN = 15 IP_UNICAST_IF = 31 IPV6_UNICAST_IF = 31 + IP_MULTICAST_IF = 9 + IPV6_MULTICAST_IF = 9 ) func setTFO(fd syscall.Handle, tfo int) error { @@ -41,10 +43,16 @@ func applyOutboundSocketOptions(network string, address string, fd uintptr, conf if err := syscall.SetsockoptInt(syscall.Handle(fd), syscall.IPPROTO_IP, IP_UNICAST_IF, int(idx)); err != nil { return errors.New("failed to set IP_UNICAST_IF").Base(err) } + if err := syscall.SetsockoptInt(syscall.Handle(fd), syscall.IPPROTO_IP, IP_MULTICAST_IF, int(idx)); err != nil { + return errors.New("failed to set IP_MULTICAST_IF").Base(err) + } } else { if err := syscall.SetsockoptInt(syscall.Handle(fd), syscall.IPPROTO_IPV6, IPV6_UNICAST_IF, inf.Index); err != nil { return errors.New("failed to set IPV6_UNICAST_IF").Base(err) } + if err := syscall.SetsockoptInt(syscall.Handle(fd), syscall.IPPROTO_IPV6, IPV6_MULTICAST_IF, inf.Index); err != nil { + return errors.New("failed to set IPV6_MULTICAST_IF").Base(err) + } } }