func joinIPv6Group(fd syscall.Handle, ifi *net.Interface, grp net.IP) error {
	mreq := syscall.IPv6Mreq{}
	copy(mreq.Multiaddr[:], grp)
	if ifi != nil {
		mreq.Interface = uint32(ifi.Index)
	}
	return os.NewSyscallError("setsockopt", syscall.Setsockopt(fd, int32(ianaProtocolIPv6), int32(syscall.IPV6_JOIN_GROUP), (*byte)(unsafe.Pointer(&mreq)), int32(unsafe.Sizeof(mreq))))
}
Ejemplo n.º 2
0
func joinIPv6Group(fd int, ifi *net.Interface, grp net.IP) error {
	mreq := syscall.IPv6Mreq{}
	copy(mreq.Multiaddr[:], grp)
	if ifi != nil {
		mreq.Interface = uint32(ifi.Index)
	}
	return os.NewSyscallError("setsockopt", syscall.SetsockoptIPv6Mreq(fd, ianaProtocolIPv6, syscall.IPV6_JOIN_GROUP, &mreq))
}