...
1
2
3
4
5 package ipv4
6
7 import (
8 "golang.org/x/net/internal/iana"
9 "golang.org/x/net/internal/socket"
10
11 "golang.org/x/sys/windows"
12 )
13
14 const (
15 sizeofIPMreq = 0x8
16 sizeofIPMreqSource = 0xc
17 )
18
19 type ipMreq struct {
20 Multiaddr [4]byte
21 Interface [4]byte
22 }
23
24 type ipMreqSource struct {
25 Multiaddr [4]byte
26 Sourceaddr [4]byte
27 Interface [4]byte
28 }
29
30
31 var (
32 ctlOpts = [ctlMax]ctlOpt{}
33
34 sockOpts = map[int]*sockOpt{
35 ssoTOS: {Option: socket.Option{Level: iana.ProtocolIP, Name: windows.IP_TOS, Len: 4}},
36 ssoTTL: {Option: socket.Option{Level: iana.ProtocolIP, Name: windows.IP_TTL, Len: 4}},
37 ssoMulticastTTL: {Option: socket.Option{Level: iana.ProtocolIP, Name: windows.IP_MULTICAST_TTL, Len: 4}},
38 ssoMulticastInterface: {Option: socket.Option{Level: iana.ProtocolIP, Name: windows.IP_MULTICAST_IF, Len: 4}},
39 ssoMulticastLoopback: {Option: socket.Option{Level: iana.ProtocolIP, Name: windows.IP_MULTICAST_LOOP, Len: 4}},
40 ssoHeaderPrepend: {Option: socket.Option{Level: iana.ProtocolIP, Name: windows.IP_HDRINCL, Len: 4}},
41 ssoJoinGroup: {Option: socket.Option{Level: iana.ProtocolIP, Name: windows.IP_ADD_MEMBERSHIP, Len: sizeofIPMreq}, typ: ssoTypeIPMreq},
42 ssoLeaveGroup: {Option: socket.Option{Level: iana.ProtocolIP, Name: windows.IP_DROP_MEMBERSHIP, Len: sizeofIPMreq}, typ: ssoTypeIPMreq},
43 }
44 )
45
View as plain text