mirror of
https://gogs.blitter.com/RLabs/xs
synced 2024-08-14 10:26:42 +00:00
f5be3578a8
2/3 Added vendor/ dir to lock down dependent pkg versions. The author of git.schwanenlied.me/yawning/{chacha20,newhope,kyber}.git has copied their repos to gitlab.com/yawning/ but some imports of chacha20 from newhope still inconsistently refer to git.schwanenlied.me/, breaking build. Licenses for chacha20 also changed from CC0 to AGPL, which may or may not be an issue. Until the two aforementioned issues are resolved, locking to last-good versions is probably the best way forward for now. To build with vendored deps, use make VENDOR=1 clean all 3/3 Moved body of CI push script into bacillus/
67 lines
2.1 KiB
Go
67 lines
2.1 KiB
Go
// Copyright 2014 The Go Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style
|
|
// license that can be found in the LICENSE file.
|
|
|
|
package ipv4
|
|
|
|
import (
|
|
"golang.org/x/net/internal/iana"
|
|
"golang.org/x/net/internal/socket"
|
|
)
|
|
|
|
const (
|
|
// See ws2tcpip.h.
|
|
sysIP_OPTIONS = 0x1
|
|
sysIP_HDRINCL = 0x2
|
|
sysIP_TOS = 0x3
|
|
sysIP_TTL = 0x4
|
|
sysIP_MULTICAST_IF = 0x9
|
|
sysIP_MULTICAST_TTL = 0xa
|
|
sysIP_MULTICAST_LOOP = 0xb
|
|
sysIP_ADD_MEMBERSHIP = 0xc
|
|
sysIP_DROP_MEMBERSHIP = 0xd
|
|
sysIP_DONTFRAGMENT = 0xe
|
|
sysIP_ADD_SOURCE_MEMBERSHIP = 0xf
|
|
sysIP_DROP_SOURCE_MEMBERSHIP = 0x10
|
|
sysIP_PKTINFO = 0x13
|
|
|
|
sizeofInetPktinfo = 0x8
|
|
sizeofIPMreq = 0x8
|
|
sizeofIPMreqSource = 0xc
|
|
)
|
|
|
|
type inetPktinfo struct {
|
|
Addr [4]byte
|
|
Ifindex int32
|
|
}
|
|
|
|
type ipMreq struct {
|
|
Multiaddr [4]byte
|
|
Interface [4]byte
|
|
}
|
|
|
|
type ipMreqSource struct {
|
|
Multiaddr [4]byte
|
|
Sourceaddr [4]byte
|
|
Interface [4]byte
|
|
}
|
|
|
|
// See http://msdn.microsoft.com/en-us/library/windows/desktop/ms738586(v=vs.85).aspx
|
|
var (
|
|
ctlOpts = [ctlMax]ctlOpt{}
|
|
|
|
sockOpts = map[int]*sockOpt{
|
|
ssoTOS: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_TOS, Len: 4}},
|
|
ssoTTL: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_TTL, Len: 4}},
|
|
ssoMulticastTTL: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_MULTICAST_TTL, Len: 4}},
|
|
ssoMulticastInterface: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_MULTICAST_IF, Len: 4}},
|
|
ssoMulticastLoopback: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_MULTICAST_LOOP, Len: 4}},
|
|
ssoHeaderPrepend: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_HDRINCL, Len: 4}},
|
|
ssoJoinGroup: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_ADD_MEMBERSHIP, Len: sizeofIPMreq}, typ: ssoTypeIPMreq},
|
|
ssoLeaveGroup: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_DROP_MEMBERSHIP, Len: sizeofIPMreq}, typ: ssoTypeIPMreq},
|
|
}
|
|
)
|
|
|
|
func (pi *inetPktinfo) setIfindex(i int) {
|
|
pi.Ifindex = int32(i)
|
|
}
|