func ipv4MulticastInterface(fd int) (*net.Interface, error) { mreqn, err := syscall.GetsockoptIPMreqn(fd, syscall.IPPROTO_IP, syscall.IP_MULTICAST_IF) if err != nil { return nil, os.NewSyscallError("getsockopt", err) } if int(mreqn.Ifindex) == 0 { return nil, nil } return net.InterfaceByIndex(int(mreqn.Ifindex)) }
func ipv4MulticastInterface(fd int) (*net.Interface, error) { mreqn, err := syscall.GetsockoptIPMreqn(fd, ianaProtocolIP, sysSockoptMulticastInterface) if err != nil { return nil, os.NewSyscallError("getsockopt", err) } if mreqn.Ifindex == 0 { return nil, nil } return net.InterfaceByIndex(int(mreqn.Ifindex)) }
func ipv4MulticastInterface(fd *netFD) (*Interface, error) { fd.incref() defer fd.decref() mreq, err := syscall.GetsockoptIPMreqn(fd.sysfd, syscall.IPPROTO_IP, syscall.IP_MULTICAST_IF) if err != nil { return nil, os.NewSyscallError("getsockopt", err) } if int(mreq.Ifindex) == 0 { return nil, nil } return InterfaceByIndex(int(mreq.Ifindex)) }