예제 #1
0
func setIPv4MulticastInterface(fd int, ifi *net.Interface) error {
	var mreqn syscall.IPMreqn
	if ifi != nil {
		mreqn.Ifindex = int32(ifi.Index)
	}
	return os.NewSyscallError("setsockopt", syscall.SetsockoptIPMreqn(fd, ianaProtocolIP, sysSockoptMulticastInterface, &mreqn))
}
예제 #2
0
func leaveIPv4Group(fd int, ifi *net.Interface, grp net.IP) error {
	mreqn := syscall.IPMreqn{Multiaddr: [4]byte{grp[0], grp[1], grp[2], grp[3]}}
	if ifi != nil {
		mreqn.Ifindex = int32(ifi.Index)
	}
	return os.NewSyscallError("setsockopt", syscall.SetsockoptIPMreqn(fd, ianaProtocolIP, sysSockoptLeaveGroup, &mreqn))
}
예제 #3
0
func setIPv4MulticastInterface(fd int, ifi *net.Interface) error {
	mreqn := syscall.IPMreqn{}
	if ifi != nil {
		mreqn.Ifindex = int32(ifi.Index)
	}
	return os.NewSyscallError("setsockopt", syscall.SetsockoptIPMreqn(fd, ianaProtocolIP, syscall.IP_MULTICAST_IF, &mreqn))
}