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