示例#1
0
func ipv4MulticastInterface(fd int) (*net.Interface, error) {
	a, err := syscall.GetsockoptInet4Addr(fd, syscall.IPPROTO_IP, syscall.IP_MULTICAST_IF)
	if err != nil {
		return nil, os.NewSyscallError("getsockopt", err)
	}
	return netIP4ToInterface(net.IPv4(a[0], a[1], a[2], a[3]))
}
示例#2
0
func ipv4MulticastInterface(fd int) (*net.Interface, error) {
	v, err := syscall.GetsockoptInet4Addr(fd, ianaProtocolIP, syscall.IP_MULTICAST_IF)
	if err != nil {
		return nil, os.NewSyscallError("getsockopt", err)
	}
	return netIP4ToInterface(net.IPv4(v[0], v[1], v[2], v[3]))
}
示例#3
0
func ipv4MulticastInterface(fd *netFD) (*Interface, error) {
	fd.incref()
	defer fd.decref()
	a, err := syscall.GetsockoptInet4Addr(fd.sysfd, syscall.IPPROTO_IP, syscall.IP_MULTICAST_IF)
	if err != nil {
		return nil, os.NewSyscallError("getsockopt", err)
	}
	return ipv4AddrToInterface(IPv4(a[0], a[1], a[2], a[3]))
}