Source file
src/net/sockoptip_windows.go
1
2
3
4
5 package net
6
7 import (
8 "os"
9 "runtime"
10 "syscall"
11 "unsafe"
12 )
13
14 func setIPv4MulticastInterface(fd *netFD, ifi *Interface) error {
15 ip, err := interfaceToIPv4Addr(ifi)
16 if err != nil {
17 return os.NewSyscallError("setsockopt", err)
18 }
19 var a [4]byte
20 copy(a[:], ip.To4())
21 err = fd.pfd.Setsockopt(syscall.IPPROTO_IP, syscall.IP_MULTICAST_IF, (*byte)(unsafe.Pointer(&a[0])), 4)
22 runtime.KeepAlive(fd)
23 return wrapSyscallError("setsockopt", err)
24 }
25
26 func setIPv4MulticastLoopback(fd *netFD, v bool) error {
27 err := fd.pfd.SetsockoptInt(syscall.IPPROTO_IP, syscall.IP_MULTICAST_LOOP, boolint(v))
28 runtime.KeepAlive(fd)
29 return wrapSyscallError("setsockopt", err)
30 }
31
View as plain text