vendor folder bump.
This commit is contained in:
190
vendor/golang.org/x/net/ipv4/batch.go
generated
vendored
Normal file
190
vendor/golang.org/x/net/ipv4/batch.go
generated
vendored
Normal file
@ -0,0 +1,190 @@
|
||||
// Copyright 2017 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.
|
||||
|
||||
// +build go1.9
|
||||
|
||||
package ipv4
|
||||
|
||||
import (
|
||||
"net"
|
||||
"runtime"
|
||||
|
||||
"golang.org/x/net/internal/socket"
|
||||
)
|
||||
|
||||
// BUG(mikio): On Windows, the ReadBatch and WriteBatch methods of
|
||||
// PacketConn are not implemented.
|
||||
|
||||
// BUG(mikio): On Windows, the ReadBatch and WriteBatch methods of
|
||||
// RawConn are not implemented.
|
||||
|
||||
// A Message represents an IO message.
|
||||
//
|
||||
// type Message struct {
|
||||
// Buffers [][]byte
|
||||
// OOB []byte
|
||||
// Addr net.Addr
|
||||
// N int
|
||||
// NN int
|
||||
// Flags int
|
||||
// }
|
||||
//
|
||||
// The Buffers fields represents a list of contiguous buffers, which
|
||||
// can be used for vectored IO, for example, putting a header and a
|
||||
// payload in each slice.
|
||||
// When writing, the Buffers field must contain at least one byte to
|
||||
// write.
|
||||
// When reading, the Buffers field will always contain a byte to read.
|
||||
//
|
||||
// The OOB field contains protocol-specific control or miscellaneous
|
||||
// ancillary data known as out-of-band data.
|
||||
// It can be nil when not required.
|
||||
//
|
||||
// The Addr field specifies a destination address when writing.
|
||||
// It can be nil when the underlying protocol of the endpoint uses
|
||||
// connection-oriented communication.
|
||||
// After a successful read, it may contain the source address on the
|
||||
// received packet.
|
||||
//
|
||||
// The N field indicates the number of bytes read or written from/to
|
||||
// Buffers.
|
||||
//
|
||||
// The NN field indicates the number of bytes read or written from/to
|
||||
// OOB.
|
||||
//
|
||||
// The Flags field contains protocol-specific information on the
|
||||
// received message.
|
||||
type Message = socket.Message
|
||||
|
||||
// ReadBatch reads a batch of messages.
|
||||
//
|
||||
// The provided flags is a set of platform-dependent flags, such as
|
||||
// syscall.MSG_PEEK.
|
||||
//
|
||||
// On a successful read it returns the number of messages received, up
|
||||
// to len(ms).
|
||||
//
|
||||
// On Linux, a batch read will be optimized.
|
||||
// On other platforms, this method will read only a single message.
|
||||
//
|
||||
// Unlike the ReadFrom method, it doesn't strip the IPv4 header
|
||||
// followed by option headers from the received IPv4 datagram when the
|
||||
// underlying transport is net.IPConn. Each Buffers field of Message
|
||||
// must be large enough to accommodate an IPv4 header and option
|
||||
// headers.
|
||||
func (c *payloadHandler) ReadBatch(ms []Message, flags int) (int, error) {
|
||||
if !c.ok() {
|
||||
return 0, errInvalidConn
|
||||
}
|
||||
switch runtime.GOOS {
|
||||
case "linux":
|
||||
n, err := c.RecvMsgs([]socket.Message(ms), flags)
|
||||
if err != nil {
|
||||
err = &net.OpError{Op: "read", Net: c.PacketConn.LocalAddr().Network(), Source: c.PacketConn.LocalAddr(), Err: err}
|
||||
}
|
||||
return n, err
|
||||
default:
|
||||
n := 1
|
||||
err := c.RecvMsg(&ms[0], flags)
|
||||
if err != nil {
|
||||
n = 0
|
||||
err = &net.OpError{Op: "read", Net: c.PacketConn.LocalAddr().Network(), Source: c.PacketConn.LocalAddr(), Err: err}
|
||||
}
|
||||
return n, err
|
||||
}
|
||||
}
|
||||
|
||||
// WriteBatch writes a batch of messages.
|
||||
//
|
||||
// The provided flags is a set of platform-dependent flags, such as
|
||||
// syscall.MSG_DONTROUTE.
|
||||
//
|
||||
// It returns the number of messages written on a successful write.
|
||||
//
|
||||
// On Linux, a batch write will be optimized.
|
||||
// On other platforms, this method will write only a single message.
|
||||
func (c *payloadHandler) WriteBatch(ms []Message, flags int) (int, error) {
|
||||
if !c.ok() {
|
||||
return 0, errInvalidConn
|
||||
}
|
||||
switch runtime.GOOS {
|
||||
case "linux":
|
||||
n, err := c.SendMsgs([]socket.Message(ms), flags)
|
||||
if err != nil {
|
||||
err = &net.OpError{Op: "write", Net: c.PacketConn.LocalAddr().Network(), Source: c.PacketConn.LocalAddr(), Err: err}
|
||||
}
|
||||
return n, err
|
||||
default:
|
||||
n := 1
|
||||
err := c.SendMsg(&ms[0], flags)
|
||||
if err != nil {
|
||||
n = 0
|
||||
err = &net.OpError{Op: "write", Net: c.PacketConn.LocalAddr().Network(), Source: c.PacketConn.LocalAddr(), Err: err}
|
||||
}
|
||||
return n, err
|
||||
}
|
||||
}
|
||||
|
||||
// ReadBatch reads a batch of messages.
|
||||
//
|
||||
// The provided flags is a set of platform-dependent flags, such as
|
||||
// syscall.MSG_PEEK.
|
||||
//
|
||||
// On a successful read it returns the number of messages received, up
|
||||
// to len(ms).
|
||||
//
|
||||
// On Linux, a batch read will be optimized.
|
||||
// On other platforms, this method will read only a single message.
|
||||
func (c *packetHandler) ReadBatch(ms []Message, flags int) (int, error) {
|
||||
if !c.ok() {
|
||||
return 0, errInvalidConn
|
||||
}
|
||||
switch runtime.GOOS {
|
||||
case "linux":
|
||||
n, err := c.RecvMsgs([]socket.Message(ms), flags)
|
||||
if err != nil {
|
||||
err = &net.OpError{Op: "read", Net: c.IPConn.LocalAddr().Network(), Source: c.IPConn.LocalAddr(), Err: err}
|
||||
}
|
||||
return n, err
|
||||
default:
|
||||
n := 1
|
||||
err := c.RecvMsg(&ms[0], flags)
|
||||
if err != nil {
|
||||
n = 0
|
||||
err = &net.OpError{Op: "read", Net: c.IPConn.LocalAddr().Network(), Source: c.IPConn.LocalAddr(), Err: err}
|
||||
}
|
||||
return n, err
|
||||
}
|
||||
}
|
||||
|
||||
// WriteBatch writes a batch of messages.
|
||||
//
|
||||
// The provided flags is a set of platform-dependent flags, such as
|
||||
// syscall.MSG_DONTROUTE.
|
||||
//
|
||||
// It returns the number of messages written on a successful write.
|
||||
//
|
||||
// On Linux, a batch write will be optimized.
|
||||
// On other platforms, this method will write only a single message.
|
||||
func (c *packetHandler) WriteBatch(ms []Message, flags int) (int, error) {
|
||||
if !c.ok() {
|
||||
return 0, errInvalidConn
|
||||
}
|
||||
switch runtime.GOOS {
|
||||
case "linux":
|
||||
n, err := c.SendMsgs([]socket.Message(ms), flags)
|
||||
if err != nil {
|
||||
err = &net.OpError{Op: "write", Net: c.IPConn.LocalAddr().Network(), Source: c.IPConn.LocalAddr(), Err: err}
|
||||
}
|
||||
return n, err
|
||||
default:
|
||||
n := 1
|
||||
err := c.SendMsg(&ms[0], flags)
|
||||
if err != nil {
|
||||
n = 0
|
||||
err = &net.OpError{Op: "write", Net: c.IPConn.LocalAddr().Network(), Source: c.IPConn.LocalAddr(), Err: err}
|
||||
}
|
||||
return n, err
|
||||
}
|
||||
}
|
27
vendor/golang.org/x/net/ipv4/bpfopt_linux.go
generated
vendored
27
vendor/golang.org/x/net/ipv4/bpfopt_linux.go
generated
vendored
@ -1,27 +0,0 @@
|
||||
// Copyright 2016 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 (
|
||||
"os"
|
||||
"unsafe"
|
||||
|
||||
"golang.org/x/net/bpf"
|
||||
)
|
||||
|
||||
// SetBPF attaches a BPF program to the connection.
|
||||
//
|
||||
// Only supported on Linux.
|
||||
func (c *dgramOpt) SetBPF(filter []bpf.RawInstruction) error {
|
||||
fd, err := c.sysfd()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
prog := sysSockFProg{
|
||||
Len: uint16(len(filter)),
|
||||
Filter: (*sysSockFilter)(unsafe.Pointer(&filter[0])),
|
||||
}
|
||||
return os.NewSyscallError("setsockopt", setsockopt(fd, sysSOL_SOCKET, sysSO_ATTACH_FILTER, unsafe.Pointer(&prog), uint32(unsafe.Sizeof(prog))))
|
||||
}
|
16
vendor/golang.org/x/net/ipv4/bpfopt_stub.go
generated
vendored
16
vendor/golang.org/x/net/ipv4/bpfopt_stub.go
generated
vendored
@ -1,16 +0,0 @@
|
||||
// Copyright 2016 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.
|
||||
|
||||
// +build !linux
|
||||
|
||||
package ipv4
|
||||
|
||||
import "golang.org/x/net/bpf"
|
||||
|
||||
// SetBPF attaches a BPF program to the connection.
|
||||
//
|
||||
// Only supported on Linux.
|
||||
func (c *dgramOpt) SetBPF(filter []bpf.RawInstruction) error {
|
||||
return errOpNoSupport
|
||||
}
|
76
vendor/golang.org/x/net/ipv4/control.go
generated
vendored
76
vendor/golang.org/x/net/ipv4/control.go
generated
vendored
@ -1,4 +1,4 @@
|
||||
// Copyright 2012 The Go Authors. All rights reserved.
|
||||
// Copyright 2012 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.
|
||||
|
||||
@ -8,6 +8,9 @@ import (
|
||||
"fmt"
|
||||
"net"
|
||||
"sync"
|
||||
|
||||
"golang.org/x/net/internal/iana"
|
||||
"golang.org/x/net/internal/socket"
|
||||
)
|
||||
|
||||
type rawOpt struct {
|
||||
@ -51,6 +54,77 @@ func (cm *ControlMessage) String() string {
|
||||
return fmt.Sprintf("ttl=%d src=%v dst=%v ifindex=%d", cm.TTL, cm.Src, cm.Dst, cm.IfIndex)
|
||||
}
|
||||
|
||||
// Marshal returns the binary encoding of cm.
|
||||
func (cm *ControlMessage) Marshal() []byte {
|
||||
if cm == nil {
|
||||
return nil
|
||||
}
|
||||
var m socket.ControlMessage
|
||||
if ctlOpts[ctlPacketInfo].name > 0 && (cm.Src.To4() != nil || cm.IfIndex > 0) {
|
||||
m = socket.NewControlMessage([]int{ctlOpts[ctlPacketInfo].length})
|
||||
}
|
||||
if len(m) > 0 {
|
||||
ctlOpts[ctlPacketInfo].marshal(m, cm)
|
||||
}
|
||||
return m
|
||||
}
|
||||
|
||||
// Parse parses b as a control message and stores the result in cm.
|
||||
func (cm *ControlMessage) Parse(b []byte) error {
|
||||
ms, err := socket.ControlMessage(b).Parse()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
for _, m := range ms {
|
||||
lvl, typ, l, err := m.ParseHeader()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if lvl != iana.ProtocolIP {
|
||||
continue
|
||||
}
|
||||
switch {
|
||||
case typ == ctlOpts[ctlTTL].name && l >= ctlOpts[ctlTTL].length:
|
||||
ctlOpts[ctlTTL].parse(cm, m.Data(l))
|
||||
case typ == ctlOpts[ctlDst].name && l >= ctlOpts[ctlDst].length:
|
||||
ctlOpts[ctlDst].parse(cm, m.Data(l))
|
||||
case typ == ctlOpts[ctlInterface].name && l >= ctlOpts[ctlInterface].length:
|
||||
ctlOpts[ctlInterface].parse(cm, m.Data(l))
|
||||
case typ == ctlOpts[ctlPacketInfo].name && l >= ctlOpts[ctlPacketInfo].length:
|
||||
ctlOpts[ctlPacketInfo].parse(cm, m.Data(l))
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// NewControlMessage returns a new control message.
|
||||
//
|
||||
// The returned message is large enough for options specified by cf.
|
||||
func NewControlMessage(cf ControlFlags) []byte {
|
||||
opt := rawOpt{cflags: cf}
|
||||
var l int
|
||||
if opt.isset(FlagTTL) && ctlOpts[ctlTTL].name > 0 {
|
||||
l += socket.ControlMessageSpace(ctlOpts[ctlTTL].length)
|
||||
}
|
||||
if ctlOpts[ctlPacketInfo].name > 0 {
|
||||
if opt.isset(FlagSrc | FlagDst | FlagInterface) {
|
||||
l += socket.ControlMessageSpace(ctlOpts[ctlPacketInfo].length)
|
||||
}
|
||||
} else {
|
||||
if opt.isset(FlagDst) && ctlOpts[ctlDst].name > 0 {
|
||||
l += socket.ControlMessageSpace(ctlOpts[ctlDst].length)
|
||||
}
|
||||
if opt.isset(FlagInterface) && ctlOpts[ctlInterface].name > 0 {
|
||||
l += socket.ControlMessageSpace(ctlOpts[ctlInterface].length)
|
||||
}
|
||||
}
|
||||
var b []byte
|
||||
if l > 0 {
|
||||
b = make([]byte, l)
|
||||
}
|
||||
return b
|
||||
}
|
||||
|
||||
// Ancillary data socket options
|
||||
const (
|
||||
ctlTTL = iota // header field
|
||||
|
24
vendor/golang.org/x/net/ipv4/control_bsd.go
generated
vendored
24
vendor/golang.org/x/net/ipv4/control_bsd.go
generated
vendored
@ -1,4 +1,4 @@
|
||||
// Copyright 2012 The Go Authors. All rights reserved.
|
||||
// Copyright 2012 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.
|
||||
|
||||
@ -12,26 +12,26 @@ import (
|
||||
"unsafe"
|
||||
|
||||
"golang.org/x/net/internal/iana"
|
||||
"golang.org/x/net/internal/socket"
|
||||
)
|
||||
|
||||
func marshalDst(b []byte, cm *ControlMessage) []byte {
|
||||
m := (*syscall.Cmsghdr)(unsafe.Pointer(&b[0]))
|
||||
m.Level = iana.ProtocolIP
|
||||
m.Type = sysIP_RECVDSTADDR
|
||||
m.SetLen(syscall.CmsgLen(net.IPv4len))
|
||||
return b[syscall.CmsgSpace(net.IPv4len):]
|
||||
m := socket.ControlMessage(b)
|
||||
m.MarshalHeader(iana.ProtocolIP, sysIP_RECVDSTADDR, net.IPv4len)
|
||||
return m.Next(net.IPv4len)
|
||||
}
|
||||
|
||||
func parseDst(cm *ControlMessage, b []byte) {
|
||||
cm.Dst = b[:net.IPv4len]
|
||||
if len(cm.Dst) < net.IPv4len {
|
||||
cm.Dst = make(net.IP, net.IPv4len)
|
||||
}
|
||||
copy(cm.Dst, b[:net.IPv4len])
|
||||
}
|
||||
|
||||
func marshalInterface(b []byte, cm *ControlMessage) []byte {
|
||||
m := (*syscall.Cmsghdr)(unsafe.Pointer(&b[0]))
|
||||
m.Level = iana.ProtocolIP
|
||||
m.Type = sysIP_RECVIF
|
||||
m.SetLen(syscall.CmsgLen(syscall.SizeofSockaddrDatalink))
|
||||
return b[syscall.CmsgSpace(syscall.SizeofSockaddrDatalink):]
|
||||
m := socket.ControlMessage(b)
|
||||
m.MarshalHeader(iana.ProtocolIP, sysIP_RECVIF, syscall.SizeofSockaddrDatalink)
|
||||
return m.Next(syscall.SizeofSockaddrDatalink)
|
||||
}
|
||||
|
||||
func parseInterface(cm *ControlMessage, b []byte) {
|
||||
|
22
vendor/golang.org/x/net/ipv4/control_pktinfo.go
generated
vendored
22
vendor/golang.org/x/net/ipv4/control_pktinfo.go
generated
vendored
@ -2,24 +2,23 @@
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// +build darwin linux
|
||||
// +build darwin linux solaris
|
||||
|
||||
package ipv4
|
||||
|
||||
import (
|
||||
"syscall"
|
||||
"net"
|
||||
"unsafe"
|
||||
|
||||
"golang.org/x/net/internal/iana"
|
||||
"golang.org/x/net/internal/socket"
|
||||
)
|
||||
|
||||
func marshalPacketInfo(b []byte, cm *ControlMessage) []byte {
|
||||
m := (*syscall.Cmsghdr)(unsafe.Pointer(&b[0]))
|
||||
m.Level = iana.ProtocolIP
|
||||
m.Type = sysIP_PKTINFO
|
||||
m.SetLen(syscall.CmsgLen(sysSizeofInetPktinfo))
|
||||
m := socket.ControlMessage(b)
|
||||
m.MarshalHeader(iana.ProtocolIP, sysIP_PKTINFO, sizeofInetPktinfo)
|
||||
if cm != nil {
|
||||
pi := (*sysInetPktinfo)(unsafe.Pointer(&b[syscall.CmsgLen(0)]))
|
||||
pi := (*inetPktinfo)(unsafe.Pointer(&m.Data(sizeofInetPktinfo)[0]))
|
||||
if ip := cm.Src.To4(); ip != nil {
|
||||
copy(pi.Spec_dst[:], ip)
|
||||
}
|
||||
@ -27,11 +26,14 @@ func marshalPacketInfo(b []byte, cm *ControlMessage) []byte {
|
||||
pi.setIfindex(cm.IfIndex)
|
||||
}
|
||||
}
|
||||
return b[syscall.CmsgSpace(sysSizeofInetPktinfo):]
|
||||
return m.Next(sizeofInetPktinfo)
|
||||
}
|
||||
|
||||
func parsePacketInfo(cm *ControlMessage, b []byte) {
|
||||
pi := (*sysInetPktinfo)(unsafe.Pointer(&b[0]))
|
||||
pi := (*inetPktinfo)(unsafe.Pointer(&b[0]))
|
||||
cm.IfIndex = int(pi.Ifindex)
|
||||
cm.Dst = pi.Addr[:]
|
||||
if len(cm.Dst) < net.IPv4len {
|
||||
cm.Dst = make(net.IP, net.IPv4len)
|
||||
}
|
||||
copy(cm.Dst, pi.Addr[:])
|
||||
}
|
||||
|
20
vendor/golang.org/x/net/ipv4/control_stub.go
generated
vendored
20
vendor/golang.org/x/net/ipv4/control_stub.go
generated
vendored
@ -1,23 +1,13 @@
|
||||
// Copyright 2012 The Go Authors. All rights reserved.
|
||||
// Copyright 2012 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.
|
||||
|
||||
// +build nacl plan9 solaris
|
||||
// +build !darwin,!dragonfly,!freebsd,!linux,!netbsd,!openbsd,!solaris,!windows
|
||||
|
||||
package ipv4
|
||||
|
||||
func setControlMessage(fd int, opt *rawOpt, cf ControlFlags, on bool) error {
|
||||
import "golang.org/x/net/internal/socket"
|
||||
|
||||
func setControlMessage(c *socket.Conn, opt *rawOpt, cf ControlFlags, on bool) error {
|
||||
return errOpNoSupport
|
||||
}
|
||||
|
||||
func newControlMessage(opt *rawOpt) []byte {
|
||||
return nil
|
||||
}
|
||||
|
||||
func parseControlMessage(b []byte) (*ControlMessage, error) {
|
||||
return nil, errOpNoSupport
|
||||
}
|
||||
|
||||
func marshalControlMessage(cm *ControlMessage) []byte {
|
||||
return nil
|
||||
}
|
||||
|
121
vendor/golang.org/x/net/ipv4/control_unix.go
generated
vendored
121
vendor/golang.org/x/net/ipv4/control_unix.go
generated
vendored
@ -1,24 +1,23 @@
|
||||
// Copyright 2012 The Go Authors. All rights reserved.
|
||||
// Copyright 2012 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.
|
||||
|
||||
// +build darwin dragonfly freebsd linux netbsd openbsd
|
||||
// +build darwin dragonfly freebsd linux netbsd openbsd solaris
|
||||
|
||||
package ipv4
|
||||
|
||||
import (
|
||||
"os"
|
||||
"syscall"
|
||||
"unsafe"
|
||||
|
||||
"golang.org/x/net/internal/iana"
|
||||
"golang.org/x/net/internal/socket"
|
||||
)
|
||||
|
||||
func setControlMessage(fd int, opt *rawOpt, cf ControlFlags, on bool) error {
|
||||
func setControlMessage(c *socket.Conn, opt *rawOpt, cf ControlFlags, on bool) error {
|
||||
opt.Lock()
|
||||
defer opt.Unlock()
|
||||
if cf&FlagTTL != 0 && sockOpts[ssoReceiveTTL].name > 0 {
|
||||
if err := setInt(fd, &sockOpts[ssoReceiveTTL], boolint(on)); err != nil {
|
||||
if so, ok := sockOpts[ssoReceiveTTL]; ok && cf&FlagTTL != 0 {
|
||||
if err := so.SetInt(c, boolint(on)); err != nil {
|
||||
return err
|
||||
}
|
||||
if on {
|
||||
@ -27,9 +26,9 @@ func setControlMessage(fd int, opt *rawOpt, cf ControlFlags, on bool) error {
|
||||
opt.clear(FlagTTL)
|
||||
}
|
||||
}
|
||||
if sockOpts[ssoPacketInfo].name > 0 {
|
||||
if so, ok := sockOpts[ssoPacketInfo]; ok {
|
||||
if cf&(FlagSrc|FlagDst|FlagInterface) != 0 {
|
||||
if err := setInt(fd, &sockOpts[ssoPacketInfo], boolint(on)); err != nil {
|
||||
if err := so.SetInt(c, boolint(on)); err != nil {
|
||||
return err
|
||||
}
|
||||
if on {
|
||||
@ -39,8 +38,8 @@ func setControlMessage(fd int, opt *rawOpt, cf ControlFlags, on bool) error {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if cf&FlagDst != 0 && sockOpts[ssoReceiveDst].name > 0 {
|
||||
if err := setInt(fd, &sockOpts[ssoReceiveDst], boolint(on)); err != nil {
|
||||
if so, ok := sockOpts[ssoReceiveDst]; ok && cf&FlagDst != 0 {
|
||||
if err := so.SetInt(c, boolint(on)); err != nil {
|
||||
return err
|
||||
}
|
||||
if on {
|
||||
@ -49,8 +48,8 @@ func setControlMessage(fd int, opt *rawOpt, cf ControlFlags, on bool) error {
|
||||
opt.clear(FlagDst)
|
||||
}
|
||||
}
|
||||
if cf&FlagInterface != 0 && sockOpts[ssoReceiveInterface].name > 0 {
|
||||
if err := setInt(fd, &sockOpts[ssoReceiveInterface], boolint(on)); err != nil {
|
||||
if so, ok := sockOpts[ssoReceiveInterface]; ok && cf&FlagInterface != 0 {
|
||||
if err := so.SetInt(c, boolint(on)); err != nil {
|
||||
return err
|
||||
}
|
||||
if on {
|
||||
@ -63,100 +62,10 @@ func setControlMessage(fd int, opt *rawOpt, cf ControlFlags, on bool) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func newControlMessage(opt *rawOpt) (oob []byte) {
|
||||
opt.RLock()
|
||||
var l int
|
||||
if opt.isset(FlagTTL) && ctlOpts[ctlTTL].name > 0 {
|
||||
l += syscall.CmsgSpace(ctlOpts[ctlTTL].length)
|
||||
}
|
||||
if ctlOpts[ctlPacketInfo].name > 0 {
|
||||
if opt.isset(FlagSrc | FlagDst | FlagInterface) {
|
||||
l += syscall.CmsgSpace(ctlOpts[ctlPacketInfo].length)
|
||||
}
|
||||
} else {
|
||||
if opt.isset(FlagDst) && ctlOpts[ctlDst].name > 0 {
|
||||
l += syscall.CmsgSpace(ctlOpts[ctlDst].length)
|
||||
}
|
||||
if opt.isset(FlagInterface) && ctlOpts[ctlInterface].name > 0 {
|
||||
l += syscall.CmsgSpace(ctlOpts[ctlInterface].length)
|
||||
}
|
||||
}
|
||||
if l > 0 {
|
||||
oob = make([]byte, l)
|
||||
b := oob
|
||||
if opt.isset(FlagTTL) && ctlOpts[ctlTTL].name > 0 {
|
||||
b = ctlOpts[ctlTTL].marshal(b, nil)
|
||||
}
|
||||
if ctlOpts[ctlPacketInfo].name > 0 {
|
||||
if opt.isset(FlagSrc | FlagDst | FlagInterface) {
|
||||
b = ctlOpts[ctlPacketInfo].marshal(b, nil)
|
||||
}
|
||||
} else {
|
||||
if opt.isset(FlagDst) && ctlOpts[ctlDst].name > 0 {
|
||||
b = ctlOpts[ctlDst].marshal(b, nil)
|
||||
}
|
||||
if opt.isset(FlagInterface) && ctlOpts[ctlInterface].name > 0 {
|
||||
b = ctlOpts[ctlInterface].marshal(b, nil)
|
||||
}
|
||||
}
|
||||
}
|
||||
opt.RUnlock()
|
||||
return
|
||||
}
|
||||
|
||||
func parseControlMessage(b []byte) (*ControlMessage, error) {
|
||||
if len(b) == 0 {
|
||||
return nil, nil
|
||||
}
|
||||
cmsgs, err := syscall.ParseSocketControlMessage(b)
|
||||
if err != nil {
|
||||
return nil, os.NewSyscallError("parse socket control message", err)
|
||||
}
|
||||
cm := &ControlMessage{}
|
||||
for _, m := range cmsgs {
|
||||
if m.Header.Level != iana.ProtocolIP {
|
||||
continue
|
||||
}
|
||||
switch int(m.Header.Type) {
|
||||
case ctlOpts[ctlTTL].name:
|
||||
ctlOpts[ctlTTL].parse(cm, m.Data[:])
|
||||
case ctlOpts[ctlDst].name:
|
||||
ctlOpts[ctlDst].parse(cm, m.Data[:])
|
||||
case ctlOpts[ctlInterface].name:
|
||||
ctlOpts[ctlInterface].parse(cm, m.Data[:])
|
||||
case ctlOpts[ctlPacketInfo].name:
|
||||
ctlOpts[ctlPacketInfo].parse(cm, m.Data[:])
|
||||
}
|
||||
}
|
||||
return cm, nil
|
||||
}
|
||||
|
||||
func marshalControlMessage(cm *ControlMessage) (oob []byte) {
|
||||
if cm == nil {
|
||||
return nil
|
||||
}
|
||||
var l int
|
||||
pktinfo := false
|
||||
if ctlOpts[ctlPacketInfo].name > 0 && (cm.Src.To4() != nil || cm.IfIndex > 0) {
|
||||
pktinfo = true
|
||||
l += syscall.CmsgSpace(ctlOpts[ctlPacketInfo].length)
|
||||
}
|
||||
if l > 0 {
|
||||
oob = make([]byte, l)
|
||||
b := oob
|
||||
if pktinfo {
|
||||
b = ctlOpts[ctlPacketInfo].marshal(b, cm)
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func marshalTTL(b []byte, cm *ControlMessage) []byte {
|
||||
m := (*syscall.Cmsghdr)(unsafe.Pointer(&b[0]))
|
||||
m.Level = iana.ProtocolIP
|
||||
m.Type = sysIP_RECVTTL
|
||||
m.SetLen(syscall.CmsgLen(1))
|
||||
return b[syscall.CmsgSpace(1):]
|
||||
m := socket.ControlMessage(b)
|
||||
m.MarshalHeader(iana.ProtocolIP, sysIP_RECVTTL, 1)
|
||||
return m.Next(1)
|
||||
}
|
||||
|
||||
func parseTTL(cm *ControlMessage, b []byte) {
|
||||
|
25
vendor/golang.org/x/net/ipv4/control_windows.go
generated
vendored
25
vendor/golang.org/x/net/ipv4/control_windows.go
generated
vendored
@ -1,27 +1,16 @@
|
||||
// Copyright 2012 The Go Authors. All rights reserved.
|
||||
// Copyright 2012 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 "syscall"
|
||||
import (
|
||||
"syscall"
|
||||
|
||||
func setControlMessage(fd syscall.Handle, opt *rawOpt, cf ControlFlags, on bool) error {
|
||||
"golang.org/x/net/internal/socket"
|
||||
)
|
||||
|
||||
func setControlMessage(c *socket.Conn, opt *rawOpt, cf ControlFlags, on bool) error {
|
||||
// TODO(mikio): implement this
|
||||
return syscall.EWINDOWS
|
||||
}
|
||||
|
||||
func newControlMessage(opt *rawOpt) []byte {
|
||||
// TODO(mikio): implement this
|
||||
return nil
|
||||
}
|
||||
|
||||
func parseControlMessage(b []byte) (*ControlMessage, error) {
|
||||
// TODO(mikio): implement this
|
||||
return nil, syscall.EWINDOWS
|
||||
}
|
||||
|
||||
func marshalControlMessage(cm *ControlMessage) []byte {
|
||||
// TODO(mikio): implement this
|
||||
return nil
|
||||
}
|
||||
|
32
vendor/golang.org/x/net/ipv4/defs_darwin.go
generated
vendored
32
vendor/golang.org/x/net/ipv4/defs_darwin.go
generated
vendored
@ -49,29 +49,29 @@ const (
|
||||
sysMCAST_BLOCK_SOURCE = C.MCAST_BLOCK_SOURCE
|
||||
sysMCAST_UNBLOCK_SOURCE = C.MCAST_UNBLOCK_SOURCE
|
||||
|
||||
sysSizeofSockaddrStorage = C.sizeof_struct_sockaddr_storage
|
||||
sysSizeofSockaddrInet = C.sizeof_struct_sockaddr_in
|
||||
sysSizeofInetPktinfo = C.sizeof_struct_in_pktinfo
|
||||
sizeofSockaddrStorage = C.sizeof_struct_sockaddr_storage
|
||||
sizeofSockaddrInet = C.sizeof_struct_sockaddr_in
|
||||
sizeofInetPktinfo = C.sizeof_struct_in_pktinfo
|
||||
|
||||
sysSizeofIPMreq = C.sizeof_struct_ip_mreq
|
||||
sysSizeofIPMreqn = C.sizeof_struct_ip_mreqn
|
||||
sysSizeofIPMreqSource = C.sizeof_struct_ip_mreq_source
|
||||
sysSizeofGroupReq = C.sizeof_struct_group_req
|
||||
sysSizeofGroupSourceReq = C.sizeof_struct_group_source_req
|
||||
sizeofIPMreq = C.sizeof_struct_ip_mreq
|
||||
sizeofIPMreqn = C.sizeof_struct_ip_mreqn
|
||||
sizeofIPMreqSource = C.sizeof_struct_ip_mreq_source
|
||||
sizeofGroupReq = C.sizeof_struct_group_req
|
||||
sizeofGroupSourceReq = C.sizeof_struct_group_source_req
|
||||
)
|
||||
|
||||
type sysSockaddrStorage C.struct_sockaddr_storage
|
||||
type sockaddrStorage C.struct_sockaddr_storage
|
||||
|
||||
type sysSockaddrInet C.struct_sockaddr_in
|
||||
type sockaddrInet C.struct_sockaddr_in
|
||||
|
||||
type sysInetPktinfo C.struct_in_pktinfo
|
||||
type inetPktinfo C.struct_in_pktinfo
|
||||
|
||||
type sysIPMreq C.struct_ip_mreq
|
||||
type ipMreq C.struct_ip_mreq
|
||||
|
||||
type sysIPMreqn C.struct_ip_mreqn
|
||||
type ipMreqn C.struct_ip_mreqn
|
||||
|
||||
type sysIPMreqSource C.struct_ip_mreq_source
|
||||
type ipMreqSource C.struct_ip_mreq_source
|
||||
|
||||
type sysGroupReq C.struct_group_req
|
||||
type groupReq C.struct_group_req
|
||||
|
||||
type sysGroupSourceReq C.struct_group_source_req
|
||||
type groupSourceReq C.struct_group_source_req
|
||||
|
4
vendor/golang.org/x/net/ipv4/defs_dragonfly.go
generated
vendored
4
vendor/golang.org/x/net/ipv4/defs_dragonfly.go
generated
vendored
@ -32,7 +32,7 @@ const (
|
||||
sysIP_ADD_MEMBERSHIP = C.IP_ADD_MEMBERSHIP
|
||||
sysIP_DROP_MEMBERSHIP = C.IP_DROP_MEMBERSHIP
|
||||
|
||||
sysSizeofIPMreq = C.sizeof_struct_ip_mreq
|
||||
sizeofIPMreq = C.sizeof_struct_ip_mreq
|
||||
)
|
||||
|
||||
type sysIPMreq C.struct_ip_mreq
|
||||
type ipMreq C.struct_ip_mreq
|
||||
|
28
vendor/golang.org/x/net/ipv4/defs_freebsd.go
generated
vendored
28
vendor/golang.org/x/net/ipv4/defs_freebsd.go
generated
vendored
@ -50,26 +50,26 @@ const (
|
||||
sysMCAST_BLOCK_SOURCE = C.MCAST_BLOCK_SOURCE
|
||||
sysMCAST_UNBLOCK_SOURCE = C.MCAST_UNBLOCK_SOURCE
|
||||
|
||||
sysSizeofSockaddrStorage = C.sizeof_struct_sockaddr_storage
|
||||
sysSizeofSockaddrInet = C.sizeof_struct_sockaddr_in
|
||||
sizeofSockaddrStorage = C.sizeof_struct_sockaddr_storage
|
||||
sizeofSockaddrInet = C.sizeof_struct_sockaddr_in
|
||||
|
||||
sysSizeofIPMreq = C.sizeof_struct_ip_mreq
|
||||
sysSizeofIPMreqn = C.sizeof_struct_ip_mreqn
|
||||
sysSizeofIPMreqSource = C.sizeof_struct_ip_mreq_source
|
||||
sysSizeofGroupReq = C.sizeof_struct_group_req
|
||||
sysSizeofGroupSourceReq = C.sizeof_struct_group_source_req
|
||||
sizeofIPMreq = C.sizeof_struct_ip_mreq
|
||||
sizeofIPMreqn = C.sizeof_struct_ip_mreqn
|
||||
sizeofIPMreqSource = C.sizeof_struct_ip_mreq_source
|
||||
sizeofGroupReq = C.sizeof_struct_group_req
|
||||
sizeofGroupSourceReq = C.sizeof_struct_group_source_req
|
||||
)
|
||||
|
||||
type sysSockaddrStorage C.struct_sockaddr_storage
|
||||
type sockaddrStorage C.struct_sockaddr_storage
|
||||
|
||||
type sysSockaddrInet C.struct_sockaddr_in
|
||||
type sockaddrInet C.struct_sockaddr_in
|
||||
|
||||
type sysIPMreq C.struct_ip_mreq
|
||||
type ipMreq C.struct_ip_mreq
|
||||
|
||||
type sysIPMreqn C.struct_ip_mreqn
|
||||
type ipMreqn C.struct_ip_mreqn
|
||||
|
||||
type sysIPMreqSource C.struct_ip_mreq_source
|
||||
type ipMreqSource C.struct_ip_mreq_source
|
||||
|
||||
type sysGroupReq C.struct_group_req
|
||||
type groupReq C.struct_group_req
|
||||
|
||||
type sysGroupSourceReq C.struct_group_source_req
|
||||
type groupSourceReq C.struct_group_source_req
|
||||
|
46
vendor/golang.org/x/net/ipv4/defs_linux.go
generated
vendored
46
vendor/golang.org/x/net/ipv4/defs_linux.go
generated
vendored
@ -81,40 +81,42 @@ const (
|
||||
sysSOL_SOCKET = C.SOL_SOCKET
|
||||
sysSO_ATTACH_FILTER = C.SO_ATTACH_FILTER
|
||||
|
||||
sysSizeofKernelSockaddrStorage = C.sizeof_struct___kernel_sockaddr_storage
|
||||
sysSizeofSockaddrInet = C.sizeof_struct_sockaddr_in
|
||||
sysSizeofInetPktinfo = C.sizeof_struct_in_pktinfo
|
||||
sysSizeofSockExtendedErr = C.sizeof_struct_sock_extended_err
|
||||
sizeofKernelSockaddrStorage = C.sizeof_struct___kernel_sockaddr_storage
|
||||
sizeofSockaddrInet = C.sizeof_struct_sockaddr_in
|
||||
sizeofInetPktinfo = C.sizeof_struct_in_pktinfo
|
||||
sizeofSockExtendedErr = C.sizeof_struct_sock_extended_err
|
||||
|
||||
sysSizeofIPMreq = C.sizeof_struct_ip_mreq
|
||||
sysSizeofIPMreqn = C.sizeof_struct_ip_mreqn
|
||||
sysSizeofIPMreqSource = C.sizeof_struct_ip_mreq_source
|
||||
sysSizeofGroupReq = C.sizeof_struct_group_req
|
||||
sysSizeofGroupSourceReq = C.sizeof_struct_group_source_req
|
||||
sizeofIPMreq = C.sizeof_struct_ip_mreq
|
||||
sizeofIPMreqn = C.sizeof_struct_ip_mreqn
|
||||
sizeofIPMreqSource = C.sizeof_struct_ip_mreq_source
|
||||
sizeofGroupReq = C.sizeof_struct_group_req
|
||||
sizeofGroupSourceReq = C.sizeof_struct_group_source_req
|
||||
|
||||
sysSizeofICMPFilter = C.sizeof_struct_icmp_filter
|
||||
sizeofICMPFilter = C.sizeof_struct_icmp_filter
|
||||
|
||||
sizeofSockFprog = C.sizeof_struct_sock_fprog
|
||||
)
|
||||
|
||||
type sysKernelSockaddrStorage C.struct___kernel_sockaddr_storage
|
||||
type kernelSockaddrStorage C.struct___kernel_sockaddr_storage
|
||||
|
||||
type sysSockaddrInet C.struct_sockaddr_in
|
||||
type sockaddrInet C.struct_sockaddr_in
|
||||
|
||||
type sysInetPktinfo C.struct_in_pktinfo
|
||||
type inetPktinfo C.struct_in_pktinfo
|
||||
|
||||
type sysSockExtendedErr C.struct_sock_extended_err
|
||||
type sockExtendedErr C.struct_sock_extended_err
|
||||
|
||||
type sysIPMreq C.struct_ip_mreq
|
||||
type ipMreq C.struct_ip_mreq
|
||||
|
||||
type sysIPMreqn C.struct_ip_mreqn
|
||||
type ipMreqn C.struct_ip_mreqn
|
||||
|
||||
type sysIPMreqSource C.struct_ip_mreq_source
|
||||
type ipMreqSource C.struct_ip_mreq_source
|
||||
|
||||
type sysGroupReq C.struct_group_req
|
||||
type groupReq C.struct_group_req
|
||||
|
||||
type sysGroupSourceReq C.struct_group_source_req
|
||||
type groupSourceReq C.struct_group_source_req
|
||||
|
||||
type sysICMPFilter C.struct_icmp_filter
|
||||
type icmpFilter C.struct_icmp_filter
|
||||
|
||||
type sysSockFProg C.struct_sock_fprog
|
||||
type sockFProg C.struct_sock_fprog
|
||||
|
||||
type sysSockFilter C.struct_sock_filter
|
||||
type sockFilter C.struct_sock_filter
|
||||
|
4
vendor/golang.org/x/net/ipv4/defs_netbsd.go
generated
vendored
4
vendor/golang.org/x/net/ipv4/defs_netbsd.go
generated
vendored
@ -31,7 +31,7 @@ const (
|
||||
sysIP_ADD_MEMBERSHIP = C.IP_ADD_MEMBERSHIP
|
||||
sysIP_DROP_MEMBERSHIP = C.IP_DROP_MEMBERSHIP
|
||||
|
||||
sysSizeofIPMreq = C.sizeof_struct_ip_mreq
|
||||
sizeofIPMreq = C.sizeof_struct_ip_mreq
|
||||
)
|
||||
|
||||
type sysIPMreq C.struct_ip_mreq
|
||||
type ipMreq C.struct_ip_mreq
|
||||
|
4
vendor/golang.org/x/net/ipv4/defs_openbsd.go
generated
vendored
4
vendor/golang.org/x/net/ipv4/defs_openbsd.go
generated
vendored
@ -31,7 +31,7 @@ const (
|
||||
sysIP_ADD_MEMBERSHIP = C.IP_ADD_MEMBERSHIP
|
||||
sysIP_DROP_MEMBERSHIP = C.IP_DROP_MEMBERSHIP
|
||||
|
||||
sysSizeofIPMreq = C.sizeof_struct_ip_mreq
|
||||
sizeofIPMreq = C.sizeof_struct_ip_mreq
|
||||
)
|
||||
|
||||
type sysIPMreq C.struct_ip_mreq
|
||||
type ipMreq C.struct_ip_mreq
|
||||
|
77
vendor/golang.org/x/net/ipv4/defs_solaris.go
generated
vendored
77
vendor/golang.org/x/net/ipv4/defs_solaris.go
generated
vendored
@ -9,30 +9,24 @@
|
||||
package ipv4
|
||||
|
||||
/*
|
||||
#include <sys/socket.h>
|
||||
|
||||
#include <netinet/in.h>
|
||||
*/
|
||||
import "C"
|
||||
|
||||
const (
|
||||
sysIP_OPTIONS = C.IP_OPTIONS
|
||||
sysIP_HDRINCL = C.IP_HDRINCL
|
||||
sysIP_TOS = C.IP_TOS
|
||||
sysIP_TTL = C.IP_TTL
|
||||
sysIP_RECVOPTS = C.IP_RECVOPTS
|
||||
sysIP_RECVRETOPTS = C.IP_RECVRETOPTS
|
||||
sysIP_RECVDSTADDR = C.IP_RECVDSTADDR
|
||||
sysIP_RETOPTS = C.IP_RETOPTS
|
||||
sysIP_RECVIF = C.IP_RECVIF
|
||||
sysIP_RECVSLLA = C.IP_RECVSLLA
|
||||
sysIP_RECVTTL = C.IP_RECVTTL
|
||||
sysIP_NEXTHOP = C.IP_NEXTHOP
|
||||
sysIP_PKTINFO = C.IP_PKTINFO
|
||||
sysIP_RECVPKTINFO = C.IP_RECVPKTINFO
|
||||
sysIP_DONTFRAG = C.IP_DONTFRAG
|
||||
sysIP_BOUND_IF = C.IP_BOUND_IF
|
||||
sysIP_UNSPEC_SRC = C.IP_UNSPEC_SRC
|
||||
sysIP_BROADCAST_TTL = C.IP_BROADCAST_TTL
|
||||
sysIP_DHCPINIT_IF = C.IP_DHCPINIT_IF
|
||||
sysIP_OPTIONS = C.IP_OPTIONS
|
||||
sysIP_HDRINCL = C.IP_HDRINCL
|
||||
sysIP_TOS = C.IP_TOS
|
||||
sysIP_TTL = C.IP_TTL
|
||||
sysIP_RECVOPTS = C.IP_RECVOPTS
|
||||
sysIP_RECVRETOPTS = C.IP_RECVRETOPTS
|
||||
sysIP_RECVDSTADDR = C.IP_RECVDSTADDR
|
||||
sysIP_RETOPTS = C.IP_RETOPTS
|
||||
sysIP_RECVIF = C.IP_RECVIF
|
||||
sysIP_RECVSLLA = C.IP_RECVSLLA
|
||||
sysIP_RECVTTL = C.IP_RECVTTL
|
||||
|
||||
sysIP_MULTICAST_IF = C.IP_MULTICAST_IF
|
||||
sysIP_MULTICAST_TTL = C.IP_MULTICAST_TTL
|
||||
@ -43,15 +37,48 @@ const (
|
||||
sysIP_UNBLOCK_SOURCE = C.IP_UNBLOCK_SOURCE
|
||||
sysIP_ADD_SOURCE_MEMBERSHIP = C.IP_ADD_SOURCE_MEMBERSHIP
|
||||
sysIP_DROP_SOURCE_MEMBERSHIP = C.IP_DROP_SOURCE_MEMBERSHIP
|
||||
sysIP_NEXTHOP = C.IP_NEXTHOP
|
||||
|
||||
sysSizeofInetPktinfo = C.sizeof_struct_in_pktinfo
|
||||
sysIP_PKTINFO = C.IP_PKTINFO
|
||||
sysIP_RECVPKTINFO = C.IP_RECVPKTINFO
|
||||
sysIP_DONTFRAG = C.IP_DONTFRAG
|
||||
|
||||
sysSizeofIPMreq = C.sizeof_struct_ip_mreq
|
||||
sysSizeofIPMreqSource = C.sizeof_struct_ip_mreq_source
|
||||
sysIP_BOUND_IF = C.IP_BOUND_IF
|
||||
sysIP_UNSPEC_SRC = C.IP_UNSPEC_SRC
|
||||
sysIP_BROADCAST_TTL = C.IP_BROADCAST_TTL
|
||||
sysIP_DHCPINIT_IF = C.IP_DHCPINIT_IF
|
||||
|
||||
sysIP_REUSEADDR = C.IP_REUSEADDR
|
||||
sysIP_DONTROUTE = C.IP_DONTROUTE
|
||||
sysIP_BROADCAST = C.IP_BROADCAST
|
||||
|
||||
sysMCAST_JOIN_GROUP = C.MCAST_JOIN_GROUP
|
||||
sysMCAST_LEAVE_GROUP = C.MCAST_LEAVE_GROUP
|
||||
sysMCAST_BLOCK_SOURCE = C.MCAST_BLOCK_SOURCE
|
||||
sysMCAST_UNBLOCK_SOURCE = C.MCAST_UNBLOCK_SOURCE
|
||||
sysMCAST_JOIN_SOURCE_GROUP = C.MCAST_JOIN_SOURCE_GROUP
|
||||
sysMCAST_LEAVE_SOURCE_GROUP = C.MCAST_LEAVE_SOURCE_GROUP
|
||||
|
||||
sizeofSockaddrStorage = C.sizeof_struct_sockaddr_storage
|
||||
sizeofSockaddrInet = C.sizeof_struct_sockaddr_in
|
||||
sizeofInetPktinfo = C.sizeof_struct_in_pktinfo
|
||||
|
||||
sizeofIPMreq = C.sizeof_struct_ip_mreq
|
||||
sizeofIPMreqSource = C.sizeof_struct_ip_mreq_source
|
||||
sizeofGroupReq = C.sizeof_struct_group_req
|
||||
sizeofGroupSourceReq = C.sizeof_struct_group_source_req
|
||||
)
|
||||
|
||||
type sysInetPktinfo C.struct_in_pktinfo
|
||||
type sockaddrStorage C.struct_sockaddr_storage
|
||||
|
||||
type sysIPMreq C.struct_ip_mreq
|
||||
type sockaddrInet C.struct_sockaddr_in
|
||||
|
||||
type sysIPMreqSource C.struct_ip_mreq_source
|
||||
type inetPktinfo C.struct_in_pktinfo
|
||||
|
||||
type ipMreq C.struct_ip_mreq
|
||||
|
||||
type ipMreqSource C.struct_ip_mreq_source
|
||||
|
||||
type groupReq C.struct_group_req
|
||||
|
||||
type groupSourceReq C.struct_group_source_req
|
||||
|
161
vendor/golang.org/x/net/ipv4/dgramopt_posix.go → vendor/golang.org/x/net/ipv4/dgramopt.go
generated
vendored
161
vendor/golang.org/x/net/ipv4/dgramopt_posix.go → vendor/golang.org/x/net/ipv4/dgramopt.go
generated
vendored
@ -1,79 +1,78 @@
|
||||
// Copyright 2012 The Go Authors. All rights reserved.
|
||||
// Copyright 2012 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.
|
||||
|
||||
// +build darwin dragonfly freebsd linux netbsd openbsd windows
|
||||
|
||||
package ipv4
|
||||
|
||||
import (
|
||||
"net"
|
||||
"syscall"
|
||||
|
||||
"golang.org/x/net/bpf"
|
||||
)
|
||||
|
||||
// MulticastTTL returns the time-to-live field value for outgoing
|
||||
// multicast packets.
|
||||
func (c *dgramOpt) MulticastTTL() (int, error) {
|
||||
if !c.ok() {
|
||||
return 0, syscall.EINVAL
|
||||
return 0, errInvalidConn
|
||||
}
|
||||
fd, err := c.sysfd()
|
||||
if err != nil {
|
||||
return 0, err
|
||||
so, ok := sockOpts[ssoMulticastTTL]
|
||||
if !ok {
|
||||
return 0, errOpNoSupport
|
||||
}
|
||||
return getInt(fd, &sockOpts[ssoMulticastTTL])
|
||||
return so.GetInt(c.Conn)
|
||||
}
|
||||
|
||||
// SetMulticastTTL sets the time-to-live field value for future
|
||||
// outgoing multicast packets.
|
||||
func (c *dgramOpt) SetMulticastTTL(ttl int) error {
|
||||
if !c.ok() {
|
||||
return syscall.EINVAL
|
||||
return errInvalidConn
|
||||
}
|
||||
fd, err := c.sysfd()
|
||||
if err != nil {
|
||||
return err
|
||||
so, ok := sockOpts[ssoMulticastTTL]
|
||||
if !ok {
|
||||
return errOpNoSupport
|
||||
}
|
||||
return setInt(fd, &sockOpts[ssoMulticastTTL], ttl)
|
||||
return so.SetInt(c.Conn, ttl)
|
||||
}
|
||||
|
||||
// MulticastInterface returns the default interface for multicast
|
||||
// packet transmissions.
|
||||
func (c *dgramOpt) MulticastInterface() (*net.Interface, error) {
|
||||
if !c.ok() {
|
||||
return nil, syscall.EINVAL
|
||||
return nil, errInvalidConn
|
||||
}
|
||||
fd, err := c.sysfd()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
so, ok := sockOpts[ssoMulticastInterface]
|
||||
if !ok {
|
||||
return nil, errOpNoSupport
|
||||
}
|
||||
return getInterface(fd, &sockOpts[ssoMulticastInterface])
|
||||
return so.getMulticastInterface(c.Conn)
|
||||
}
|
||||
|
||||
// SetMulticastInterface sets the default interface for future
|
||||
// multicast packet transmissions.
|
||||
func (c *dgramOpt) SetMulticastInterface(ifi *net.Interface) error {
|
||||
if !c.ok() {
|
||||
return syscall.EINVAL
|
||||
return errInvalidConn
|
||||
}
|
||||
fd, err := c.sysfd()
|
||||
if err != nil {
|
||||
return err
|
||||
so, ok := sockOpts[ssoMulticastInterface]
|
||||
if !ok {
|
||||
return errOpNoSupport
|
||||
}
|
||||
return setInterface(fd, &sockOpts[ssoMulticastInterface], ifi)
|
||||
return so.setMulticastInterface(c.Conn, ifi)
|
||||
}
|
||||
|
||||
// MulticastLoopback reports whether transmitted multicast packets
|
||||
// should be copied and send back to the originator.
|
||||
func (c *dgramOpt) MulticastLoopback() (bool, error) {
|
||||
if !c.ok() {
|
||||
return false, syscall.EINVAL
|
||||
return false, errInvalidConn
|
||||
}
|
||||
fd, err := c.sysfd()
|
||||
if err != nil {
|
||||
return false, err
|
||||
so, ok := sockOpts[ssoMulticastLoopback]
|
||||
if !ok {
|
||||
return false, errOpNoSupport
|
||||
}
|
||||
on, err := getInt(fd, &sockOpts[ssoMulticastLoopback])
|
||||
on, err := so.GetInt(c.Conn)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
@ -84,13 +83,13 @@ func (c *dgramOpt) MulticastLoopback() (bool, error) {
|
||||
// should be copied and send back to the originator.
|
||||
func (c *dgramOpt) SetMulticastLoopback(on bool) error {
|
||||
if !c.ok() {
|
||||
return syscall.EINVAL
|
||||
return errInvalidConn
|
||||
}
|
||||
fd, err := c.sysfd()
|
||||
if err != nil {
|
||||
return err
|
||||
so, ok := sockOpts[ssoMulticastLoopback]
|
||||
if !ok {
|
||||
return errOpNoSupport
|
||||
}
|
||||
return setInt(fd, &sockOpts[ssoMulticastLoopback], boolint(on))
|
||||
return so.SetInt(c.Conn, boolint(on))
|
||||
}
|
||||
|
||||
// JoinGroup joins the group address group on the interface ifi.
|
||||
@ -104,17 +103,17 @@ func (c *dgramOpt) SetMulticastLoopback(on bool) error {
|
||||
// configuration.
|
||||
func (c *dgramOpt) JoinGroup(ifi *net.Interface, group net.Addr) error {
|
||||
if !c.ok() {
|
||||
return syscall.EINVAL
|
||||
return errInvalidConn
|
||||
}
|
||||
fd, err := c.sysfd()
|
||||
if err != nil {
|
||||
return err
|
||||
so, ok := sockOpts[ssoJoinGroup]
|
||||
if !ok {
|
||||
return errOpNoSupport
|
||||
}
|
||||
grp := netAddrToIP4(group)
|
||||
if grp == nil {
|
||||
return errMissingAddress
|
||||
}
|
||||
return setGroup(fd, &sockOpts[ssoJoinGroup], ifi, grp)
|
||||
return so.setGroup(c.Conn, ifi, grp)
|
||||
}
|
||||
|
||||
// LeaveGroup leaves the group address group on the interface ifi
|
||||
@ -122,17 +121,17 @@ func (c *dgramOpt) JoinGroup(ifi *net.Interface, group net.Addr) error {
|
||||
// source-specific group.
|
||||
func (c *dgramOpt) LeaveGroup(ifi *net.Interface, group net.Addr) error {
|
||||
if !c.ok() {
|
||||
return syscall.EINVAL
|
||||
return errInvalidConn
|
||||
}
|
||||
fd, err := c.sysfd()
|
||||
if err != nil {
|
||||
return err
|
||||
so, ok := sockOpts[ssoLeaveGroup]
|
||||
if !ok {
|
||||
return errOpNoSupport
|
||||
}
|
||||
grp := netAddrToIP4(group)
|
||||
if grp == nil {
|
||||
return errMissingAddress
|
||||
}
|
||||
return setGroup(fd, &sockOpts[ssoLeaveGroup], ifi, grp)
|
||||
return so.setGroup(c.Conn, ifi, grp)
|
||||
}
|
||||
|
||||
// JoinSourceSpecificGroup joins the source-specific group comprising
|
||||
@ -143,11 +142,11 @@ func (c *dgramOpt) LeaveGroup(ifi *net.Interface, group net.Addr) error {
|
||||
// routing configuration.
|
||||
func (c *dgramOpt) JoinSourceSpecificGroup(ifi *net.Interface, group, source net.Addr) error {
|
||||
if !c.ok() {
|
||||
return syscall.EINVAL
|
||||
return errInvalidConn
|
||||
}
|
||||
fd, err := c.sysfd()
|
||||
if err != nil {
|
||||
return err
|
||||
so, ok := sockOpts[ssoJoinSourceGroup]
|
||||
if !ok {
|
||||
return errOpNoSupport
|
||||
}
|
||||
grp := netAddrToIP4(group)
|
||||
if grp == nil {
|
||||
@ -157,18 +156,18 @@ func (c *dgramOpt) JoinSourceSpecificGroup(ifi *net.Interface, group, source net
|
||||
if src == nil {
|
||||
return errMissingAddress
|
||||
}
|
||||
return setSourceGroup(fd, &sockOpts[ssoJoinSourceGroup], ifi, grp, src)
|
||||
return so.setSourceGroup(c.Conn, ifi, grp, src)
|
||||
}
|
||||
|
||||
// LeaveSourceSpecificGroup leaves the source-specific group on the
|
||||
// interface ifi.
|
||||
func (c *dgramOpt) LeaveSourceSpecificGroup(ifi *net.Interface, group, source net.Addr) error {
|
||||
if !c.ok() {
|
||||
return syscall.EINVAL
|
||||
return errInvalidConn
|
||||
}
|
||||
fd, err := c.sysfd()
|
||||
if err != nil {
|
||||
return err
|
||||
so, ok := sockOpts[ssoLeaveSourceGroup]
|
||||
if !ok {
|
||||
return errOpNoSupport
|
||||
}
|
||||
grp := netAddrToIP4(group)
|
||||
if grp == nil {
|
||||
@ -178,7 +177,7 @@ func (c *dgramOpt) LeaveSourceSpecificGroup(ifi *net.Interface, group, source ne
|
||||
if src == nil {
|
||||
return errMissingAddress
|
||||
}
|
||||
return setSourceGroup(fd, &sockOpts[ssoLeaveSourceGroup], ifi, grp, src)
|
||||
return so.setSourceGroup(c.Conn, ifi, grp, src)
|
||||
}
|
||||
|
||||
// ExcludeSourceSpecificGroup excludes the source-specific group from
|
||||
@ -186,11 +185,11 @@ func (c *dgramOpt) LeaveSourceSpecificGroup(ifi *net.Interface, group, source ne
|
||||
// ifi.
|
||||
func (c *dgramOpt) ExcludeSourceSpecificGroup(ifi *net.Interface, group, source net.Addr) error {
|
||||
if !c.ok() {
|
||||
return syscall.EINVAL
|
||||
return errInvalidConn
|
||||
}
|
||||
fd, err := c.sysfd()
|
||||
if err != nil {
|
||||
return err
|
||||
so, ok := sockOpts[ssoBlockSourceGroup]
|
||||
if !ok {
|
||||
return errOpNoSupport
|
||||
}
|
||||
grp := netAddrToIP4(group)
|
||||
if grp == nil {
|
||||
@ -200,18 +199,18 @@ func (c *dgramOpt) ExcludeSourceSpecificGroup(ifi *net.Interface, group, source
|
||||
if src == nil {
|
||||
return errMissingAddress
|
||||
}
|
||||
return setSourceGroup(fd, &sockOpts[ssoBlockSourceGroup], ifi, grp, src)
|
||||
return so.setSourceGroup(c.Conn, ifi, grp, src)
|
||||
}
|
||||
|
||||
// IncludeSourceSpecificGroup includes the excluded source-specific
|
||||
// group by ExcludeSourceSpecificGroup again on the interface ifi.
|
||||
func (c *dgramOpt) IncludeSourceSpecificGroup(ifi *net.Interface, group, source net.Addr) error {
|
||||
if !c.ok() {
|
||||
return syscall.EINVAL
|
||||
return errInvalidConn
|
||||
}
|
||||
fd, err := c.sysfd()
|
||||
if err != nil {
|
||||
return err
|
||||
so, ok := sockOpts[ssoUnblockSourceGroup]
|
||||
if !ok {
|
||||
return errOpNoSupport
|
||||
}
|
||||
grp := netAddrToIP4(group)
|
||||
if grp == nil {
|
||||
@ -221,31 +220,45 @@ func (c *dgramOpt) IncludeSourceSpecificGroup(ifi *net.Interface, group, source
|
||||
if src == nil {
|
||||
return errMissingAddress
|
||||
}
|
||||
return setSourceGroup(fd, &sockOpts[ssoUnblockSourceGroup], ifi, grp, src)
|
||||
return so.setSourceGroup(c.Conn, ifi, grp, src)
|
||||
}
|
||||
|
||||
// ICMPFilter returns an ICMP filter.
|
||||
// Currently only Linux supports this.
|
||||
func (c *dgramOpt) ICMPFilter() (*ICMPFilter, error) {
|
||||
if !c.ok() {
|
||||
return nil, syscall.EINVAL
|
||||
return nil, errInvalidConn
|
||||
}
|
||||
fd, err := c.sysfd()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
so, ok := sockOpts[ssoICMPFilter]
|
||||
if !ok {
|
||||
return nil, errOpNoSupport
|
||||
}
|
||||
return getICMPFilter(fd, &sockOpts[ssoICMPFilter])
|
||||
return so.getICMPFilter(c.Conn)
|
||||
}
|
||||
|
||||
// SetICMPFilter deploys the ICMP filter.
|
||||
// Currently only Linux supports this.
|
||||
func (c *dgramOpt) SetICMPFilter(f *ICMPFilter) error {
|
||||
if !c.ok() {
|
||||
return syscall.EINVAL
|
||||
return errInvalidConn
|
||||
}
|
||||
fd, err := c.sysfd()
|
||||
if err != nil {
|
||||
return err
|
||||
so, ok := sockOpts[ssoICMPFilter]
|
||||
if !ok {
|
||||
return errOpNoSupport
|
||||
}
|
||||
return setICMPFilter(fd, &sockOpts[ssoICMPFilter], f)
|
||||
return so.setICMPFilter(c.Conn, f)
|
||||
}
|
||||
|
||||
// SetBPF attaches a BPF program to the connection.
|
||||
//
|
||||
// Only supported on Linux.
|
||||
func (c *dgramOpt) SetBPF(filter []bpf.RawInstruction) error {
|
||||
if !c.ok() {
|
||||
return errInvalidConn
|
||||
}
|
||||
so, ok := sockOpts[ssoAttachFilter]
|
||||
if !ok {
|
||||
return errOpNoSupport
|
||||
}
|
||||
return so.setBPF(c.Conn, filter)
|
||||
}
|
106
vendor/golang.org/x/net/ipv4/dgramopt_stub.go
generated
vendored
106
vendor/golang.org/x/net/ipv4/dgramopt_stub.go
generated
vendored
@ -1,106 +0,0 @@
|
||||
// Copyright 2012 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.
|
||||
|
||||
// +build nacl plan9 solaris
|
||||
|
||||
package ipv4
|
||||
|
||||
import "net"
|
||||
|
||||
// MulticastTTL returns the time-to-live field value for outgoing
|
||||
// multicast packets.
|
||||
func (c *dgramOpt) MulticastTTL() (int, error) {
|
||||
return 0, errOpNoSupport
|
||||
}
|
||||
|
||||
// SetMulticastTTL sets the time-to-live field value for future
|
||||
// outgoing multicast packets.
|
||||
func (c *dgramOpt) SetMulticastTTL(ttl int) error {
|
||||
return errOpNoSupport
|
||||
}
|
||||
|
||||
// MulticastInterface returns the default interface for multicast
|
||||
// packet transmissions.
|
||||
func (c *dgramOpt) MulticastInterface() (*net.Interface, error) {
|
||||
return nil, errOpNoSupport
|
||||
}
|
||||
|
||||
// SetMulticastInterface sets the default interface for future
|
||||
// multicast packet transmissions.
|
||||
func (c *dgramOpt) SetMulticastInterface(ifi *net.Interface) error {
|
||||
return errOpNoSupport
|
||||
}
|
||||
|
||||
// MulticastLoopback reports whether transmitted multicast packets
|
||||
// should be copied and send back to the originator.
|
||||
func (c *dgramOpt) MulticastLoopback() (bool, error) {
|
||||
return false, errOpNoSupport
|
||||
}
|
||||
|
||||
// SetMulticastLoopback sets whether transmitted multicast packets
|
||||
// should be copied and send back to the originator.
|
||||
func (c *dgramOpt) SetMulticastLoopback(on bool) error {
|
||||
return errOpNoSupport
|
||||
}
|
||||
|
||||
// JoinGroup joins the group address group on the interface ifi.
|
||||
// By default all sources that can cast data to group are accepted.
|
||||
// It's possible to mute and unmute data transmission from a specific
|
||||
// source by using ExcludeSourceSpecificGroup and
|
||||
// IncludeSourceSpecificGroup.
|
||||
// JoinGroup uses the system assigned multicast interface when ifi is
|
||||
// nil, although this is not recommended because the assignment
|
||||
// depends on platforms and sometimes it might require routing
|
||||
// configuration.
|
||||
func (c *dgramOpt) JoinGroup(ifi *net.Interface, group net.Addr) error {
|
||||
return errOpNoSupport
|
||||
}
|
||||
|
||||
// LeaveGroup leaves the group address group on the interface ifi
|
||||
// regardless of whether the group is any-source group or
|
||||
// source-specific group.
|
||||
func (c *dgramOpt) LeaveGroup(ifi *net.Interface, group net.Addr) error {
|
||||
return errOpNoSupport
|
||||
}
|
||||
|
||||
// JoinSourceSpecificGroup joins the source-specific group comprising
|
||||
// group and source on the interface ifi.
|
||||
// JoinSourceSpecificGroup uses the system assigned multicast
|
||||
// interface when ifi is nil, although this is not recommended because
|
||||
// the assignment depends on platforms and sometimes it might require
|
||||
// routing configuration.
|
||||
func (c *dgramOpt) JoinSourceSpecificGroup(ifi *net.Interface, group, source net.Addr) error {
|
||||
return errOpNoSupport
|
||||
}
|
||||
|
||||
// LeaveSourceSpecificGroup leaves the source-specific group on the
|
||||
// interface ifi.
|
||||
func (c *dgramOpt) LeaveSourceSpecificGroup(ifi *net.Interface, group, source net.Addr) error {
|
||||
return errOpNoSupport
|
||||
}
|
||||
|
||||
// ExcludeSourceSpecificGroup excludes the source-specific group from
|
||||
// the already joined any-source groups by JoinGroup on the interface
|
||||
// ifi.
|
||||
func (c *dgramOpt) ExcludeSourceSpecificGroup(ifi *net.Interface, group, source net.Addr) error {
|
||||
return errOpNoSupport
|
||||
}
|
||||
|
||||
// IncludeSourceSpecificGroup includes the excluded source-specific
|
||||
// group by ExcludeSourceSpecificGroup again on the interface ifi.
|
||||
func (c *dgramOpt) IncludeSourceSpecificGroup(ifi *net.Interface, group, source net.Addr) error {
|
||||
return errOpNoSupport
|
||||
}
|
||||
|
||||
// ICMPFilter returns an ICMP filter.
|
||||
// Currently only Linux supports this.
|
||||
func (c *dgramOpt) ICMPFilter() (*ICMPFilter, error) {
|
||||
return nil, errOpNoSupport
|
||||
}
|
||||
|
||||
// SetICMPFilter deploys the ICMP filter.
|
||||
// Currently only Linux supports this.
|
||||
func (c *dgramOpt) SetICMPFilter(f *ICMPFilter) error {
|
||||
return errOpNoSupport
|
||||
}
|
26
vendor/golang.org/x/net/ipv4/doc.go
generated
vendored
26
vendor/golang.org/x/net/ipv4/doc.go
generated
vendored
@ -1,4 +1,4 @@
|
||||
// Copyright 2012 The Go Authors. All rights reserved.
|
||||
// Copyright 2012 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.
|
||||
|
||||
@ -21,10 +21,10 @@
|
||||
//
|
||||
// The options for unicasting are available for net.TCPConn,
|
||||
// net.UDPConn and net.IPConn which are created as network connections
|
||||
// that use the IPv4 transport. When a single TCP connection carrying
|
||||
// that use the IPv4 transport. When a single TCP connection carrying
|
||||
// a data flow of multiple packets needs to indicate the flow is
|
||||
// important, ipv4.Conn is used to set the type-of-service field on
|
||||
// the IPv4 header for each packet.
|
||||
// important, Conn is used to set the type-of-service field on the
|
||||
// IPv4 header for each packet.
|
||||
//
|
||||
// ln, err := net.Listen("tcp4", "0.0.0.0:1024")
|
||||
// if err != nil {
|
||||
@ -55,8 +55,8 @@
|
||||
// Multicasting
|
||||
//
|
||||
// The options for multicasting are available for net.UDPConn and
|
||||
// net.IPconn which are created as network connections that use the
|
||||
// IPv4 transport. A few network facilities must be prepared before
|
||||
// net.IPConn which are created as network connections that use the
|
||||
// IPv4 transport. A few network facilities must be prepared before
|
||||
// you begin multicasting, at a minimum joining network interfaces and
|
||||
// multicast groups.
|
||||
//
|
||||
@ -80,7 +80,7 @@
|
||||
// defer c.Close()
|
||||
//
|
||||
// Second, the application joins multicast groups, starts listening to
|
||||
// the groups on the specified network interfaces. Note that the
|
||||
// the groups on the specified network interfaces. Note that the
|
||||
// service port for transport layer protocol does not matter with this
|
||||
// operation as joining groups affects only network and link layer
|
||||
// protocols, such as IPv4 and Ethernet.
|
||||
@ -94,10 +94,10 @@
|
||||
// }
|
||||
//
|
||||
// The application might set per packet control message transmissions
|
||||
// between the protocol stack within the kernel. When the application
|
||||
// between the protocol stack within the kernel. When the application
|
||||
// needs a destination address on an incoming packet,
|
||||
// SetControlMessage of ipv4.PacketConn is used to enable control
|
||||
// message transmissons.
|
||||
// SetControlMessage of PacketConn is used to enable control message
|
||||
// transmissions.
|
||||
//
|
||||
// if err := p.SetControlMessage(ipv4.FlagDst, true); err != nil {
|
||||
// // error handling
|
||||
@ -145,7 +145,7 @@
|
||||
// More multicasting
|
||||
//
|
||||
// An application that uses PacketConn or RawConn may join multiple
|
||||
// multicast groups. For example, a UDP listener with port 1024 might
|
||||
// multicast groups. For example, a UDP listener with port 1024 might
|
||||
// join two different groups across over two different network
|
||||
// interfaces by using:
|
||||
//
|
||||
@ -166,7 +166,7 @@
|
||||
// }
|
||||
//
|
||||
// It is possible for multiple UDP listeners that listen on the same
|
||||
// UDP port to join the same multicast group. The net package will
|
||||
// UDP port to join the same multicast group. The net package will
|
||||
// provide a socket that listens to a wildcard address with reusable
|
||||
// UDP port when an appropriate multicast address prefix is passed to
|
||||
// the net.ListenPacket or net.ListenUDP.
|
||||
@ -240,3 +240,5 @@
|
||||
// In the fallback case, ExcludeSourceSpecificGroup and
|
||||
// IncludeSourceSpecificGroup may return an error.
|
||||
package ipv4
|
||||
|
||||
// BUG(mikio): This package is not implemented on JS, NaCl and Plan 9.
|
||||
|
97
vendor/golang.org/x/net/ipv4/endpoint.go
generated
vendored
97
vendor/golang.org/x/net/ipv4/endpoint.go
generated
vendored
@ -1,4 +1,4 @@
|
||||
// Copyright 2012 The Go Authors. All rights reserved.
|
||||
// Copyright 2012 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.
|
||||
|
||||
@ -6,10 +6,16 @@ package ipv4
|
||||
|
||||
import (
|
||||
"net"
|
||||
"syscall"
|
||||
"time"
|
||||
|
||||
"golang.org/x/net/internal/socket"
|
||||
)
|
||||
|
||||
// BUG(mikio): On Windows, the JoinSourceSpecificGroup,
|
||||
// LeaveSourceSpecificGroup, ExcludeSourceSpecificGroup and
|
||||
// IncludeSourceSpecificGroup methods of PacketConn and RawConn are
|
||||
// not implemented.
|
||||
|
||||
// A Conn represents a network endpoint that uses the IPv4 transport.
|
||||
// It is used to control basic IP-level socket options such as TOS and
|
||||
// TTL.
|
||||
@ -18,21 +24,22 @@ type Conn struct {
|
||||
}
|
||||
|
||||
type genericOpt struct {
|
||||
net.Conn
|
||||
*socket.Conn
|
||||
}
|
||||
|
||||
func (c *genericOpt) ok() bool { return c != nil && c.Conn != nil }
|
||||
|
||||
// NewConn returns a new Conn.
|
||||
func NewConn(c net.Conn) *Conn {
|
||||
cc, _ := socket.NewConn(c)
|
||||
return &Conn{
|
||||
genericOpt: genericOpt{Conn: c},
|
||||
genericOpt: genericOpt{Conn: cc},
|
||||
}
|
||||
}
|
||||
|
||||
// A PacketConn represents a packet network endpoint that uses the
|
||||
// IPv4 transport. It is used to control several IP-level socket
|
||||
// options including multicasting. It also provides datagram based
|
||||
// IPv4 transport. It is used to control several IP-level socket
|
||||
// options including multicasting. It also provides datagram based
|
||||
// network I/O methods specific to the IPv4 and higher layer protocols
|
||||
// such as UDP.
|
||||
type PacketConn struct {
|
||||
@ -42,28 +49,24 @@ type PacketConn struct {
|
||||
}
|
||||
|
||||
type dgramOpt struct {
|
||||
net.PacketConn
|
||||
*socket.Conn
|
||||
}
|
||||
|
||||
func (c *dgramOpt) ok() bool { return c != nil && c.PacketConn != nil }
|
||||
func (c *dgramOpt) ok() bool { return c != nil && c.Conn != nil }
|
||||
|
||||
// SetControlMessage sets the per packet IP-level socket options.
|
||||
func (c *PacketConn) SetControlMessage(cf ControlFlags, on bool) error {
|
||||
if !c.payloadHandler.ok() {
|
||||
return syscall.EINVAL
|
||||
return errInvalidConn
|
||||
}
|
||||
fd, err := c.payloadHandler.sysfd()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return setControlMessage(fd, &c.payloadHandler.rawOpt, cf, on)
|
||||
return setControlMessage(c.dgramOpt.Conn, &c.payloadHandler.rawOpt, cf, on)
|
||||
}
|
||||
|
||||
// SetDeadline sets the read and write deadlines associated with the
|
||||
// endpoint.
|
||||
func (c *PacketConn) SetDeadline(t time.Time) error {
|
||||
if !c.payloadHandler.ok() {
|
||||
return syscall.EINVAL
|
||||
return errInvalidConn
|
||||
}
|
||||
return c.payloadHandler.PacketConn.SetDeadline(t)
|
||||
}
|
||||
@ -72,7 +75,7 @@ func (c *PacketConn) SetDeadline(t time.Time) error {
|
||||
// endpoint.
|
||||
func (c *PacketConn) SetReadDeadline(t time.Time) error {
|
||||
if !c.payloadHandler.ok() {
|
||||
return syscall.EINVAL
|
||||
return errInvalidConn
|
||||
}
|
||||
return c.payloadHandler.PacketConn.SetReadDeadline(t)
|
||||
}
|
||||
@ -81,7 +84,7 @@ func (c *PacketConn) SetReadDeadline(t time.Time) error {
|
||||
// endpoint.
|
||||
func (c *PacketConn) SetWriteDeadline(t time.Time) error {
|
||||
if !c.payloadHandler.ok() {
|
||||
return syscall.EINVAL
|
||||
return errInvalidConn
|
||||
}
|
||||
return c.payloadHandler.PacketConn.SetWriteDeadline(t)
|
||||
}
|
||||
@ -89,7 +92,7 @@ func (c *PacketConn) SetWriteDeadline(t time.Time) error {
|
||||
// Close closes the endpoint.
|
||||
func (c *PacketConn) Close() error {
|
||||
if !c.payloadHandler.ok() {
|
||||
return syscall.EINVAL
|
||||
return errInvalidConn
|
||||
}
|
||||
return c.payloadHandler.PacketConn.Close()
|
||||
}
|
||||
@ -97,22 +100,18 @@ func (c *PacketConn) Close() error {
|
||||
// NewPacketConn returns a new PacketConn using c as its underlying
|
||||
// transport.
|
||||
func NewPacketConn(c net.PacketConn) *PacketConn {
|
||||
cc, _ := socket.NewConn(c.(net.Conn))
|
||||
p := &PacketConn{
|
||||
genericOpt: genericOpt{Conn: c.(net.Conn)},
|
||||
dgramOpt: dgramOpt{PacketConn: c},
|
||||
payloadHandler: payloadHandler{PacketConn: c},
|
||||
}
|
||||
if _, ok := c.(*net.IPConn); ok && sockOpts[ssoStripHeader].name > 0 {
|
||||
if fd, err := p.payloadHandler.sysfd(); err == nil {
|
||||
setInt(fd, &sockOpts[ssoStripHeader], boolint(true))
|
||||
}
|
||||
genericOpt: genericOpt{Conn: cc},
|
||||
dgramOpt: dgramOpt{Conn: cc},
|
||||
payloadHandler: payloadHandler{PacketConn: c, Conn: cc},
|
||||
}
|
||||
return p
|
||||
}
|
||||
|
||||
// A RawConn represents a packet network endpoint that uses the IPv4
|
||||
// transport. It is used to control several IP-level socket options
|
||||
// including IPv4 header manipulation. It also provides datagram
|
||||
// transport. It is used to control several IP-level socket options
|
||||
// including IPv4 header manipulation. It also provides datagram
|
||||
// based network I/O methods specific to the IPv4 and higher layer
|
||||
// protocols that handle IPv4 datagram directly such as OSPF, GRE.
|
||||
type RawConn struct {
|
||||
@ -124,63 +123,63 @@ type RawConn struct {
|
||||
// SetControlMessage sets the per packet IP-level socket options.
|
||||
func (c *RawConn) SetControlMessage(cf ControlFlags, on bool) error {
|
||||
if !c.packetHandler.ok() {
|
||||
return syscall.EINVAL
|
||||
return errInvalidConn
|
||||
}
|
||||
fd, err := c.packetHandler.sysfd()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return setControlMessage(fd, &c.packetHandler.rawOpt, cf, on)
|
||||
return setControlMessage(c.dgramOpt.Conn, &c.packetHandler.rawOpt, cf, on)
|
||||
}
|
||||
|
||||
// SetDeadline sets the read and write deadlines associated with the
|
||||
// endpoint.
|
||||
func (c *RawConn) SetDeadline(t time.Time) error {
|
||||
if !c.packetHandler.ok() {
|
||||
return syscall.EINVAL
|
||||
return errInvalidConn
|
||||
}
|
||||
return c.packetHandler.c.SetDeadline(t)
|
||||
return c.packetHandler.IPConn.SetDeadline(t)
|
||||
}
|
||||
|
||||
// SetReadDeadline sets the read deadline associated with the
|
||||
// endpoint.
|
||||
func (c *RawConn) SetReadDeadline(t time.Time) error {
|
||||
if !c.packetHandler.ok() {
|
||||
return syscall.EINVAL
|
||||
return errInvalidConn
|
||||
}
|
||||
return c.packetHandler.c.SetReadDeadline(t)
|
||||
return c.packetHandler.IPConn.SetReadDeadline(t)
|
||||
}
|
||||
|
||||
// SetWriteDeadline sets the write deadline associated with the
|
||||
// endpoint.
|
||||
func (c *RawConn) SetWriteDeadline(t time.Time) error {
|
||||
if !c.packetHandler.ok() {
|
||||
return syscall.EINVAL
|
||||
return errInvalidConn
|
||||
}
|
||||
return c.packetHandler.c.SetWriteDeadline(t)
|
||||
return c.packetHandler.IPConn.SetWriteDeadline(t)
|
||||
}
|
||||
|
||||
// Close closes the endpoint.
|
||||
func (c *RawConn) Close() error {
|
||||
if !c.packetHandler.ok() {
|
||||
return syscall.EINVAL
|
||||
return errInvalidConn
|
||||
}
|
||||
return c.packetHandler.c.Close()
|
||||
return c.packetHandler.IPConn.Close()
|
||||
}
|
||||
|
||||
// NewRawConn returns a new RawConn using c as its underlying
|
||||
// transport.
|
||||
func NewRawConn(c net.PacketConn) (*RawConn, error) {
|
||||
r := &RawConn{
|
||||
genericOpt: genericOpt{Conn: c.(net.Conn)},
|
||||
dgramOpt: dgramOpt{PacketConn: c},
|
||||
packetHandler: packetHandler{c: c.(*net.IPConn)},
|
||||
}
|
||||
fd, err := r.packetHandler.sysfd()
|
||||
cc, err := socket.NewConn(c.(net.Conn))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err := setInt(fd, &sockOpts[ssoHeaderPrepend], boolint(true)); err != nil {
|
||||
r := &RawConn{
|
||||
genericOpt: genericOpt{Conn: cc},
|
||||
dgramOpt: dgramOpt{Conn: cc},
|
||||
packetHandler: packetHandler{IPConn: c.(*net.IPConn), Conn: cc},
|
||||
}
|
||||
so, ok := sockOpts[ssoHeaderPrepend]
|
||||
if !ok {
|
||||
return nil, errOpNoSupport
|
||||
}
|
||||
if err := so.SetInt(r.dgramOpt.Conn, boolint(true)); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return r, nil
|
||||
|
15
vendor/golang.org/x/net/ipv4/gen.go
generated
vendored
15
vendor/golang.org/x/net/ipv4/gen.go
generated
vendored
@ -1,4 +1,4 @@
|
||||
// Copyright 2013 The Go Authors. All rights reserved.
|
||||
// Copyright 2013 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.
|
||||
|
||||
@ -52,15 +52,6 @@ func genzsys() error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
// The ipv4 package still supports go1.2, and so we need to
|
||||
// take care of additional platforms in go1.3 and above for
|
||||
// working with go1.2.
|
||||
switch {
|
||||
case runtime.GOOS == "dragonfly" || runtime.GOOS == "solaris":
|
||||
b = bytes.Replace(b, []byte("package ipv4\n"), []byte("// +build "+runtime.GOOS+"\n\npackage ipv4\n"), 1)
|
||||
case runtime.GOOS == "linux" && (runtime.GOARCH == "arm64" || runtime.GOARCH == "mips64" || runtime.GOARCH == "mips64le" || runtime.GOARCH == "ppc" || runtime.GOARCH == "ppc64" || runtime.GOARCH == "ppc64le" || runtime.GOARCH == "s390x"):
|
||||
b = bytes.Replace(b, []byte("package ipv4\n"), []byte("// +build "+runtime.GOOS+","+runtime.GOARCH+"\n\npackage ipv4\n"), 1)
|
||||
}
|
||||
b, err = format.Source(b)
|
||||
if err != nil {
|
||||
return err
|
||||
@ -81,7 +72,7 @@ var registries = []struct {
|
||||
parse func(io.Writer, io.Reader) error
|
||||
}{
|
||||
{
|
||||
"http://www.iana.org/assignments/icmp-parameters/icmp-parameters.xml",
|
||||
"https://www.iana.org/assignments/icmp-parameters/icmp-parameters.xml",
|
||||
parseICMPv4Parameters,
|
||||
},
|
||||
}
|
||||
@ -89,7 +80,7 @@ var registries = []struct {
|
||||
func geniana() error {
|
||||
var bb bytes.Buffer
|
||||
fmt.Fprintf(&bb, "// go generate gen.go\n")
|
||||
fmt.Fprintf(&bb, "// GENERATED BY THE COMMAND ABOVE; DO NOT EDIT\n\n")
|
||||
fmt.Fprintf(&bb, "// Code generated by the command above; DO NOT EDIT.\n\n")
|
||||
fmt.Fprintf(&bb, "package ipv4\n\n")
|
||||
for _, r := range registries {
|
||||
resp, err := http.Get(r.url)
|
||||
|
@ -1,59 +1,55 @@
|
||||
// Copyright 2012 The Go Authors. All rights reserved.
|
||||
// Copyright 2012 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.
|
||||
|
||||
// +build darwin dragonfly freebsd linux netbsd openbsd windows
|
||||
|
||||
package ipv4
|
||||
|
||||
import "syscall"
|
||||
|
||||
// TOS returns the type-of-service field value for outgoing packets.
|
||||
func (c *genericOpt) TOS() (int, error) {
|
||||
if !c.ok() {
|
||||
return 0, syscall.EINVAL
|
||||
return 0, errInvalidConn
|
||||
}
|
||||
fd, err := c.sysfd()
|
||||
if err != nil {
|
||||
return 0, err
|
||||
so, ok := sockOpts[ssoTOS]
|
||||
if !ok {
|
||||
return 0, errOpNoSupport
|
||||
}
|
||||
return getInt(fd, &sockOpts[ssoTOS])
|
||||
return so.GetInt(c.Conn)
|
||||
}
|
||||
|
||||
// SetTOS sets the type-of-service field value for future outgoing
|
||||
// packets.
|
||||
func (c *genericOpt) SetTOS(tos int) error {
|
||||
if !c.ok() {
|
||||
return syscall.EINVAL
|
||||
return errInvalidConn
|
||||
}
|
||||
fd, err := c.sysfd()
|
||||
if err != nil {
|
||||
return err
|
||||
so, ok := sockOpts[ssoTOS]
|
||||
if !ok {
|
||||
return errOpNoSupport
|
||||
}
|
||||
return setInt(fd, &sockOpts[ssoTOS], tos)
|
||||
return so.SetInt(c.Conn, tos)
|
||||
}
|
||||
|
||||
// TTL returns the time-to-live field value for outgoing packets.
|
||||
func (c *genericOpt) TTL() (int, error) {
|
||||
if !c.ok() {
|
||||
return 0, syscall.EINVAL
|
||||
return 0, errInvalidConn
|
||||
}
|
||||
fd, err := c.sysfd()
|
||||
if err != nil {
|
||||
return 0, err
|
||||
so, ok := sockOpts[ssoTTL]
|
||||
if !ok {
|
||||
return 0, errOpNoSupport
|
||||
}
|
||||
return getInt(fd, &sockOpts[ssoTTL])
|
||||
return so.GetInt(c.Conn)
|
||||
}
|
||||
|
||||
// SetTTL sets the time-to-live field value for future outgoing
|
||||
// packets.
|
||||
func (c *genericOpt) SetTTL(ttl int) error {
|
||||
if !c.ok() {
|
||||
return syscall.EINVAL
|
||||
return errInvalidConn
|
||||
}
|
||||
fd, err := c.sysfd()
|
||||
if err != nil {
|
||||
return err
|
||||
so, ok := sockOpts[ssoTTL]
|
||||
if !ok {
|
||||
return errOpNoSupport
|
||||
}
|
||||
return setInt(fd, &sockOpts[ssoTTL], ttl)
|
||||
return so.SetInt(c.Conn, ttl)
|
||||
}
|
29
vendor/golang.org/x/net/ipv4/genericopt_stub.go
generated
vendored
29
vendor/golang.org/x/net/ipv4/genericopt_stub.go
generated
vendored
@ -1,29 +0,0 @@
|
||||
// Copyright 2012 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.
|
||||
|
||||
// +build nacl plan9 solaris
|
||||
|
||||
package ipv4
|
||||
|
||||
// TOS returns the type-of-service field value for outgoing packets.
|
||||
func (c *genericOpt) TOS() (int, error) {
|
||||
return 0, errOpNoSupport
|
||||
}
|
||||
|
||||
// SetTOS sets the type-of-service field value for future outgoing
|
||||
// packets.
|
||||
func (c *genericOpt) SetTOS(tos int) error {
|
||||
return errOpNoSupport
|
||||
}
|
||||
|
||||
// TTL returns the time-to-live field value for outgoing packets.
|
||||
func (c *genericOpt) TTL() (int, error) {
|
||||
return 0, errOpNoSupport
|
||||
}
|
||||
|
||||
// SetTTL sets the time-to-live field value for future outgoing
|
||||
// packets.
|
||||
func (c *genericOpt) SetTTL(ttl int) error {
|
||||
return errOpNoSupport
|
||||
}
|
102
vendor/golang.org/x/net/ipv4/header.go
generated
vendored
102
vendor/golang.org/x/net/ipv4/header.go
generated
vendored
@ -1,4 +1,4 @@
|
||||
// Copyright 2012 The Go Authors. All rights reserved.
|
||||
// Copyright 2012 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.
|
||||
|
||||
@ -9,7 +9,8 @@ import (
|
||||
"fmt"
|
||||
"net"
|
||||
"runtime"
|
||||
"syscall"
|
||||
|
||||
"golang.org/x/net/internal/socket"
|
||||
)
|
||||
|
||||
const (
|
||||
@ -49,10 +50,14 @@ func (h *Header) String() string {
|
||||
return fmt.Sprintf("ver=%d hdrlen=%d tos=%#x totallen=%d id=%#x flags=%#x fragoff=%#x ttl=%d proto=%d cksum=%#x src=%v dst=%v", h.Version, h.Len, h.TOS, h.TotalLen, h.ID, h.Flags, h.FragOff, h.TTL, h.Protocol, h.Checksum, h.Src, h.Dst)
|
||||
}
|
||||
|
||||
// Marshal returns the binary encoding of the IPv4 header h.
|
||||
// Marshal returns the binary encoding of h.
|
||||
//
|
||||
// The returned slice is in the format used by a raw IP socket on the
|
||||
// local system.
|
||||
// This may differ from the wire format, depending on the system.
|
||||
func (h *Header) Marshal() ([]byte, error) {
|
||||
if h == nil {
|
||||
return nil, syscall.EINVAL
|
||||
return nil, errInvalidConn
|
||||
}
|
||||
if h.Len < HeaderLen {
|
||||
return nil, errHeaderTooShort
|
||||
@ -63,9 +68,17 @@ func (h *Header) Marshal() ([]byte, error) {
|
||||
b[1] = byte(h.TOS)
|
||||
flagsAndFragOff := (h.FragOff & 0x1fff) | int(h.Flags<<13)
|
||||
switch runtime.GOOS {
|
||||
case "darwin", "dragonfly", "freebsd", "netbsd":
|
||||
nativeEndian.PutUint16(b[2:4], uint16(h.TotalLen))
|
||||
nativeEndian.PutUint16(b[6:8], uint16(flagsAndFragOff))
|
||||
case "darwin", "dragonfly", "netbsd":
|
||||
socket.NativeEndian.PutUint16(b[2:4], uint16(h.TotalLen))
|
||||
socket.NativeEndian.PutUint16(b[6:8], uint16(flagsAndFragOff))
|
||||
case "freebsd":
|
||||
if freebsdVersion < 1100000 {
|
||||
socket.NativeEndian.PutUint16(b[2:4], uint16(h.TotalLen))
|
||||
socket.NativeEndian.PutUint16(b[6:8], uint16(flagsAndFragOff))
|
||||
} else {
|
||||
binary.BigEndian.PutUint16(b[2:4], uint16(h.TotalLen))
|
||||
binary.BigEndian.PutUint16(b[6:8], uint16(flagsAndFragOff))
|
||||
}
|
||||
default:
|
||||
binary.BigEndian.PutUint16(b[2:4], uint16(h.TotalLen))
|
||||
binary.BigEndian.PutUint16(b[6:8], uint16(flagsAndFragOff))
|
||||
@ -88,45 +101,70 @@ func (h *Header) Marshal() ([]byte, error) {
|
||||
return b, nil
|
||||
}
|
||||
|
||||
// ParseHeader parses b as an IPv4 header.
|
||||
func ParseHeader(b []byte) (*Header, error) {
|
||||
if len(b) < HeaderLen {
|
||||
return nil, errHeaderTooShort
|
||||
// Parse parses b as an IPv4 header and stores the result in h.
|
||||
//
|
||||
// The provided b must be in the format used by a raw IP socket on the
|
||||
// local system.
|
||||
// This may differ from the wire format, depending on the system.
|
||||
func (h *Header) Parse(b []byte) error {
|
||||
if h == nil || len(b) < HeaderLen {
|
||||
return errHeaderTooShort
|
||||
}
|
||||
hdrlen := int(b[0]&0x0f) << 2
|
||||
if hdrlen > len(b) {
|
||||
return nil, errBufferTooShort
|
||||
}
|
||||
h := &Header{
|
||||
Version: int(b[0] >> 4),
|
||||
Len: hdrlen,
|
||||
TOS: int(b[1]),
|
||||
ID: int(binary.BigEndian.Uint16(b[4:6])),
|
||||
TTL: int(b[8]),
|
||||
Protocol: int(b[9]),
|
||||
Checksum: int(binary.BigEndian.Uint16(b[10:12])),
|
||||
Src: net.IPv4(b[12], b[13], b[14], b[15]),
|
||||
Dst: net.IPv4(b[16], b[17], b[18], b[19]),
|
||||
return errBufferTooShort
|
||||
}
|
||||
h.Version = int(b[0] >> 4)
|
||||
h.Len = hdrlen
|
||||
h.TOS = int(b[1])
|
||||
h.ID = int(binary.BigEndian.Uint16(b[4:6]))
|
||||
h.TTL = int(b[8])
|
||||
h.Protocol = int(b[9])
|
||||
h.Checksum = int(binary.BigEndian.Uint16(b[10:12]))
|
||||
h.Src = net.IPv4(b[12], b[13], b[14], b[15])
|
||||
h.Dst = net.IPv4(b[16], b[17], b[18], b[19])
|
||||
switch runtime.GOOS {
|
||||
case "darwin", "dragonfly", "netbsd":
|
||||
h.TotalLen = int(nativeEndian.Uint16(b[2:4])) + hdrlen
|
||||
h.FragOff = int(nativeEndian.Uint16(b[6:8]))
|
||||
h.TotalLen = int(socket.NativeEndian.Uint16(b[2:4])) + hdrlen
|
||||
h.FragOff = int(socket.NativeEndian.Uint16(b[6:8]))
|
||||
case "freebsd":
|
||||
h.TotalLen = int(nativeEndian.Uint16(b[2:4]))
|
||||
if freebsdVersion < 1000000 {
|
||||
h.TotalLen += hdrlen
|
||||
if freebsdVersion < 1100000 {
|
||||
h.TotalLen = int(socket.NativeEndian.Uint16(b[2:4]))
|
||||
if freebsdVersion < 1000000 {
|
||||
h.TotalLen += hdrlen
|
||||
}
|
||||
h.FragOff = int(socket.NativeEndian.Uint16(b[6:8]))
|
||||
} else {
|
||||
h.TotalLen = int(binary.BigEndian.Uint16(b[2:4]))
|
||||
h.FragOff = int(binary.BigEndian.Uint16(b[6:8]))
|
||||
}
|
||||
h.FragOff = int(nativeEndian.Uint16(b[6:8]))
|
||||
default:
|
||||
h.TotalLen = int(binary.BigEndian.Uint16(b[2:4]))
|
||||
h.FragOff = int(binary.BigEndian.Uint16(b[6:8]))
|
||||
}
|
||||
h.Flags = HeaderFlags(h.FragOff&0xe000) >> 13
|
||||
h.FragOff = h.FragOff & 0x1fff
|
||||
if hdrlen-HeaderLen > 0 {
|
||||
h.Options = make([]byte, hdrlen-HeaderLen)
|
||||
copy(h.Options, b[HeaderLen:])
|
||||
optlen := hdrlen - HeaderLen
|
||||
if optlen > 0 && len(b) >= hdrlen {
|
||||
if cap(h.Options) < optlen {
|
||||
h.Options = make([]byte, optlen)
|
||||
} else {
|
||||
h.Options = h.Options[:optlen]
|
||||
}
|
||||
copy(h.Options, b[HeaderLen:hdrlen])
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// ParseHeader parses b as an IPv4 header.
|
||||
//
|
||||
// The provided b must be in the format used by a raw IP socket on the
|
||||
// local system.
|
||||
// This may differ from the wire format, depending on the system.
|
||||
func ParseHeader(b []byte) (*Header, error) {
|
||||
h := new(Header)
|
||||
if err := h.Parse(b); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return h, nil
|
||||
}
|
||||
|
35
vendor/golang.org/x/net/ipv4/helper.go
generated
vendored
35
vendor/golang.org/x/net/ipv4/helper.go
generated
vendored
@ -1,17 +1,16 @@
|
||||
// Copyright 2012 The Go Authors. All rights reserved.
|
||||
// Copyright 2012 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 (
|
||||
"encoding/binary"
|
||||
"errors"
|
||||
"net"
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
var (
|
||||
errInvalidConn = errors.New("invalid connection")
|
||||
errMissingAddress = errors.New("missing address")
|
||||
errMissingHeader = errors.New("missing header")
|
||||
errHeaderTooShort = errors.New("header too short")
|
||||
@ -23,20 +22,8 @@ var (
|
||||
|
||||
// See http://www.freebsd.org/doc/en/books/porters-handbook/freebsd-versions.html.
|
||||
freebsdVersion uint32
|
||||
|
||||
nativeEndian binary.ByteOrder
|
||||
)
|
||||
|
||||
func init() {
|
||||
i := uint32(1)
|
||||
b := (*[4]byte)(unsafe.Pointer(&i))
|
||||
if b[0] == 1 {
|
||||
nativeEndian = binary.LittleEndian
|
||||
} else {
|
||||
nativeEndian = binary.BigEndian
|
||||
}
|
||||
}
|
||||
|
||||
func boolint(b bool) int {
|
||||
if b {
|
||||
return 1
|
||||
@ -57,3 +44,21 @@ func netAddrToIP4(a net.Addr) net.IP {
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func opAddr(a net.Addr) net.Addr {
|
||||
switch a.(type) {
|
||||
case *net.TCPAddr:
|
||||
if a == nil {
|
||||
return nil
|
||||
}
|
||||
case *net.UDPAddr:
|
||||
if a == nil {
|
||||
return nil
|
||||
}
|
||||
case *net.IPAddr:
|
||||
if a == nil {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
return a
|
||||
}
|
||||
|
23
vendor/golang.org/x/net/ipv4/helper_stub.go
generated
vendored
23
vendor/golang.org/x/net/ipv4/helper_stub.go
generated
vendored
@ -1,23 +0,0 @@
|
||||
// Copyright 2012 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.
|
||||
|
||||
// +build nacl plan9 solaris
|
||||
|
||||
package ipv4
|
||||
|
||||
func (c *genericOpt) sysfd() (int, error) {
|
||||
return 0, errOpNoSupport
|
||||
}
|
||||
|
||||
func (c *dgramOpt) sysfd() (int, error) {
|
||||
return 0, errOpNoSupport
|
||||
}
|
||||
|
||||
func (c *payloadHandler) sysfd() (int, error) {
|
||||
return 0, errOpNoSupport
|
||||
}
|
||||
|
||||
func (c *packetHandler) sysfd() (int, error) {
|
||||
return 0, errOpNoSupport
|
||||
}
|
50
vendor/golang.org/x/net/ipv4/helper_unix.go
generated
vendored
50
vendor/golang.org/x/net/ipv4/helper_unix.go
generated
vendored
@ -1,50 +0,0 @@
|
||||
// Copyright 2012 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.
|
||||
|
||||
// +build darwin dragonfly freebsd linux netbsd openbsd
|
||||
|
||||
package ipv4
|
||||
|
||||
import (
|
||||
"net"
|
||||
"reflect"
|
||||
)
|
||||
|
||||
func (c *genericOpt) sysfd() (int, error) {
|
||||
switch p := c.Conn.(type) {
|
||||
case *net.TCPConn, *net.UDPConn, *net.IPConn:
|
||||
return sysfd(p)
|
||||
}
|
||||
return 0, errInvalidConnType
|
||||
}
|
||||
|
||||
func (c *dgramOpt) sysfd() (int, error) {
|
||||
switch p := c.PacketConn.(type) {
|
||||
case *net.UDPConn, *net.IPConn:
|
||||
return sysfd(p.(net.Conn))
|
||||
}
|
||||
return 0, errInvalidConnType
|
||||
}
|
||||
|
||||
func (c *payloadHandler) sysfd() (int, error) {
|
||||
return sysfd(c.PacketConn.(net.Conn))
|
||||
}
|
||||
|
||||
func (c *packetHandler) sysfd() (int, error) {
|
||||
return sysfd(c.c)
|
||||
}
|
||||
|
||||
func sysfd(c net.Conn) (int, error) {
|
||||
cv := reflect.ValueOf(c)
|
||||
switch ce := cv.Elem(); ce.Kind() {
|
||||
case reflect.Struct:
|
||||
netfd := ce.FieldByName("conn").FieldByName("fd")
|
||||
switch fe := netfd.Elem(); fe.Kind() {
|
||||
case reflect.Struct:
|
||||
fd := fe.FieldByName("sysfd")
|
||||
return int(fd.Int()), nil
|
||||
}
|
||||
}
|
||||
return 0, errInvalidConnType
|
||||
}
|
49
vendor/golang.org/x/net/ipv4/helper_windows.go
generated
vendored
49
vendor/golang.org/x/net/ipv4/helper_windows.go
generated
vendored
@ -1,49 +0,0 @@
|
||||
// Copyright 2012 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 (
|
||||
"net"
|
||||
"reflect"
|
||||
"syscall"
|
||||
)
|
||||
|
||||
func (c *genericOpt) sysfd() (syscall.Handle, error) {
|
||||
switch p := c.Conn.(type) {
|
||||
case *net.TCPConn, *net.UDPConn, *net.IPConn:
|
||||
return sysfd(p)
|
||||
}
|
||||
return syscall.InvalidHandle, errInvalidConnType
|
||||
}
|
||||
|
||||
func (c *dgramOpt) sysfd() (syscall.Handle, error) {
|
||||
switch p := c.PacketConn.(type) {
|
||||
case *net.UDPConn, *net.IPConn:
|
||||
return sysfd(p.(net.Conn))
|
||||
}
|
||||
return syscall.InvalidHandle, errInvalidConnType
|
||||
}
|
||||
|
||||
func (c *payloadHandler) sysfd() (syscall.Handle, error) {
|
||||
return sysfd(c.PacketConn.(net.Conn))
|
||||
}
|
||||
|
||||
func (c *packetHandler) sysfd() (syscall.Handle, error) {
|
||||
return sysfd(c.c)
|
||||
}
|
||||
|
||||
func sysfd(c net.Conn) (syscall.Handle, error) {
|
||||
cv := reflect.ValueOf(c)
|
||||
switch ce := cv.Elem(); ce.Kind() {
|
||||
case reflect.Struct:
|
||||
netfd := ce.FieldByName("conn").FieldByName("fd")
|
||||
switch fe := netfd.Elem(); fe.Kind() {
|
||||
case reflect.Struct:
|
||||
fd := fe.FieldByName("sysfd")
|
||||
return syscall.Handle(fd.Uint()), nil
|
||||
}
|
||||
}
|
||||
return syscall.InvalidHandle, errInvalidConnType
|
||||
}
|
10
vendor/golang.org/x/net/ipv4/iana.go
generated
vendored
10
vendor/golang.org/x/net/ipv4/iana.go
generated
vendored
@ -1,9 +1,9 @@
|
||||
// go generate gen.go
|
||||
// GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
|
||||
// Code generated by the command above; DO NOT EDIT.
|
||||
|
||||
package ipv4
|
||||
|
||||
// Internet Control Message Protocol (ICMP) Parameters, Updated: 2013-04-19
|
||||
// Internet Control Message Protocol (ICMP) Parameters, Updated: 2018-02-26
|
||||
const (
|
||||
ICMPTypeEchoReply ICMPType = 0 // Echo Reply
|
||||
ICMPTypeDestinationUnreachable ICMPType = 3 // Destination Unreachable
|
||||
@ -16,9 +16,11 @@ const (
|
||||
ICMPTypeTimestamp ICMPType = 13 // Timestamp
|
||||
ICMPTypeTimestampReply ICMPType = 14 // Timestamp Reply
|
||||
ICMPTypePhoturis ICMPType = 40 // Photuris
|
||||
ICMPTypeExtendedEchoRequest ICMPType = 42 // Extended Echo Request
|
||||
ICMPTypeExtendedEchoReply ICMPType = 43 // Extended Echo Reply
|
||||
)
|
||||
|
||||
// Internet Control Message Protocol (ICMP) Parameters, Updated: 2013-04-19
|
||||
// Internet Control Message Protocol (ICMP) Parameters, Updated: 2018-02-26
|
||||
var icmpTypes = map[ICMPType]string{
|
||||
0: "echo reply",
|
||||
3: "destination unreachable",
|
||||
@ -31,4 +33,6 @@ var icmpTypes = map[ICMPType]string{
|
||||
13: "timestamp",
|
||||
14: "timestamp reply",
|
||||
40: "photuris",
|
||||
42: "extended echo request",
|
||||
43: "extended echo reply",
|
||||
}
|
||||
|
6
vendor/golang.org/x/net/ipv4/icmp.go
generated
vendored
6
vendor/golang.org/x/net/ipv4/icmp.go
generated
vendored
@ -1,4 +1,4 @@
|
||||
// Copyright 2013 The Go Authors. All rights reserved.
|
||||
// Copyright 2013 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.
|
||||
|
||||
@ -26,12 +26,12 @@ func (typ ICMPType) Protocol() int {
|
||||
// packets. The filter belongs to a packet delivery path on a host and
|
||||
// it cannot interact with forwarding packets or tunnel-outer packets.
|
||||
//
|
||||
// Note: RFC 2460 defines a reasonable role model and it works not
|
||||
// Note: RFC 8200 defines a reasonable role model and it works not
|
||||
// only for IPv6 but IPv4. A node means a device that implements IP.
|
||||
// A router means a node that forwards IP packets not explicitly
|
||||
// addressed to itself, and a host means a node that is not a router.
|
||||
type ICMPFilter struct {
|
||||
sysICMPFilter
|
||||
icmpFilter
|
||||
}
|
||||
|
||||
// Accept accepts incoming ICMP packets including the type field value
|
||||
|
8
vendor/golang.org/x/net/ipv4/icmp_linux.go
generated
vendored
8
vendor/golang.org/x/net/ipv4/icmp_linux.go
generated
vendored
@ -4,15 +4,15 @@
|
||||
|
||||
package ipv4
|
||||
|
||||
func (f *sysICMPFilter) accept(typ ICMPType) {
|
||||
func (f *icmpFilter) accept(typ ICMPType) {
|
||||
f.Data &^= 1 << (uint32(typ) & 31)
|
||||
}
|
||||
|
||||
func (f *sysICMPFilter) block(typ ICMPType) {
|
||||
func (f *icmpFilter) block(typ ICMPType) {
|
||||
f.Data |= 1 << (uint32(typ) & 31)
|
||||
}
|
||||
|
||||
func (f *sysICMPFilter) setAll(block bool) {
|
||||
func (f *icmpFilter) setAll(block bool) {
|
||||
if block {
|
||||
f.Data = 1<<32 - 1
|
||||
} else {
|
||||
@ -20,6 +20,6 @@ func (f *sysICMPFilter) setAll(block bool) {
|
||||
}
|
||||
}
|
||||
|
||||
func (f *sysICMPFilter) willBlock(typ ICMPType) bool {
|
||||
func (f *icmpFilter) willBlock(typ ICMPType) bool {
|
||||
return f.Data&(1<<(uint32(typ)&31)) != 0
|
||||
}
|
||||
|
12
vendor/golang.org/x/net/ipv4/icmp_stub.go
generated
vendored
12
vendor/golang.org/x/net/ipv4/icmp_stub.go
generated
vendored
@ -6,20 +6,20 @@
|
||||
|
||||
package ipv4
|
||||
|
||||
const sysSizeofICMPFilter = 0x0
|
||||
const sizeofICMPFilter = 0x0
|
||||
|
||||
type sysICMPFilter struct {
|
||||
type icmpFilter struct {
|
||||
}
|
||||
|
||||
func (f *sysICMPFilter) accept(typ ICMPType) {
|
||||
func (f *icmpFilter) accept(typ ICMPType) {
|
||||
}
|
||||
|
||||
func (f *sysICMPFilter) block(typ ICMPType) {
|
||||
func (f *icmpFilter) block(typ ICMPType) {
|
||||
}
|
||||
|
||||
func (f *sysICMPFilter) setAll(block bool) {
|
||||
func (f *icmpFilter) setAll(block bool) {
|
||||
}
|
||||
|
||||
func (f *sysICMPFilter) willBlock(typ ICMPType) bool {
|
||||
func (f *icmpFilter) willBlock(typ ICMPType) bool {
|
||||
return false
|
||||
}
|
||||
|
63
vendor/golang.org/x/net/ipv4/packet.go
generated
vendored
63
vendor/golang.org/x/net/ipv4/packet.go
generated
vendored
@ -1,4 +1,4 @@
|
||||
// Copyright 2012 The Go Authors. All rights reserved.
|
||||
// Copyright 2012 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.
|
||||
|
||||
@ -6,43 +6,30 @@ package ipv4
|
||||
|
||||
import (
|
||||
"net"
|
||||
"syscall"
|
||||
|
||||
"golang.org/x/net/internal/socket"
|
||||
)
|
||||
|
||||
// BUG(mikio): On Windows, the ReadFrom and WriteTo methods of RawConn
|
||||
// are not implemented.
|
||||
|
||||
// A packetHandler represents the IPv4 datagram handler.
|
||||
type packetHandler struct {
|
||||
c *net.IPConn
|
||||
*net.IPConn
|
||||
*socket.Conn
|
||||
rawOpt
|
||||
}
|
||||
|
||||
func (c *packetHandler) ok() bool { return c != nil && c.c != nil }
|
||||
func (c *packetHandler) ok() bool { return c != nil && c.IPConn != nil && c.Conn != nil }
|
||||
|
||||
// ReadFrom reads an IPv4 datagram from the endpoint c, copying the
|
||||
// datagram into b. It returns the received datagram as the IPv4
|
||||
// datagram into b. It returns the received datagram as the IPv4
|
||||
// header h, the payload p and the control message cm.
|
||||
func (c *packetHandler) ReadFrom(b []byte) (h *Header, p []byte, cm *ControlMessage, err error) {
|
||||
if !c.ok() {
|
||||
return nil, nil, nil, syscall.EINVAL
|
||||
return nil, nil, nil, errInvalidConn
|
||||
}
|
||||
oob := newControlMessage(&c.rawOpt)
|
||||
n, oobn, _, src, err := c.c.ReadMsgIP(b, oob)
|
||||
if err != nil {
|
||||
return nil, nil, nil, err
|
||||
}
|
||||
var hs []byte
|
||||
if hs, p, err = slicePacket(b[:n]); err != nil {
|
||||
return nil, nil, nil, err
|
||||
}
|
||||
if h, err = ParseHeader(hs); err != nil {
|
||||
return nil, nil, nil, err
|
||||
}
|
||||
if cm, err = parseControlMessage(oob[:oobn]); err != nil {
|
||||
return nil, nil, nil, err
|
||||
}
|
||||
if src != nil && cm != nil {
|
||||
cm.Src = src.IP
|
||||
}
|
||||
return
|
||||
return c.readFrom(b)
|
||||
}
|
||||
|
||||
func slicePacket(b []byte) (h, p []byte, err error) {
|
||||
@ -54,14 +41,14 @@ func slicePacket(b []byte) (h, p []byte, err error) {
|
||||
}
|
||||
|
||||
// WriteTo writes an IPv4 datagram through the endpoint c, copying the
|
||||
// datagram from the IPv4 header h and the payload p. The control
|
||||
// datagram from the IPv4 header h and the payload p. The control
|
||||
// message cm allows the datagram path and the outgoing interface to be
|
||||
// specified. Currently only Darwin and Linux support this. The cm
|
||||
// specified. Currently only Darwin and Linux support this. The cm
|
||||
// may be nil if control of the outgoing datagram is not required.
|
||||
//
|
||||
// The IPv4 header h must contain appropriate fields that include:
|
||||
//
|
||||
// Version = ipv4.Version
|
||||
// Version = <must be specified>
|
||||
// Len = <must be specified>
|
||||
// TOS = <must be specified>
|
||||
// TotalLen = <must be specified>
|
||||
@ -75,23 +62,7 @@ func slicePacket(b []byte) (h, p []byte, err error) {
|
||||
// Options = optional
|
||||
func (c *packetHandler) WriteTo(h *Header, p []byte, cm *ControlMessage) error {
|
||||
if !c.ok() {
|
||||
return syscall.EINVAL
|
||||
return errInvalidConn
|
||||
}
|
||||
oob := marshalControlMessage(cm)
|
||||
wh, err := h.Marshal()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
dst := &net.IPAddr{}
|
||||
if cm != nil {
|
||||
if ip := cm.Dst.To4(); ip != nil {
|
||||
dst.IP = ip
|
||||
}
|
||||
}
|
||||
if dst.IP == nil {
|
||||
dst.IP = h.Dst
|
||||
}
|
||||
wh = append(wh, p...)
|
||||
_, _, err = c.c.WriteMsgIP(wh, oob, dst)
|
||||
return err
|
||||
return c.writeTo(h, p, cm)
|
||||
}
|
||||
|
56
vendor/golang.org/x/net/ipv4/packet_go1_8.go
generated
vendored
Normal file
56
vendor/golang.org/x/net/ipv4/packet_go1_8.go
generated
vendored
Normal file
@ -0,0 +1,56 @@
|
||||
// Copyright 2012 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.
|
||||
|
||||
// +build !go1.9
|
||||
|
||||
package ipv4
|
||||
|
||||
import "net"
|
||||
|
||||
func (c *packetHandler) readFrom(b []byte) (h *Header, p []byte, cm *ControlMessage, err error) {
|
||||
c.rawOpt.RLock()
|
||||
oob := NewControlMessage(c.rawOpt.cflags)
|
||||
c.rawOpt.RUnlock()
|
||||
n, nn, _, src, err := c.ReadMsgIP(b, oob)
|
||||
if err != nil {
|
||||
return nil, nil, nil, err
|
||||
}
|
||||
var hs []byte
|
||||
if hs, p, err = slicePacket(b[:n]); err != nil {
|
||||
return nil, nil, nil, err
|
||||
}
|
||||
if h, err = ParseHeader(hs); err != nil {
|
||||
return nil, nil, nil, err
|
||||
}
|
||||
if nn > 0 {
|
||||
cm = new(ControlMessage)
|
||||
if err := cm.Parse(oob[:nn]); err != nil {
|
||||
return nil, nil, nil, err
|
||||
}
|
||||
}
|
||||
if src != nil && cm != nil {
|
||||
cm.Src = src.IP
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (c *packetHandler) writeTo(h *Header, p []byte, cm *ControlMessage) error {
|
||||
oob := cm.Marshal()
|
||||
wh, err := h.Marshal()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
dst := new(net.IPAddr)
|
||||
if cm != nil {
|
||||
if ip := cm.Dst.To4(); ip != nil {
|
||||
dst.IP = ip
|
||||
}
|
||||
}
|
||||
if dst.IP == nil {
|
||||
dst.IP = h.Dst
|
||||
}
|
||||
wh = append(wh, p...)
|
||||
_, _, err = c.WriteMsgIP(wh, oob, dst)
|
||||
return err
|
||||
}
|
67
vendor/golang.org/x/net/ipv4/packet_go1_9.go
generated
vendored
Normal file
67
vendor/golang.org/x/net/ipv4/packet_go1_9.go
generated
vendored
Normal file
@ -0,0 +1,67 @@
|
||||
// Copyright 2017 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.
|
||||
|
||||
// +build go1.9
|
||||
|
||||
package ipv4
|
||||
|
||||
import (
|
||||
"net"
|
||||
|
||||
"golang.org/x/net/internal/socket"
|
||||
)
|
||||
|
||||
func (c *packetHandler) readFrom(b []byte) (h *Header, p []byte, cm *ControlMessage, err error) {
|
||||
c.rawOpt.RLock()
|
||||
m := socket.Message{
|
||||
Buffers: [][]byte{b},
|
||||
OOB: NewControlMessage(c.rawOpt.cflags),
|
||||
}
|
||||
c.rawOpt.RUnlock()
|
||||
if err := c.RecvMsg(&m, 0); err != nil {
|
||||
return nil, nil, nil, &net.OpError{Op: "read", Net: c.IPConn.LocalAddr().Network(), Source: c.IPConn.LocalAddr(), Err: err}
|
||||
}
|
||||
var hs []byte
|
||||
if hs, p, err = slicePacket(b[:m.N]); err != nil {
|
||||
return nil, nil, nil, &net.OpError{Op: "read", Net: c.IPConn.LocalAddr().Network(), Source: c.IPConn.LocalAddr(), Err: err}
|
||||
}
|
||||
if h, err = ParseHeader(hs); err != nil {
|
||||
return nil, nil, nil, &net.OpError{Op: "read", Net: c.IPConn.LocalAddr().Network(), Source: c.IPConn.LocalAddr(), Err: err}
|
||||
}
|
||||
if m.NN > 0 {
|
||||
cm = new(ControlMessage)
|
||||
if err := cm.Parse(m.OOB[:m.NN]); err != nil {
|
||||
return nil, nil, nil, &net.OpError{Op: "read", Net: c.IPConn.LocalAddr().Network(), Source: c.IPConn.LocalAddr(), Err: err}
|
||||
}
|
||||
}
|
||||
if src, ok := m.Addr.(*net.IPAddr); ok && cm != nil {
|
||||
cm.Src = src.IP
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (c *packetHandler) writeTo(h *Header, p []byte, cm *ControlMessage) error {
|
||||
m := socket.Message{
|
||||
OOB: cm.Marshal(),
|
||||
}
|
||||
wh, err := h.Marshal()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
m.Buffers = [][]byte{wh, p}
|
||||
dst := new(net.IPAddr)
|
||||
if cm != nil {
|
||||
if ip := cm.Dst.To4(); ip != nil {
|
||||
dst.IP = ip
|
||||
}
|
||||
}
|
||||
if dst.IP == nil {
|
||||
dst.IP = h.Dst
|
||||
}
|
||||
m.Addr = dst
|
||||
if err := c.SendMsg(&m, 0); err != nil {
|
||||
return &net.OpError{Op: "write", Net: c.IPConn.LocalAddr().Network(), Source: c.IPConn.LocalAddr(), Addr: opAddr(dst), Err: err}
|
||||
}
|
||||
return nil
|
||||
}
|
14
vendor/golang.org/x/net/ipv4/payload.go
generated
vendored
14
vendor/golang.org/x/net/ipv4/payload.go
generated
vendored
@ -1,15 +1,23 @@
|
||||
// Copyright 2012 The Go Authors. All rights reserved.
|
||||
// Copyright 2012 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 "net"
|
||||
import (
|
||||
"net"
|
||||
|
||||
"golang.org/x/net/internal/socket"
|
||||
)
|
||||
|
||||
// BUG(mikio): On Windows, the ControlMessage for ReadFrom and WriteTo
|
||||
// methods of PacketConn is not implemented.
|
||||
|
||||
// A payloadHandler represents the IPv4 datagram payload handler.
|
||||
type payloadHandler struct {
|
||||
net.PacketConn
|
||||
*socket.Conn
|
||||
rawOpt
|
||||
}
|
||||
|
||||
func (c *payloadHandler) ok() bool { return c != nil && c.PacketConn != nil }
|
||||
func (c *payloadHandler) ok() bool { return c != nil && c.PacketConn != nil && c.Conn != nil }
|
||||
|
70
vendor/golang.org/x/net/ipv4/payload_cmsg.go
generated
vendored
70
vendor/golang.org/x/net/ipv4/payload_cmsg.go
generated
vendored
@ -1,81 +1,33 @@
|
||||
// Copyright 2012 The Go Authors. All rights reserved.
|
||||
// Copyright 2012 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.
|
||||
|
||||
// +build !plan9,!solaris,!windows
|
||||
// +build !js,!nacl,!plan9,!windows
|
||||
|
||||
package ipv4
|
||||
|
||||
import (
|
||||
"net"
|
||||
"syscall"
|
||||
)
|
||||
import "net"
|
||||
|
||||
// ReadFrom reads a payload of the received IPv4 datagram, from the
|
||||
// endpoint c, copying the payload into b. It returns the number of
|
||||
// endpoint c, copying the payload into b. It returns the number of
|
||||
// bytes copied into b, the control message cm and the source address
|
||||
// src of the received datagram.
|
||||
func (c *payloadHandler) ReadFrom(b []byte) (n int, cm *ControlMessage, src net.Addr, err error) {
|
||||
if !c.ok() {
|
||||
return 0, nil, nil, syscall.EINVAL
|
||||
return 0, nil, nil, errInvalidConn
|
||||
}
|
||||
oob := newControlMessage(&c.rawOpt)
|
||||
var oobn int
|
||||
switch c := c.PacketConn.(type) {
|
||||
case *net.UDPConn:
|
||||
if n, oobn, _, src, err = c.ReadMsgUDP(b, oob); err != nil {
|
||||
return 0, nil, nil, err
|
||||
}
|
||||
case *net.IPConn:
|
||||
if sockOpts[ssoStripHeader].name > 0 {
|
||||
if n, oobn, _, src, err = c.ReadMsgIP(b, oob); err != nil {
|
||||
return 0, nil, nil, err
|
||||
}
|
||||
} else {
|
||||
nb := make([]byte, maxHeaderLen+len(b))
|
||||
if n, oobn, _, src, err = c.ReadMsgIP(nb, oob); err != nil {
|
||||
return 0, nil, nil, err
|
||||
}
|
||||
hdrlen := int(nb[0]&0x0f) << 2
|
||||
copy(b, nb[hdrlen:])
|
||||
n -= hdrlen
|
||||
}
|
||||
default:
|
||||
return 0, nil, nil, errInvalidConnType
|
||||
}
|
||||
if cm, err = parseControlMessage(oob[:oobn]); err != nil {
|
||||
return 0, nil, nil, err
|
||||
}
|
||||
if cm != nil {
|
||||
cm.Src = netAddrToIP4(src)
|
||||
}
|
||||
return
|
||||
return c.readFrom(b)
|
||||
}
|
||||
|
||||
// WriteTo writes a payload of the IPv4 datagram, to the destination
|
||||
// address dst through the endpoint c, copying the payload from b. It
|
||||
// returns the number of bytes written. The control message cm allows
|
||||
// address dst through the endpoint c, copying the payload from b. It
|
||||
// returns the number of bytes written. The control message cm allows
|
||||
// the datagram path and the outgoing interface to be specified.
|
||||
// Currently only Darwin and Linux support this. The cm may be nil if
|
||||
// Currently only Darwin and Linux support this. The cm may be nil if
|
||||
// control of the outgoing datagram is not required.
|
||||
func (c *payloadHandler) WriteTo(b []byte, cm *ControlMessage, dst net.Addr) (n int, err error) {
|
||||
if !c.ok() {
|
||||
return 0, syscall.EINVAL
|
||||
return 0, errInvalidConn
|
||||
}
|
||||
oob := marshalControlMessage(cm)
|
||||
if dst == nil {
|
||||
return 0, errMissingAddress
|
||||
}
|
||||
switch c := c.PacketConn.(type) {
|
||||
case *net.UDPConn:
|
||||
n, _, err = c.WriteMsgUDP(b, oob, dst.(*net.UDPAddr))
|
||||
case *net.IPConn:
|
||||
n, _, err = c.WriteMsgIP(b, oob, dst.(*net.IPAddr))
|
||||
default:
|
||||
return 0, errInvalidConnType
|
||||
}
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
return
|
||||
return c.writeTo(b, cm, dst)
|
||||
}
|
||||
|
59
vendor/golang.org/x/net/ipv4/payload_cmsg_go1_8.go
generated
vendored
Normal file
59
vendor/golang.org/x/net/ipv4/payload_cmsg_go1_8.go
generated
vendored
Normal file
@ -0,0 +1,59 @@
|
||||
// Copyright 2012 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.
|
||||
|
||||
// +build !go1.9
|
||||
// +build !js,!nacl,!plan9,!windows
|
||||
|
||||
package ipv4
|
||||
|
||||
import "net"
|
||||
|
||||
func (c *payloadHandler) readFrom(b []byte) (n int, cm *ControlMessage, src net.Addr, err error) {
|
||||
c.rawOpt.RLock()
|
||||
oob := NewControlMessage(c.rawOpt.cflags)
|
||||
c.rawOpt.RUnlock()
|
||||
var nn int
|
||||
switch c := c.PacketConn.(type) {
|
||||
case *net.UDPConn:
|
||||
if n, nn, _, src, err = c.ReadMsgUDP(b, oob); err != nil {
|
||||
return 0, nil, nil, err
|
||||
}
|
||||
case *net.IPConn:
|
||||
nb := make([]byte, maxHeaderLen+len(b))
|
||||
if n, nn, _, src, err = c.ReadMsgIP(nb, oob); err != nil {
|
||||
return 0, nil, nil, err
|
||||
}
|
||||
hdrlen := int(nb[0]&0x0f) << 2
|
||||
copy(b, nb[hdrlen:])
|
||||
n -= hdrlen
|
||||
default:
|
||||
return 0, nil, nil, &net.OpError{Op: "read", Net: c.LocalAddr().Network(), Source: c.LocalAddr(), Err: errInvalidConnType}
|
||||
}
|
||||
if nn > 0 {
|
||||
cm = new(ControlMessage)
|
||||
if err = cm.Parse(oob[:nn]); err != nil {
|
||||
return 0, nil, nil, &net.OpError{Op: "read", Net: c.PacketConn.LocalAddr().Network(), Source: c.PacketConn.LocalAddr(), Err: err}
|
||||
}
|
||||
}
|
||||
if cm != nil {
|
||||
cm.Src = netAddrToIP4(src)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (c *payloadHandler) writeTo(b []byte, cm *ControlMessage, dst net.Addr) (n int, err error) {
|
||||
oob := cm.Marshal()
|
||||
if dst == nil {
|
||||
return 0, &net.OpError{Op: "write", Net: c.PacketConn.LocalAddr().Network(), Source: c.PacketConn.LocalAddr(), Err: errMissingAddress}
|
||||
}
|
||||
switch c := c.PacketConn.(type) {
|
||||
case *net.UDPConn:
|
||||
n, _, err = c.WriteMsgUDP(b, oob, dst.(*net.UDPAddr))
|
||||
case *net.IPConn:
|
||||
n, _, err = c.WriteMsgIP(b, oob, dst.(*net.IPAddr))
|
||||
default:
|
||||
return 0, &net.OpError{Op: "write", Net: c.LocalAddr().Network(), Source: c.LocalAddr(), Addr: opAddr(dst), Err: errInvalidConnType}
|
||||
}
|
||||
return
|
||||
}
|
67
vendor/golang.org/x/net/ipv4/payload_cmsg_go1_9.go
generated
vendored
Normal file
67
vendor/golang.org/x/net/ipv4/payload_cmsg_go1_9.go
generated
vendored
Normal file
@ -0,0 +1,67 @@
|
||||
// Copyright 2017 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.
|
||||
|
||||
// +build go1.9
|
||||
// +build !js,!nacl,!plan9,!windows
|
||||
|
||||
package ipv4
|
||||
|
||||
import (
|
||||
"net"
|
||||
|
||||
"golang.org/x/net/internal/socket"
|
||||
)
|
||||
|
||||
func (c *payloadHandler) readFrom(b []byte) (int, *ControlMessage, net.Addr, error) {
|
||||
c.rawOpt.RLock()
|
||||
m := socket.Message{
|
||||
OOB: NewControlMessage(c.rawOpt.cflags),
|
||||
}
|
||||
c.rawOpt.RUnlock()
|
||||
switch c.PacketConn.(type) {
|
||||
case *net.UDPConn:
|
||||
m.Buffers = [][]byte{b}
|
||||
if err := c.RecvMsg(&m, 0); err != nil {
|
||||
return 0, nil, nil, &net.OpError{Op: "read", Net: c.PacketConn.LocalAddr().Network(), Source: c.PacketConn.LocalAddr(), Err: err}
|
||||
}
|
||||
case *net.IPConn:
|
||||
h := make([]byte, HeaderLen)
|
||||
m.Buffers = [][]byte{h, b}
|
||||
if err := c.RecvMsg(&m, 0); err != nil {
|
||||
return 0, nil, nil, &net.OpError{Op: "read", Net: c.PacketConn.LocalAddr().Network(), Source: c.PacketConn.LocalAddr(), Err: err}
|
||||
}
|
||||
hdrlen := int(h[0]&0x0f) << 2
|
||||
if hdrlen > len(h) {
|
||||
d := hdrlen - len(h)
|
||||
copy(b, b[d:])
|
||||
m.N -= d
|
||||
} else {
|
||||
m.N -= hdrlen
|
||||
}
|
||||
default:
|
||||
return 0, nil, nil, &net.OpError{Op: "read", Net: c.PacketConn.LocalAddr().Network(), Source: c.PacketConn.LocalAddr(), Err: errInvalidConnType}
|
||||
}
|
||||
var cm *ControlMessage
|
||||
if m.NN > 0 {
|
||||
cm = new(ControlMessage)
|
||||
if err := cm.Parse(m.OOB[:m.NN]); err != nil {
|
||||
return 0, nil, nil, &net.OpError{Op: "read", Net: c.PacketConn.LocalAddr().Network(), Source: c.PacketConn.LocalAddr(), Err: err}
|
||||
}
|
||||
cm.Src = netAddrToIP4(m.Addr)
|
||||
}
|
||||
return m.N, cm, m.Addr, nil
|
||||
}
|
||||
|
||||
func (c *payloadHandler) writeTo(b []byte, cm *ControlMessage, dst net.Addr) (int, error) {
|
||||
m := socket.Message{
|
||||
Buffers: [][]byte{b},
|
||||
OOB: cm.Marshal(),
|
||||
Addr: dst,
|
||||
}
|
||||
err := c.SendMsg(&m, 0)
|
||||
if err != nil {
|
||||
err = &net.OpError{Op: "write", Net: c.PacketConn.LocalAddr().Network(), Source: c.PacketConn.LocalAddr(), Addr: opAddr(dst), Err: err}
|
||||
}
|
||||
return m.N, err
|
||||
}
|
21
vendor/golang.org/x/net/ipv4/payload_nocmsg.go
generated
vendored
21
vendor/golang.org/x/net/ipv4/payload_nocmsg.go
generated
vendored
@ -1,23 +1,20 @@
|
||||
// Copyright 2012 The Go Authors. All rights reserved.
|
||||
// Copyright 2012 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.
|
||||
|
||||
// +build plan9 solaris windows
|
||||
// +build js nacl plan9 windows
|
||||
|
||||
package ipv4
|
||||
|
||||
import (
|
||||
"net"
|
||||
"syscall"
|
||||
)
|
||||
import "net"
|
||||
|
||||
// ReadFrom reads a payload of the received IPv4 datagram, from the
|
||||
// endpoint c, copying the payload into b. It returns the number of
|
||||
// endpoint c, copying the payload into b. It returns the number of
|
||||
// bytes copied into b, the control message cm and the source address
|
||||
// src of the received datagram.
|
||||
func (c *payloadHandler) ReadFrom(b []byte) (n int, cm *ControlMessage, src net.Addr, err error) {
|
||||
if !c.ok() {
|
||||
return 0, nil, nil, syscall.EINVAL
|
||||
return 0, nil, nil, errInvalidConn
|
||||
}
|
||||
if n, src, err = c.PacketConn.ReadFrom(b); err != nil {
|
||||
return 0, nil, nil, err
|
||||
@ -26,14 +23,14 @@ func (c *payloadHandler) ReadFrom(b []byte) (n int, cm *ControlMessage, src net.
|
||||
}
|
||||
|
||||
// WriteTo writes a payload of the IPv4 datagram, to the destination
|
||||
// address dst through the endpoint c, copying the payload from b. It
|
||||
// returns the number of bytes written. The control message cm allows
|
||||
// address dst through the endpoint c, copying the payload from b. It
|
||||
// returns the number of bytes written. The control message cm allows
|
||||
// the datagram path and the outgoing interface to be specified.
|
||||
// Currently only Darwin and Linux support this. The cm may be nil if
|
||||
// Currently only Darwin and Linux support this. The cm may be nil if
|
||||
// control of the outgoing datagram is not required.
|
||||
func (c *payloadHandler) WriteTo(b []byte, cm *ControlMessage, dst net.Addr) (n int, err error) {
|
||||
if !c.ok() {
|
||||
return 0, syscall.EINVAL
|
||||
return 0, errInvalidConn
|
||||
}
|
||||
if dst == nil {
|
||||
return 0, errMissingAddress
|
||||
|
14
vendor/golang.org/x/net/ipv4/sockopt.go
generated
vendored
14
vendor/golang.org/x/net/ipv4/sockopt.go
generated
vendored
@ -4,6 +4,8 @@
|
||||
|
||||
package ipv4
|
||||
|
||||
import "golang.org/x/net/internal/socket"
|
||||
|
||||
// Sticky socket options
|
||||
const (
|
||||
ssoTOS = iota // header field for unicast packet
|
||||
@ -24,16 +26,12 @@ const (
|
||||
ssoLeaveSourceGroup // source-specific multicast
|
||||
ssoBlockSourceGroup // any-source or source-specific multicast
|
||||
ssoUnblockSourceGroup // any-source or source-specific multicast
|
||||
ssoMax
|
||||
ssoAttachFilter // attach BPF for filtering inbound traffic
|
||||
)
|
||||
|
||||
// Sticky socket option value types
|
||||
const (
|
||||
ssoTypeByte = iota + 1
|
||||
ssoTypeInt
|
||||
ssoTypeInterface
|
||||
ssoTypeICMPFilter
|
||||
ssoTypeIPMreq
|
||||
ssoTypeIPMreq = iota + 1
|
||||
ssoTypeIPMreqn
|
||||
ssoTypeGroupReq
|
||||
ssoTypeGroupSourceReq
|
||||
@ -41,6 +39,6 @@ const (
|
||||
|
||||
// A sockOpt represents a binding for sticky socket option.
|
||||
type sockOpt struct {
|
||||
name int // option name, must be equal or greater than 1
|
||||
typ int // option value type, must be equal or greater than 1
|
||||
socket.Option
|
||||
typ int // hint for option value type; optional
|
||||
}
|
||||
|
21
vendor/golang.org/x/net/ipv4/sockopt_asmreq_stub.go
generated
vendored
21
vendor/golang.org/x/net/ipv4/sockopt_asmreq_stub.go
generated
vendored
@ -1,21 +0,0 @@
|
||||
// Copyright 2012 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.
|
||||
|
||||
// +build !darwin,!dragonfly,!freebsd,!netbsd,!openbsd,!windows
|
||||
|
||||
package ipv4
|
||||
|
||||
import "net"
|
||||
|
||||
func setsockoptIPMreq(fd, name int, ifi *net.Interface, grp net.IP) error {
|
||||
return errOpNoSupport
|
||||
}
|
||||
|
||||
func getsockoptInterface(fd, name int) (*net.Interface, error) {
|
||||
return nil, errOpNoSupport
|
||||
}
|
||||
|
||||
func setsockoptInterface(fd, name int, ifi *net.Interface) error {
|
||||
return errOpNoSupport
|
||||
}
|
46
vendor/golang.org/x/net/ipv4/sockopt_asmreq_unix.go
generated
vendored
46
vendor/golang.org/x/net/ipv4/sockopt_asmreq_unix.go
generated
vendored
@ -1,46 +0,0 @@
|
||||
// Copyright 2012 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.
|
||||
|
||||
// +build darwin dragonfly freebsd netbsd openbsd
|
||||
|
||||
package ipv4
|
||||
|
||||
import (
|
||||
"net"
|
||||
"os"
|
||||
"unsafe"
|
||||
|
||||
"golang.org/x/net/internal/iana"
|
||||
)
|
||||
|
||||
func setsockoptIPMreq(fd, name int, ifi *net.Interface, grp net.IP) error {
|
||||
mreq := sysIPMreq{Multiaddr: [4]byte{grp[0], grp[1], grp[2], grp[3]}}
|
||||
if err := setIPMreqInterface(&mreq, ifi); err != nil {
|
||||
return err
|
||||
}
|
||||
return os.NewSyscallError("setsockopt", setsockopt(fd, iana.ProtocolIP, name, unsafe.Pointer(&mreq), sysSizeofIPMreq))
|
||||
}
|
||||
|
||||
func getsockoptInterface(fd, name int) (*net.Interface, error) {
|
||||
var b [4]byte
|
||||
l := uint32(4)
|
||||
if err := getsockopt(fd, iana.ProtocolIP, name, unsafe.Pointer(&b[0]), &l); err != nil {
|
||||
return nil, os.NewSyscallError("getsockopt", err)
|
||||
}
|
||||
ifi, err := netIP4ToInterface(net.IPv4(b[0], b[1], b[2], b[3]))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return ifi, nil
|
||||
}
|
||||
|
||||
func setsockoptInterface(fd, name int, ifi *net.Interface) error {
|
||||
ip, err := netInterfaceToIP4(ifi)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
var b [4]byte
|
||||
copy(b[:], ip)
|
||||
return os.NewSyscallError("setsockopt", setsockopt(fd, iana.ProtocolIP, name, unsafe.Pointer(&b[0]), uint32(4)))
|
||||
}
|
45
vendor/golang.org/x/net/ipv4/sockopt_asmreq_windows.go
generated
vendored
45
vendor/golang.org/x/net/ipv4/sockopt_asmreq_windows.go
generated
vendored
@ -1,45 +0,0 @@
|
||||
// Copyright 2012 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 (
|
||||
"net"
|
||||
"os"
|
||||
"syscall"
|
||||
"unsafe"
|
||||
|
||||
"golang.org/x/net/internal/iana"
|
||||
)
|
||||
|
||||
func setsockoptIPMreq(fd syscall.Handle, name int, ifi *net.Interface, grp net.IP) error {
|
||||
mreq := sysIPMreq{Multiaddr: [4]byte{grp[0], grp[1], grp[2], grp[3]}}
|
||||
if err := setIPMreqInterface(&mreq, ifi); err != nil {
|
||||
return err
|
||||
}
|
||||
return os.NewSyscallError("setsockopt", syscall.Setsockopt(fd, iana.ProtocolIP, int32(name), (*byte)(unsafe.Pointer(&mreq)), int32(sysSizeofIPMreq)))
|
||||
}
|
||||
|
||||
func getsockoptInterface(fd syscall.Handle, name int) (*net.Interface, error) {
|
||||
var b [4]byte
|
||||
l := int32(4)
|
||||
if err := syscall.Getsockopt(fd, iana.ProtocolIP, int32(name), (*byte)(unsafe.Pointer(&b[0])), &l); err != nil {
|
||||
return nil, os.NewSyscallError("getsockopt", err)
|
||||
}
|
||||
ifi, err := netIP4ToInterface(net.IPv4(b[0], b[1], b[2], b[3]))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return ifi, nil
|
||||
}
|
||||
|
||||
func setsockoptInterface(fd syscall.Handle, name int, ifi *net.Interface) error {
|
||||
ip, err := netInterfaceToIP4(ifi)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
var b [4]byte
|
||||
copy(b[:], ip)
|
||||
return os.NewSyscallError("setsockopt", syscall.Setsockopt(fd, iana.ProtocolIP, int32(name), (*byte)(unsafe.Pointer(&b[0])), 4))
|
||||
}
|
17
vendor/golang.org/x/net/ipv4/sockopt_asmreqn_stub.go
generated
vendored
17
vendor/golang.org/x/net/ipv4/sockopt_asmreqn_stub.go
generated
vendored
@ -1,17 +0,0 @@
|
||||
// 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.
|
||||
|
||||
// +build !darwin,!freebsd,!linux,!windows
|
||||
|
||||
package ipv4
|
||||
|
||||
import "net"
|
||||
|
||||
func getsockoptIPMreqn(fd, name int) (*net.Interface, error) {
|
||||
return nil, errOpNoSupport
|
||||
}
|
||||
|
||||
func setsockoptIPMreqn(fd, name int, ifi *net.Interface, grp net.IP) error {
|
||||
return errOpNoSupport
|
||||
}
|
71
vendor/golang.org/x/net/ipv4/sockopt_posix.go
generated
vendored
Normal file
71
vendor/golang.org/x/net/ipv4/sockopt_posix.go
generated
vendored
Normal file
@ -0,0 +1,71 @@
|
||||
// Copyright 2012 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.
|
||||
|
||||
// +build darwin dragonfly freebsd linux netbsd openbsd solaris windows
|
||||
|
||||
package ipv4
|
||||
|
||||
import (
|
||||
"net"
|
||||
"unsafe"
|
||||
|
||||
"golang.org/x/net/bpf"
|
||||
"golang.org/x/net/internal/socket"
|
||||
)
|
||||
|
||||
func (so *sockOpt) getMulticastInterface(c *socket.Conn) (*net.Interface, error) {
|
||||
switch so.typ {
|
||||
case ssoTypeIPMreqn:
|
||||
return so.getIPMreqn(c)
|
||||
default:
|
||||
return so.getMulticastIf(c)
|
||||
}
|
||||
}
|
||||
|
||||
func (so *sockOpt) setMulticastInterface(c *socket.Conn, ifi *net.Interface) error {
|
||||
switch so.typ {
|
||||
case ssoTypeIPMreqn:
|
||||
return so.setIPMreqn(c, ifi, nil)
|
||||
default:
|
||||
return so.setMulticastIf(c, ifi)
|
||||
}
|
||||
}
|
||||
|
||||
func (so *sockOpt) getICMPFilter(c *socket.Conn) (*ICMPFilter, error) {
|
||||
b := make([]byte, so.Len)
|
||||
n, err := so.Get(c, b)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if n != sizeofICMPFilter {
|
||||
return nil, errOpNoSupport
|
||||
}
|
||||
return (*ICMPFilter)(unsafe.Pointer(&b[0])), nil
|
||||
}
|
||||
|
||||
func (so *sockOpt) setICMPFilter(c *socket.Conn, f *ICMPFilter) error {
|
||||
b := (*[sizeofICMPFilter]byte)(unsafe.Pointer(f))[:sizeofICMPFilter]
|
||||
return so.Set(c, b)
|
||||
}
|
||||
|
||||
func (so *sockOpt) setGroup(c *socket.Conn, ifi *net.Interface, grp net.IP) error {
|
||||
switch so.typ {
|
||||
case ssoTypeIPMreq:
|
||||
return so.setIPMreq(c, ifi, grp)
|
||||
case ssoTypeIPMreqn:
|
||||
return so.setIPMreqn(c, ifi, grp)
|
||||
case ssoTypeGroupReq:
|
||||
return so.setGroupReq(c, ifi, grp)
|
||||
default:
|
||||
return errOpNoSupport
|
||||
}
|
||||
}
|
||||
|
||||
func (so *sockOpt) setSourceGroup(c *socket.Conn, ifi *net.Interface, grp, src net.IP) error {
|
||||
return so.setGroupSourceReq(c, ifi, grp, src)
|
||||
}
|
||||
|
||||
func (so *sockOpt) setBPF(c *socket.Conn, f []bpf.RawInstruction) error {
|
||||
return so.setAttachFilter(c, f)
|
||||
}
|
17
vendor/golang.org/x/net/ipv4/sockopt_ssmreq_stub.go
generated
vendored
17
vendor/golang.org/x/net/ipv4/sockopt_ssmreq_stub.go
generated
vendored
@ -1,17 +0,0 @@
|
||||
// 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.
|
||||
|
||||
// +build !darwin,!freebsd,!linux
|
||||
|
||||
package ipv4
|
||||
|
||||
import "net"
|
||||
|
||||
func setsockoptGroupReq(fd, name int, ifi *net.Interface, grp net.IP) error {
|
||||
return errOpNoSupport
|
||||
}
|
||||
|
||||
func setsockoptGroupSourceReq(fd, name int, ifi *net.Interface, grp, src net.IP) error {
|
||||
return errOpNoSupport
|
||||
}
|
61
vendor/golang.org/x/net/ipv4/sockopt_ssmreq_unix.go
generated
vendored
61
vendor/golang.org/x/net/ipv4/sockopt_ssmreq_unix.go
generated
vendored
@ -1,61 +0,0 @@
|
||||
// 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.
|
||||
|
||||
// +build darwin freebsd linux
|
||||
|
||||
package ipv4
|
||||
|
||||
import (
|
||||
"net"
|
||||
"os"
|
||||
"unsafe"
|
||||
|
||||
"golang.org/x/net/internal/iana"
|
||||
)
|
||||
|
||||
var freebsd32o64 bool
|
||||
|
||||
func setsockoptGroupReq(fd, name int, ifi *net.Interface, grp net.IP) error {
|
||||
var gr sysGroupReq
|
||||
if ifi != nil {
|
||||
gr.Interface = uint32(ifi.Index)
|
||||
}
|
||||
gr.setGroup(grp)
|
||||
var p unsafe.Pointer
|
||||
var l uint32
|
||||
if freebsd32o64 {
|
||||
var d [sysSizeofGroupReq + 4]byte
|
||||
s := (*[sysSizeofGroupReq]byte)(unsafe.Pointer(&gr))
|
||||
copy(d[:4], s[:4])
|
||||
copy(d[8:], s[4:])
|
||||
p = unsafe.Pointer(&d[0])
|
||||
l = sysSizeofGroupReq + 4
|
||||
} else {
|
||||
p = unsafe.Pointer(&gr)
|
||||
l = sysSizeofGroupReq
|
||||
}
|
||||
return os.NewSyscallError("setsockopt", setsockopt(fd, iana.ProtocolIP, name, p, l))
|
||||
}
|
||||
|
||||
func setsockoptGroupSourceReq(fd, name int, ifi *net.Interface, grp, src net.IP) error {
|
||||
var gsr sysGroupSourceReq
|
||||
if ifi != nil {
|
||||
gsr.Interface = uint32(ifi.Index)
|
||||
}
|
||||
gsr.setSourceGroup(grp, src)
|
||||
var p unsafe.Pointer
|
||||
var l uint32
|
||||
if freebsd32o64 {
|
||||
var d [sysSizeofGroupSourceReq + 4]byte
|
||||
s := (*[sysSizeofGroupSourceReq]byte)(unsafe.Pointer(&gsr))
|
||||
copy(d[:4], s[:4])
|
||||
copy(d[8:], s[4:])
|
||||
p = unsafe.Pointer(&d[0])
|
||||
l = sysSizeofGroupSourceReq + 4
|
||||
} else {
|
||||
p = unsafe.Pointer(&gsr)
|
||||
l = sysSizeofGroupSourceReq
|
||||
}
|
||||
return os.NewSyscallError("setsockopt", setsockopt(fd, iana.ProtocolIP, name, p, l))
|
||||
}
|
37
vendor/golang.org/x/net/ipv4/sockopt_stub.go
generated
vendored
37
vendor/golang.org/x/net/ipv4/sockopt_stub.go
generated
vendored
@ -1,11 +1,42 @@
|
||||
// Copyright 2012 The Go Authors. All rights reserved.
|
||||
// Copyright 2012 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.
|
||||
|
||||
// +build nacl plan9 solaris
|
||||
// +build !darwin,!dragonfly,!freebsd,!linux,!netbsd,!openbsd,!solaris,!windows
|
||||
|
||||
package ipv4
|
||||
|
||||
func setInt(fd int, opt *sockOpt, v int) error {
|
||||
import (
|
||||
"net"
|
||||
|
||||
"golang.org/x/net/bpf"
|
||||
"golang.org/x/net/internal/socket"
|
||||
)
|
||||
|
||||
func (so *sockOpt) getMulticastInterface(c *socket.Conn) (*net.Interface, error) {
|
||||
return nil, errOpNoSupport
|
||||
}
|
||||
|
||||
func (so *sockOpt) setMulticastInterface(c *socket.Conn, ifi *net.Interface) error {
|
||||
return errOpNoSupport
|
||||
}
|
||||
|
||||
func (so *sockOpt) getICMPFilter(c *socket.Conn) (*ICMPFilter, error) {
|
||||
return nil, errOpNoSupport
|
||||
}
|
||||
|
||||
func (so *sockOpt) setICMPFilter(c *socket.Conn, f *ICMPFilter) error {
|
||||
return errOpNoSupport
|
||||
}
|
||||
|
||||
func (so *sockOpt) setGroup(c *socket.Conn, ifi *net.Interface, grp net.IP) error {
|
||||
return errOpNoSupport
|
||||
}
|
||||
|
||||
func (so *sockOpt) setSourceGroup(c *socket.Conn, ifi *net.Interface, grp, src net.IP) error {
|
||||
return errOpNoSupport
|
||||
}
|
||||
|
||||
func (so *sockOpt) setBPF(c *socket.Conn, f []bpf.RawInstruction) error {
|
||||
return errOpNoSupport
|
||||
}
|
||||
|
122
vendor/golang.org/x/net/ipv4/sockopt_unix.go
generated
vendored
122
vendor/golang.org/x/net/ipv4/sockopt_unix.go
generated
vendored
@ -1,122 +0,0 @@
|
||||
// Copyright 2012 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.
|
||||
|
||||
// +build darwin dragonfly freebsd linux netbsd openbsd
|
||||
|
||||
package ipv4
|
||||
|
||||
import (
|
||||
"net"
|
||||
"os"
|
||||
"unsafe"
|
||||
|
||||
"golang.org/x/net/internal/iana"
|
||||
)
|
||||
|
||||
func getInt(fd int, opt *sockOpt) (int, error) {
|
||||
if opt.name < 1 || (opt.typ != ssoTypeByte && opt.typ != ssoTypeInt) {
|
||||
return 0, errOpNoSupport
|
||||
}
|
||||
var i int32
|
||||
var b byte
|
||||
p := unsafe.Pointer(&i)
|
||||
l := uint32(4)
|
||||
if opt.typ == ssoTypeByte {
|
||||
p = unsafe.Pointer(&b)
|
||||
l = 1
|
||||
}
|
||||
if err := getsockopt(fd, iana.ProtocolIP, opt.name, p, &l); err != nil {
|
||||
return 0, os.NewSyscallError("getsockopt", err)
|
||||
}
|
||||
if opt.typ == ssoTypeByte {
|
||||
return int(b), nil
|
||||
}
|
||||
return int(i), nil
|
||||
}
|
||||
|
||||
func setInt(fd int, opt *sockOpt, v int) error {
|
||||
if opt.name < 1 || (opt.typ != ssoTypeByte && opt.typ != ssoTypeInt) {
|
||||
return errOpNoSupport
|
||||
}
|
||||
i := int32(v)
|
||||
var b byte
|
||||
p := unsafe.Pointer(&i)
|
||||
l := uint32(4)
|
||||
if opt.typ == ssoTypeByte {
|
||||
b = byte(v)
|
||||
p = unsafe.Pointer(&b)
|
||||
l = 1
|
||||
}
|
||||
return os.NewSyscallError("setsockopt", setsockopt(fd, iana.ProtocolIP, opt.name, p, l))
|
||||
}
|
||||
|
||||
func getInterface(fd int, opt *sockOpt) (*net.Interface, error) {
|
||||
if opt.name < 1 {
|
||||
return nil, errOpNoSupport
|
||||
}
|
||||
switch opt.typ {
|
||||
case ssoTypeInterface:
|
||||
return getsockoptInterface(fd, opt.name)
|
||||
case ssoTypeIPMreqn:
|
||||
return getsockoptIPMreqn(fd, opt.name)
|
||||
default:
|
||||
return nil, errOpNoSupport
|
||||
}
|
||||
}
|
||||
|
||||
func setInterface(fd int, opt *sockOpt, ifi *net.Interface) error {
|
||||
if opt.name < 1 {
|
||||
return errOpNoSupport
|
||||
}
|
||||
switch opt.typ {
|
||||
case ssoTypeInterface:
|
||||
return setsockoptInterface(fd, opt.name, ifi)
|
||||
case ssoTypeIPMreqn:
|
||||
return setsockoptIPMreqn(fd, opt.name, ifi, nil)
|
||||
default:
|
||||
return errOpNoSupport
|
||||
}
|
||||
}
|
||||
|
||||
func getICMPFilter(fd int, opt *sockOpt) (*ICMPFilter, error) {
|
||||
if opt.name < 1 || opt.typ != ssoTypeICMPFilter {
|
||||
return nil, errOpNoSupport
|
||||
}
|
||||
var f ICMPFilter
|
||||
l := uint32(sysSizeofICMPFilter)
|
||||
if err := getsockopt(fd, iana.ProtocolReserved, opt.name, unsafe.Pointer(&f.sysICMPFilter), &l); err != nil {
|
||||
return nil, os.NewSyscallError("getsockopt", err)
|
||||
}
|
||||
return &f, nil
|
||||
}
|
||||
|
||||
func setICMPFilter(fd int, opt *sockOpt, f *ICMPFilter) error {
|
||||
if opt.name < 1 || opt.typ != ssoTypeICMPFilter {
|
||||
return errOpNoSupport
|
||||
}
|
||||
return os.NewSyscallError("setsockopt", setsockopt(fd, iana.ProtocolReserved, opt.name, unsafe.Pointer(&f.sysICMPFilter), sysSizeofICMPFilter))
|
||||
}
|
||||
|
||||
func setGroup(fd int, opt *sockOpt, ifi *net.Interface, grp net.IP) error {
|
||||
if opt.name < 1 {
|
||||
return errOpNoSupport
|
||||
}
|
||||
switch opt.typ {
|
||||
case ssoTypeIPMreq:
|
||||
return setsockoptIPMreq(fd, opt.name, ifi, grp)
|
||||
case ssoTypeIPMreqn:
|
||||
return setsockoptIPMreqn(fd, opt.name, ifi, grp)
|
||||
case ssoTypeGroupReq:
|
||||
return setsockoptGroupReq(fd, opt.name, ifi, grp)
|
||||
default:
|
||||
return errOpNoSupport
|
||||
}
|
||||
}
|
||||
|
||||
func setSourceGroup(fd int, opt *sockOpt, ifi *net.Interface, grp, src net.IP) error {
|
||||
if opt.name < 1 || opt.typ != ssoTypeGroupSourceReq {
|
||||
return errOpNoSupport
|
||||
}
|
||||
return setsockoptGroupSourceReq(fd, opt.name, ifi, grp, src)
|
||||
}
|
68
vendor/golang.org/x/net/ipv4/sockopt_windows.go
generated
vendored
68
vendor/golang.org/x/net/ipv4/sockopt_windows.go
generated
vendored
@ -1,68 +0,0 @@
|
||||
// Copyright 2012 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 (
|
||||
"net"
|
||||
"os"
|
||||
"syscall"
|
||||
"unsafe"
|
||||
|
||||
"golang.org/x/net/internal/iana"
|
||||
)
|
||||
|
||||
func getInt(fd syscall.Handle, opt *sockOpt) (int, error) {
|
||||
if opt.name < 1 || opt.typ != ssoTypeInt {
|
||||
return 0, errOpNoSupport
|
||||
}
|
||||
var i int32
|
||||
l := int32(4)
|
||||
if err := syscall.Getsockopt(fd, iana.ProtocolIP, int32(opt.name), (*byte)(unsafe.Pointer(&i)), &l); err != nil {
|
||||
return 0, os.NewSyscallError("getsockopt", err)
|
||||
}
|
||||
return int(i), nil
|
||||
}
|
||||
|
||||
func setInt(fd syscall.Handle, opt *sockOpt, v int) error {
|
||||
if opt.name < 1 || opt.typ != ssoTypeInt {
|
||||
return errOpNoSupport
|
||||
}
|
||||
i := int32(v)
|
||||
return os.NewSyscallError("setsockopt", syscall.Setsockopt(fd, iana.ProtocolIP, int32(opt.name), (*byte)(unsafe.Pointer(&i)), 4))
|
||||
}
|
||||
|
||||
func getInterface(fd syscall.Handle, opt *sockOpt) (*net.Interface, error) {
|
||||
if opt.name < 1 || opt.typ != ssoTypeInterface {
|
||||
return nil, errOpNoSupport
|
||||
}
|
||||
return getsockoptInterface(fd, opt.name)
|
||||
}
|
||||
|
||||
func setInterface(fd syscall.Handle, opt *sockOpt, ifi *net.Interface) error {
|
||||
if opt.name < 1 || opt.typ != ssoTypeInterface {
|
||||
return errOpNoSupport
|
||||
}
|
||||
return setsockoptInterface(fd, opt.name, ifi)
|
||||
}
|
||||
|
||||
func getICMPFilter(fd syscall.Handle, opt *sockOpt) (*ICMPFilter, error) {
|
||||
return nil, errOpNoSupport
|
||||
}
|
||||
|
||||
func setICMPFilter(fd syscall.Handle, opt *sockOpt, f *ICMPFilter) error {
|
||||
return errOpNoSupport
|
||||
}
|
||||
|
||||
func setGroup(fd syscall.Handle, opt *sockOpt, ifi *net.Interface, grp net.IP) error {
|
||||
if opt.name < 1 || opt.typ != ssoTypeIPMreq {
|
||||
return errOpNoSupport
|
||||
}
|
||||
return setsockoptIPMreq(fd, opt.name, ifi, grp)
|
||||
}
|
||||
|
||||
func setSourceGroup(fd syscall.Handle, opt *sockOpt, ifi *net.Interface, grp, src net.IP) error {
|
||||
// TODO(mikio): implement this
|
||||
return errOpNoSupport
|
||||
}
|
@ -1,14 +1,50 @@
|
||||
// Copyright 2012 The Go Authors. All rights reserved.
|
||||
// Copyright 2012 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.
|
||||
|
||||
// +build darwin dragonfly freebsd netbsd openbsd windows
|
||||
// +build darwin dragonfly freebsd netbsd openbsd solaris windows
|
||||
|
||||
package ipv4
|
||||
|
||||
import "net"
|
||||
import (
|
||||
"net"
|
||||
"unsafe"
|
||||
|
||||
func setIPMreqInterface(mreq *sysIPMreq, ifi *net.Interface) error {
|
||||
"golang.org/x/net/internal/socket"
|
||||
)
|
||||
|
||||
func (so *sockOpt) setIPMreq(c *socket.Conn, ifi *net.Interface, grp net.IP) error {
|
||||
mreq := ipMreq{Multiaddr: [4]byte{grp[0], grp[1], grp[2], grp[3]}}
|
||||
if err := setIPMreqInterface(&mreq, ifi); err != nil {
|
||||
return err
|
||||
}
|
||||
b := (*[sizeofIPMreq]byte)(unsafe.Pointer(&mreq))[:sizeofIPMreq]
|
||||
return so.Set(c, b)
|
||||
}
|
||||
|
||||
func (so *sockOpt) getMulticastIf(c *socket.Conn) (*net.Interface, error) {
|
||||
var b [4]byte
|
||||
if _, err := so.Get(c, b[:]); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
ifi, err := netIP4ToInterface(net.IPv4(b[0], b[1], b[2], b[3]))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return ifi, nil
|
||||
}
|
||||
|
||||
func (so *sockOpt) setMulticastIf(c *socket.Conn, ifi *net.Interface) error {
|
||||
ip, err := netInterfaceToIP4(ifi)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
var b [4]byte
|
||||
copy(b[:], ip)
|
||||
return so.Set(c, b[:])
|
||||
}
|
||||
|
||||
func setIPMreqInterface(mreq *ipMreq, ifi *net.Interface) error {
|
||||
if ifi == nil {
|
||||
return nil
|
||||
}
|
25
vendor/golang.org/x/net/ipv4/sys_asmreq_stub.go
generated
vendored
Normal file
25
vendor/golang.org/x/net/ipv4/sys_asmreq_stub.go
generated
vendored
Normal file
@ -0,0 +1,25 @@
|
||||
// Copyright 2017 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.
|
||||
|
||||
// +build !darwin,!dragonfly,!freebsd,!netbsd,!openbsd,!solaris,!windows
|
||||
|
||||
package ipv4
|
||||
|
||||
import (
|
||||
"net"
|
||||
|
||||
"golang.org/x/net/internal/socket"
|
||||
)
|
||||
|
||||
func (so *sockOpt) setIPMreq(c *socket.Conn, ifi *net.Interface, grp net.IP) error {
|
||||
return errOpNoSupport
|
||||
}
|
||||
|
||||
func (so *sockOpt) getMulticastIf(c *socket.Conn) (*net.Interface, error) {
|
||||
return nil, errOpNoSupport
|
||||
}
|
||||
|
||||
func (so *sockOpt) setMulticastIf(c *socket.Conn, ifi *net.Interface) error {
|
||||
return errOpNoSupport
|
||||
}
|
@ -8,18 +8,17 @@ package ipv4
|
||||
|
||||
import (
|
||||
"net"
|
||||
"os"
|
||||
"unsafe"
|
||||
|
||||
"golang.org/x/net/internal/iana"
|
||||
"golang.org/x/net/internal/socket"
|
||||
)
|
||||
|
||||
func getsockoptIPMreqn(fd, name int) (*net.Interface, error) {
|
||||
var mreqn sysIPMreqn
|
||||
l := uint32(sysSizeofIPMreqn)
|
||||
if err := getsockopt(fd, iana.ProtocolIP, name, unsafe.Pointer(&mreqn), &l); err != nil {
|
||||
return nil, os.NewSyscallError("getsockopt", err)
|
||||
func (so *sockOpt) getIPMreqn(c *socket.Conn) (*net.Interface, error) {
|
||||
b := make([]byte, so.Len)
|
||||
if _, err := so.Get(c, b); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
mreqn := (*ipMreqn)(unsafe.Pointer(&b[0]))
|
||||
if mreqn.Ifindex == 0 {
|
||||
return nil, nil
|
||||
}
|
||||
@ -30,13 +29,14 @@ func getsockoptIPMreqn(fd, name int) (*net.Interface, error) {
|
||||
return ifi, nil
|
||||
}
|
||||
|
||||
func setsockoptIPMreqn(fd, name int, ifi *net.Interface, grp net.IP) error {
|
||||
var mreqn sysIPMreqn
|
||||
func (so *sockOpt) setIPMreqn(c *socket.Conn, ifi *net.Interface, grp net.IP) error {
|
||||
var mreqn ipMreqn
|
||||
if ifi != nil {
|
||||
mreqn.Ifindex = int32(ifi.Index)
|
||||
}
|
||||
if grp != nil {
|
||||
mreqn.Multiaddr = [4]byte{grp[0], grp[1], grp[2], grp[3]}
|
||||
}
|
||||
return os.NewSyscallError("setsockopt", setsockopt(fd, iana.ProtocolIP, name, unsafe.Pointer(&mreqn), sysSizeofIPMreqn))
|
||||
b := (*[sizeofIPMreqn]byte)(unsafe.Pointer(&mreqn))[:sizeofIPMreqn]
|
||||
return so.Set(c, b)
|
||||
}
|
21
vendor/golang.org/x/net/ipv4/sys_asmreqn_stub.go
generated
vendored
Normal file
21
vendor/golang.org/x/net/ipv4/sys_asmreqn_stub.go
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
// 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.
|
||||
|
||||
// +build !darwin,!freebsd,!linux
|
||||
|
||||
package ipv4
|
||||
|
||||
import (
|
||||
"net"
|
||||
|
||||
"golang.org/x/net/internal/socket"
|
||||
)
|
||||
|
||||
func (so *sockOpt) getIPMreqn(c *socket.Conn) (*net.Interface, error) {
|
||||
return nil, errOpNoSupport
|
||||
}
|
||||
|
||||
func (so *sockOpt) setIPMreqn(c *socket.Conn, ifi *net.Interface, grp net.IP) error {
|
||||
return errOpNoSupport
|
||||
}
|
23
vendor/golang.org/x/net/ipv4/sys_bpf.go
generated
vendored
Normal file
23
vendor/golang.org/x/net/ipv4/sys_bpf.go
generated
vendored
Normal file
@ -0,0 +1,23 @@
|
||||
// Copyright 2017 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.
|
||||
|
||||
// +build linux
|
||||
|
||||
package ipv4
|
||||
|
||||
import (
|
||||
"unsafe"
|
||||
|
||||
"golang.org/x/net/bpf"
|
||||
"golang.org/x/net/internal/socket"
|
||||
)
|
||||
|
||||
func (so *sockOpt) setAttachFilter(c *socket.Conn, f []bpf.RawInstruction) error {
|
||||
prog := sockFProg{
|
||||
Len: uint16(len(f)),
|
||||
Filter: (*sockFilter)(unsafe.Pointer(&f[0])),
|
||||
}
|
||||
b := (*[sizeofSockFprog]byte)(unsafe.Pointer(&prog))[:sizeofSockFprog]
|
||||
return so.Set(c, b)
|
||||
}
|
16
vendor/golang.org/x/net/ipv4/sys_bpf_stub.go
generated
vendored
Normal file
16
vendor/golang.org/x/net/ipv4/sys_bpf_stub.go
generated
vendored
Normal file
@ -0,0 +1,16 @@
|
||||
// Copyright 2017 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.
|
||||
|
||||
// +build !linux
|
||||
|
||||
package ipv4
|
||||
|
||||
import (
|
||||
"golang.org/x/net/bpf"
|
||||
"golang.org/x/net/internal/socket"
|
||||
)
|
||||
|
||||
func (so *sockOpt) setAttachFilter(c *socket.Conn, f []bpf.RawInstruction) error {
|
||||
return errOpNoSupport
|
||||
}
|
29
vendor/golang.org/x/net/ipv4/sys_bsd.go
generated
vendored
29
vendor/golang.org/x/net/ipv4/sys_bsd.go
generated
vendored
@ -2,13 +2,16 @@
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// +build dragonfly netbsd
|
||||
// +build netbsd openbsd
|
||||
|
||||
package ipv4
|
||||
|
||||
import (
|
||||
"net"
|
||||
"syscall"
|
||||
|
||||
"golang.org/x/net/internal/iana"
|
||||
"golang.org/x/net/internal/socket"
|
||||
)
|
||||
|
||||
var (
|
||||
@ -18,17 +21,17 @@ var (
|
||||
ctlInterface: {sysIP_RECVIF, syscall.SizeofSockaddrDatalink, marshalInterface, parseInterface},
|
||||
}
|
||||
|
||||
sockOpts = [ssoMax]sockOpt{
|
||||
ssoTOS: {sysIP_TOS, ssoTypeInt},
|
||||
ssoTTL: {sysIP_TTL, ssoTypeInt},
|
||||
ssoMulticastTTL: {sysIP_MULTICAST_TTL, ssoTypeByte},
|
||||
ssoMulticastInterface: {sysIP_MULTICAST_IF, ssoTypeInterface},
|
||||
ssoMulticastLoopback: {sysIP_MULTICAST_LOOP, ssoTypeInt},
|
||||
ssoReceiveTTL: {sysIP_RECVTTL, ssoTypeInt},
|
||||
ssoReceiveDst: {sysIP_RECVDSTADDR, ssoTypeInt},
|
||||
ssoReceiveInterface: {sysIP_RECVIF, ssoTypeInt},
|
||||
ssoHeaderPrepend: {sysIP_HDRINCL, ssoTypeInt},
|
||||
ssoJoinGroup: {sysIP_ADD_MEMBERSHIP, ssoTypeIPMreq},
|
||||
ssoLeaveGroup: {sysIP_DROP_MEMBERSHIP, ssoTypeIPMreq},
|
||||
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: 1}},
|
||||
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: 1}},
|
||||
ssoReceiveTTL: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_RECVTTL, Len: 4}},
|
||||
ssoReceiveDst: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_RECVDSTADDR, Len: 4}},
|
||||
ssoReceiveInterface: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_RECVIF, 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},
|
||||
}
|
||||
)
|
||||
|
97
vendor/golang.org/x/net/ipv4/sys_darwin.go
generated
vendored
97
vendor/golang.org/x/net/ipv4/sys_darwin.go
generated
vendored
@ -6,8 +6,13 @@ package ipv4
|
||||
|
||||
import (
|
||||
"net"
|
||||
"strconv"
|
||||
"strings"
|
||||
"syscall"
|
||||
"unsafe"
|
||||
|
||||
"golang.org/x/net/internal/iana"
|
||||
"golang.org/x/net/internal/socket"
|
||||
)
|
||||
|
||||
var (
|
||||
@ -17,80 +22,72 @@ var (
|
||||
ctlInterface: {sysIP_RECVIF, syscall.SizeofSockaddrDatalink, marshalInterface, parseInterface},
|
||||
}
|
||||
|
||||
sockOpts = [ssoMax]sockOpt{
|
||||
ssoTOS: {sysIP_TOS, ssoTypeInt},
|
||||
ssoTTL: {sysIP_TTL, ssoTypeInt},
|
||||
ssoMulticastTTL: {sysIP_MULTICAST_TTL, ssoTypeByte},
|
||||
ssoMulticastInterface: {sysIP_MULTICAST_IF, ssoTypeInterface},
|
||||
ssoMulticastLoopback: {sysIP_MULTICAST_LOOP, ssoTypeInt},
|
||||
ssoReceiveTTL: {sysIP_RECVTTL, ssoTypeInt},
|
||||
ssoReceiveDst: {sysIP_RECVDSTADDR, ssoTypeInt},
|
||||
ssoReceiveInterface: {sysIP_RECVIF, ssoTypeInt},
|
||||
ssoHeaderPrepend: {sysIP_HDRINCL, ssoTypeInt},
|
||||
ssoStripHeader: {sysIP_STRIPHDR, ssoTypeInt},
|
||||
ssoJoinGroup: {sysIP_ADD_MEMBERSHIP, ssoTypeIPMreq},
|
||||
ssoLeaveGroup: {sysIP_DROP_MEMBERSHIP, ssoTypeIPMreq},
|
||||
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: 1}},
|
||||
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}},
|
||||
ssoReceiveTTL: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_RECVTTL, Len: 4}},
|
||||
ssoReceiveDst: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_RECVDSTADDR, Len: 4}},
|
||||
ssoReceiveInterface: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_RECVIF, Len: 4}},
|
||||
ssoHeaderPrepend: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_HDRINCL, Len: 4}},
|
||||
ssoStripHeader: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_STRIPHDR, 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 init() {
|
||||
// Seems like kern.osreldate is veiled on latest OS X. We use
|
||||
// kern.osrelease instead.
|
||||
osver, err := syscall.Sysctl("kern.osrelease")
|
||||
s, err := syscall.Sysctl("kern.osrelease")
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
var i int
|
||||
for i = range osver {
|
||||
if osver[i] == '.' {
|
||||
break
|
||||
}
|
||||
ss := strings.Split(s, ".")
|
||||
if len(ss) == 0 {
|
||||
return
|
||||
}
|
||||
// The IP_PKTINFO and protocol-independent multicast API were
|
||||
// introduced in OS X 10.7 (Darwin 11.0.0). But it looks like
|
||||
// those features require OS X 10.8 (Darwin 12.0.0) and above.
|
||||
// introduced in OS X 10.7 (Darwin 11). But it looks like
|
||||
// those features require OS X 10.8 (Darwin 12) or above.
|
||||
// See http://support.apple.com/kb/HT1633.
|
||||
if i > 2 || i == 2 && osver[0] >= '1' && osver[1] >= '2' {
|
||||
ctlOpts[ctlPacketInfo].name = sysIP_PKTINFO
|
||||
ctlOpts[ctlPacketInfo].length = sysSizeofInetPktinfo
|
||||
ctlOpts[ctlPacketInfo].marshal = marshalPacketInfo
|
||||
ctlOpts[ctlPacketInfo].parse = parsePacketInfo
|
||||
sockOpts[ssoPacketInfo].name = sysIP_RECVPKTINFO
|
||||
sockOpts[ssoPacketInfo].typ = ssoTypeInt
|
||||
sockOpts[ssoMulticastInterface].typ = ssoTypeIPMreqn
|
||||
sockOpts[ssoJoinGroup].name = sysMCAST_JOIN_GROUP
|
||||
sockOpts[ssoJoinGroup].typ = ssoTypeGroupReq
|
||||
sockOpts[ssoLeaveGroup].name = sysMCAST_LEAVE_GROUP
|
||||
sockOpts[ssoLeaveGroup].typ = ssoTypeGroupReq
|
||||
sockOpts[ssoJoinSourceGroup].name = sysMCAST_JOIN_SOURCE_GROUP
|
||||
sockOpts[ssoJoinSourceGroup].typ = ssoTypeGroupSourceReq
|
||||
sockOpts[ssoLeaveSourceGroup].name = sysMCAST_LEAVE_SOURCE_GROUP
|
||||
sockOpts[ssoLeaveSourceGroup].typ = ssoTypeGroupSourceReq
|
||||
sockOpts[ssoBlockSourceGroup].name = sysMCAST_BLOCK_SOURCE
|
||||
sockOpts[ssoBlockSourceGroup].typ = ssoTypeGroupSourceReq
|
||||
sockOpts[ssoUnblockSourceGroup].name = sysMCAST_UNBLOCK_SOURCE
|
||||
sockOpts[ssoUnblockSourceGroup].typ = ssoTypeGroupSourceReq
|
||||
if mjver, err := strconv.Atoi(ss[0]); err != nil || mjver < 12 {
|
||||
return
|
||||
}
|
||||
ctlOpts[ctlPacketInfo].name = sysIP_PKTINFO
|
||||
ctlOpts[ctlPacketInfo].length = sizeofInetPktinfo
|
||||
ctlOpts[ctlPacketInfo].marshal = marshalPacketInfo
|
||||
ctlOpts[ctlPacketInfo].parse = parsePacketInfo
|
||||
sockOpts[ssoPacketInfo] = &sockOpt{Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_RECVPKTINFO, Len: 4}}
|
||||
sockOpts[ssoMulticastInterface] = &sockOpt{Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_MULTICAST_IF, Len: sizeofIPMreqn}, typ: ssoTypeIPMreqn}
|
||||
sockOpts[ssoJoinGroup] = &sockOpt{Option: socket.Option{Level: iana.ProtocolIP, Name: sysMCAST_JOIN_GROUP, Len: sizeofGroupReq}, typ: ssoTypeGroupReq}
|
||||
sockOpts[ssoLeaveGroup] = &sockOpt{Option: socket.Option{Level: iana.ProtocolIP, Name: sysMCAST_LEAVE_GROUP, Len: sizeofGroupReq}, typ: ssoTypeGroupReq}
|
||||
sockOpts[ssoJoinSourceGroup] = &sockOpt{Option: socket.Option{Level: iana.ProtocolIP, Name: sysMCAST_JOIN_SOURCE_GROUP, Len: sizeofGroupSourceReq}, typ: ssoTypeGroupSourceReq}
|
||||
sockOpts[ssoLeaveSourceGroup] = &sockOpt{Option: socket.Option{Level: iana.ProtocolIP, Name: sysMCAST_LEAVE_SOURCE_GROUP, Len: sizeofGroupSourceReq}, typ: ssoTypeGroupSourceReq}
|
||||
sockOpts[ssoBlockSourceGroup] = &sockOpt{Option: socket.Option{Level: iana.ProtocolIP, Name: sysMCAST_BLOCK_SOURCE, Len: sizeofGroupSourceReq}, typ: ssoTypeGroupSourceReq}
|
||||
sockOpts[ssoUnblockSourceGroup] = &sockOpt{Option: socket.Option{Level: iana.ProtocolIP, Name: sysMCAST_UNBLOCK_SOURCE, Len: sizeofGroupSourceReq}, typ: ssoTypeGroupSourceReq}
|
||||
}
|
||||
|
||||
func (pi *sysInetPktinfo) setIfindex(i int) {
|
||||
func (pi *inetPktinfo) setIfindex(i int) {
|
||||
pi.Ifindex = uint32(i)
|
||||
}
|
||||
|
||||
func (gr *sysGroupReq) setGroup(grp net.IP) {
|
||||
sa := (*sysSockaddrInet)(unsafe.Pointer(&gr.Pad_cgo_0[0]))
|
||||
sa.Len = sysSizeofSockaddrInet
|
||||
func (gr *groupReq) setGroup(grp net.IP) {
|
||||
sa := (*sockaddrInet)(unsafe.Pointer(uintptr(unsafe.Pointer(gr)) + 4))
|
||||
sa.Len = sizeofSockaddrInet
|
||||
sa.Family = syscall.AF_INET
|
||||
copy(sa.Addr[:], grp)
|
||||
}
|
||||
|
||||
func (gsr *sysGroupSourceReq) setSourceGroup(grp, src net.IP) {
|
||||
sa := (*sysSockaddrInet)(unsafe.Pointer(&gsr.Pad_cgo_0[0]))
|
||||
sa.Len = sysSizeofSockaddrInet
|
||||
func (gsr *groupSourceReq) setSourceGroup(grp, src net.IP) {
|
||||
sa := (*sockaddrInet)(unsafe.Pointer(uintptr(unsafe.Pointer(gsr)) + 4))
|
||||
sa.Len = sizeofSockaddrInet
|
||||
sa.Family = syscall.AF_INET
|
||||
copy(sa.Addr[:], grp)
|
||||
sa = (*sysSockaddrInet)(unsafe.Pointer(&gsr.Pad_cgo_1[0]))
|
||||
sa.Len = sysSizeofSockaddrInet
|
||||
sa = (*sockaddrInet)(unsafe.Pointer(uintptr(unsafe.Pointer(gsr)) + 132))
|
||||
sa.Len = sizeofSockaddrInet
|
||||
sa.Family = syscall.AF_INET
|
||||
copy(sa.Addr[:], src)
|
||||
}
|
||||
|
35
vendor/golang.org/x/net/ipv4/sys_dragonfly.go
generated
vendored
Normal file
35
vendor/golang.org/x/net/ipv4/sys_dragonfly.go
generated
vendored
Normal file
@ -0,0 +1,35 @@
|
||||
// Copyright 2017 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 (
|
||||
"net"
|
||||
"syscall"
|
||||
|
||||
"golang.org/x/net/internal/iana"
|
||||
"golang.org/x/net/internal/socket"
|
||||
)
|
||||
|
||||
var (
|
||||
ctlOpts = [ctlMax]ctlOpt{
|
||||
ctlTTL: {sysIP_RECVTTL, 1, marshalTTL, parseTTL},
|
||||
ctlDst: {sysIP_RECVDSTADDR, net.IPv4len, marshalDst, parseDst},
|
||||
ctlInterface: {sysIP_RECVIF, syscall.SizeofSockaddrDatalink, marshalInterface, parseInterface},
|
||||
}
|
||||
|
||||
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: 1}},
|
||||
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}},
|
||||
ssoReceiveTTL: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_RECVTTL, Len: 4}},
|
||||
ssoReceiveDst: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_RECVDSTADDR, Len: 4}},
|
||||
ssoReceiveInterface: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_RECVIF, 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},
|
||||
}
|
||||
)
|
53
vendor/golang.org/x/net/ipv4/sys_freebsd.go
generated
vendored
53
vendor/golang.org/x/net/ipv4/sys_freebsd.go
generated
vendored
@ -10,6 +10,9 @@ import (
|
||||
"strings"
|
||||
"syscall"
|
||||
"unsafe"
|
||||
|
||||
"golang.org/x/net/internal/iana"
|
||||
"golang.org/x/net/internal/socket"
|
||||
)
|
||||
|
||||
var (
|
||||
@ -19,29 +22,29 @@ var (
|
||||
ctlInterface: {sysIP_RECVIF, syscall.SizeofSockaddrDatalink, marshalInterface, parseInterface},
|
||||
}
|
||||
|
||||
sockOpts = [ssoMax]sockOpt{
|
||||
ssoTOS: {sysIP_TOS, ssoTypeInt},
|
||||
ssoTTL: {sysIP_TTL, ssoTypeInt},
|
||||
ssoMulticastTTL: {sysIP_MULTICAST_TTL, ssoTypeByte},
|
||||
ssoMulticastInterface: {sysIP_MULTICAST_IF, ssoTypeInterface},
|
||||
ssoMulticastLoopback: {sysIP_MULTICAST_LOOP, ssoTypeInt},
|
||||
ssoReceiveTTL: {sysIP_RECVTTL, ssoTypeInt},
|
||||
ssoReceiveDst: {sysIP_RECVDSTADDR, ssoTypeInt},
|
||||
ssoReceiveInterface: {sysIP_RECVIF, ssoTypeInt},
|
||||
ssoHeaderPrepend: {sysIP_HDRINCL, ssoTypeInt},
|
||||
ssoJoinGroup: {sysMCAST_JOIN_GROUP, ssoTypeGroupReq},
|
||||
ssoLeaveGroup: {sysMCAST_LEAVE_GROUP, ssoTypeGroupReq},
|
||||
ssoJoinSourceGroup: {sysMCAST_JOIN_SOURCE_GROUP, ssoTypeGroupSourceReq},
|
||||
ssoLeaveSourceGroup: {sysMCAST_LEAVE_SOURCE_GROUP, ssoTypeGroupSourceReq},
|
||||
ssoBlockSourceGroup: {sysMCAST_BLOCK_SOURCE, ssoTypeGroupSourceReq},
|
||||
ssoUnblockSourceGroup: {sysMCAST_UNBLOCK_SOURCE, ssoTypeGroupSourceReq},
|
||||
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: 1}},
|
||||
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}},
|
||||
ssoReceiveTTL: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_RECVTTL, Len: 4}},
|
||||
ssoReceiveDst: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_RECVDSTADDR, Len: 4}},
|
||||
ssoReceiveInterface: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_RECVIF, Len: 4}},
|
||||
ssoHeaderPrepend: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_HDRINCL, Len: 4}},
|
||||
ssoJoinGroup: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysMCAST_JOIN_GROUP, Len: sizeofGroupReq}, typ: ssoTypeGroupReq},
|
||||
ssoLeaveGroup: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysMCAST_LEAVE_GROUP, Len: sizeofGroupReq}, typ: ssoTypeGroupReq},
|
||||
ssoJoinSourceGroup: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysMCAST_JOIN_SOURCE_GROUP, Len: sizeofGroupSourceReq}, typ: ssoTypeGroupSourceReq},
|
||||
ssoLeaveSourceGroup: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysMCAST_LEAVE_SOURCE_GROUP, Len: sizeofGroupSourceReq}, typ: ssoTypeGroupSourceReq},
|
||||
ssoBlockSourceGroup: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysMCAST_BLOCK_SOURCE, Len: sizeofGroupSourceReq}, typ: ssoTypeGroupSourceReq},
|
||||
ssoUnblockSourceGroup: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysMCAST_UNBLOCK_SOURCE, Len: sizeofGroupSourceReq}, typ: ssoTypeGroupSourceReq},
|
||||
}
|
||||
)
|
||||
|
||||
func init() {
|
||||
freebsdVersion, _ = syscall.SysctlUint32("kern.osreldate")
|
||||
if freebsdVersion >= 1000000 {
|
||||
sockOpts[ssoMulticastInterface].typ = ssoTypeIPMreqn
|
||||
sockOpts[ssoMulticastInterface] = &sockOpt{Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_MULTICAST_IF, Len: sizeofIPMreqn}, typ: ssoTypeIPMreqn}
|
||||
}
|
||||
if runtime.GOOS == "freebsd" && runtime.GOARCH == "386" {
|
||||
archs, _ := syscall.Sysctl("kern.supported_archs")
|
||||
@ -54,20 +57,20 @@ func init() {
|
||||
}
|
||||
}
|
||||
|
||||
func (gr *sysGroupReq) setGroup(grp net.IP) {
|
||||
sa := (*sysSockaddrInet)(unsafe.Pointer(&gr.Group))
|
||||
sa.Len = sysSizeofSockaddrInet
|
||||
func (gr *groupReq) setGroup(grp net.IP) {
|
||||
sa := (*sockaddrInet)(unsafe.Pointer(&gr.Group))
|
||||
sa.Len = sizeofSockaddrInet
|
||||
sa.Family = syscall.AF_INET
|
||||
copy(sa.Addr[:], grp)
|
||||
}
|
||||
|
||||
func (gsr *sysGroupSourceReq) setSourceGroup(grp, src net.IP) {
|
||||
sa := (*sysSockaddrInet)(unsafe.Pointer(&gsr.Group))
|
||||
sa.Len = sysSizeofSockaddrInet
|
||||
func (gsr *groupSourceReq) setSourceGroup(grp, src net.IP) {
|
||||
sa := (*sockaddrInet)(unsafe.Pointer(&gsr.Group))
|
||||
sa.Len = sizeofSockaddrInet
|
||||
sa.Family = syscall.AF_INET
|
||||
copy(sa.Addr[:], grp)
|
||||
sa = (*sysSockaddrInet)(unsafe.Pointer(&gsr.Source))
|
||||
sa.Len = sysSizeofSockaddrInet
|
||||
sa = (*sockaddrInet)(unsafe.Pointer(&gsr.Source))
|
||||
sa.Len = sizeofSockaddrInet
|
||||
sa.Family = syscall.AF_INET
|
||||
copy(sa.Addr[:], src)
|
||||
}
|
||||
|
50
vendor/golang.org/x/net/ipv4/sys_linux.go
generated
vendored
50
vendor/golang.org/x/net/ipv4/sys_linux.go
generated
vendored
@ -8,48 +8,52 @@ import (
|
||||
"net"
|
||||
"syscall"
|
||||
"unsafe"
|
||||
|
||||
"golang.org/x/net/internal/iana"
|
||||
"golang.org/x/net/internal/socket"
|
||||
)
|
||||
|
||||
var (
|
||||
ctlOpts = [ctlMax]ctlOpt{
|
||||
ctlTTL: {sysIP_TTL, 1, marshalTTL, parseTTL},
|
||||
ctlPacketInfo: {sysIP_PKTINFO, sysSizeofInetPktinfo, marshalPacketInfo, parsePacketInfo},
|
||||
ctlPacketInfo: {sysIP_PKTINFO, sizeofInetPktinfo, marshalPacketInfo, parsePacketInfo},
|
||||
}
|
||||
|
||||
sockOpts = [ssoMax]sockOpt{
|
||||
ssoTOS: {sysIP_TOS, ssoTypeInt},
|
||||
ssoTTL: {sysIP_TTL, ssoTypeInt},
|
||||
ssoMulticastTTL: {sysIP_MULTICAST_TTL, ssoTypeInt},
|
||||
ssoMulticastInterface: {sysIP_MULTICAST_IF, ssoTypeIPMreqn},
|
||||
ssoMulticastLoopback: {sysIP_MULTICAST_LOOP, ssoTypeInt},
|
||||
ssoReceiveTTL: {sysIP_RECVTTL, ssoTypeInt},
|
||||
ssoPacketInfo: {sysIP_PKTINFO, ssoTypeInt},
|
||||
ssoHeaderPrepend: {sysIP_HDRINCL, ssoTypeInt},
|
||||
ssoICMPFilter: {sysICMP_FILTER, ssoTypeICMPFilter},
|
||||
ssoJoinGroup: {sysMCAST_JOIN_GROUP, ssoTypeGroupReq},
|
||||
ssoLeaveGroup: {sysMCAST_LEAVE_GROUP, ssoTypeGroupReq},
|
||||
ssoJoinSourceGroup: {sysMCAST_JOIN_SOURCE_GROUP, ssoTypeGroupSourceReq},
|
||||
ssoLeaveSourceGroup: {sysMCAST_LEAVE_SOURCE_GROUP, ssoTypeGroupSourceReq},
|
||||
ssoBlockSourceGroup: {sysMCAST_BLOCK_SOURCE, ssoTypeGroupSourceReq},
|
||||
ssoUnblockSourceGroup: {sysMCAST_UNBLOCK_SOURCE, ssoTypeGroupSourceReq},
|
||||
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: sizeofIPMreqn}, typ: ssoTypeIPMreqn},
|
||||
ssoMulticastLoopback: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_MULTICAST_LOOP, Len: 4}},
|
||||
ssoReceiveTTL: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_RECVTTL, Len: 4}},
|
||||
ssoPacketInfo: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_PKTINFO, Len: 4}},
|
||||
ssoHeaderPrepend: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_HDRINCL, Len: 4}},
|
||||
ssoICMPFilter: {Option: socket.Option{Level: iana.ProtocolReserved, Name: sysICMP_FILTER, Len: sizeofICMPFilter}},
|
||||
ssoJoinGroup: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysMCAST_JOIN_GROUP, Len: sizeofGroupReq}, typ: ssoTypeGroupReq},
|
||||
ssoLeaveGroup: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysMCAST_LEAVE_GROUP, Len: sizeofGroupReq}, typ: ssoTypeGroupReq},
|
||||
ssoJoinSourceGroup: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysMCAST_JOIN_SOURCE_GROUP, Len: sizeofGroupSourceReq}, typ: ssoTypeGroupSourceReq},
|
||||
ssoLeaveSourceGroup: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysMCAST_LEAVE_SOURCE_GROUP, Len: sizeofGroupSourceReq}, typ: ssoTypeGroupSourceReq},
|
||||
ssoBlockSourceGroup: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysMCAST_BLOCK_SOURCE, Len: sizeofGroupSourceReq}, typ: ssoTypeGroupSourceReq},
|
||||
ssoUnblockSourceGroup: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysMCAST_UNBLOCK_SOURCE, Len: sizeofGroupSourceReq}, typ: ssoTypeGroupSourceReq},
|
||||
ssoAttachFilter: {Option: socket.Option{Level: sysSOL_SOCKET, Name: sysSO_ATTACH_FILTER, Len: sizeofSockFprog}},
|
||||
}
|
||||
)
|
||||
|
||||
func (pi *sysInetPktinfo) setIfindex(i int) {
|
||||
func (pi *inetPktinfo) setIfindex(i int) {
|
||||
pi.Ifindex = int32(i)
|
||||
}
|
||||
|
||||
func (gr *sysGroupReq) setGroup(grp net.IP) {
|
||||
sa := (*sysSockaddrInet)(unsafe.Pointer(&gr.Group))
|
||||
func (gr *groupReq) setGroup(grp net.IP) {
|
||||
sa := (*sockaddrInet)(unsafe.Pointer(&gr.Group))
|
||||
sa.Family = syscall.AF_INET
|
||||
copy(sa.Addr[:], grp)
|
||||
}
|
||||
|
||||
func (gsr *sysGroupSourceReq) setSourceGroup(grp, src net.IP) {
|
||||
sa := (*sysSockaddrInet)(unsafe.Pointer(&gsr.Group))
|
||||
func (gsr *groupSourceReq) setSourceGroup(grp, src net.IP) {
|
||||
sa := (*sockaddrInet)(unsafe.Pointer(&gsr.Group))
|
||||
sa.Family = syscall.AF_INET
|
||||
copy(sa.Addr[:], grp)
|
||||
sa = (*sysSockaddrInet)(unsafe.Pointer(&gsr.Source))
|
||||
sa = (*sockaddrInet)(unsafe.Pointer(&gsr.Source))
|
||||
sa.Family = syscall.AF_INET
|
||||
copy(sa.Addr[:], src)
|
||||
}
|
||||
|
32
vendor/golang.org/x/net/ipv4/sys_openbsd.go
generated
vendored
32
vendor/golang.org/x/net/ipv4/sys_openbsd.go
generated
vendored
@ -1,32 +0,0 @@
|
||||
// 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 (
|
||||
"net"
|
||||
"syscall"
|
||||
)
|
||||
|
||||
var (
|
||||
ctlOpts = [ctlMax]ctlOpt{
|
||||
ctlTTL: {sysIP_RECVTTL, 1, marshalTTL, parseTTL},
|
||||
ctlDst: {sysIP_RECVDSTADDR, net.IPv4len, marshalDst, parseDst},
|
||||
ctlInterface: {sysIP_RECVIF, syscall.SizeofSockaddrDatalink, marshalInterface, parseInterface},
|
||||
}
|
||||
|
||||
sockOpts = [ssoMax]sockOpt{
|
||||
ssoTOS: {sysIP_TOS, ssoTypeInt},
|
||||
ssoTTL: {sysIP_TTL, ssoTypeInt},
|
||||
ssoMulticastTTL: {sysIP_MULTICAST_TTL, ssoTypeByte},
|
||||
ssoMulticastInterface: {sysIP_MULTICAST_IF, ssoTypeInterface},
|
||||
ssoMulticastLoopback: {sysIP_MULTICAST_LOOP, ssoTypeByte},
|
||||
ssoReceiveTTL: {sysIP_RECVTTL, ssoTypeInt},
|
||||
ssoReceiveDst: {sysIP_RECVDSTADDR, ssoTypeInt},
|
||||
ssoReceiveInterface: {sysIP_RECVIF, ssoTypeInt},
|
||||
ssoHeaderPrepend: {sysIP_HDRINCL, ssoTypeInt},
|
||||
ssoJoinGroup: {sysIP_ADD_MEMBERSHIP, ssoTypeIPMreq},
|
||||
ssoLeaveGroup: {sysIP_DROP_MEMBERSHIP, ssoTypeIPMreq},
|
||||
}
|
||||
)
|
57
vendor/golang.org/x/net/ipv4/sys_solaris.go
generated
vendored
Normal file
57
vendor/golang.org/x/net/ipv4/sys_solaris.go
generated
vendored
Normal file
@ -0,0 +1,57 @@
|
||||
// Copyright 2016 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 (
|
||||
"net"
|
||||
"syscall"
|
||||
"unsafe"
|
||||
|
||||
"golang.org/x/net/internal/iana"
|
||||
"golang.org/x/net/internal/socket"
|
||||
)
|
||||
|
||||
var (
|
||||
ctlOpts = [ctlMax]ctlOpt{
|
||||
ctlTTL: {sysIP_RECVTTL, 4, marshalTTL, parseTTL},
|
||||
ctlPacketInfo: {sysIP_PKTINFO, sizeofInetPktinfo, marshalPacketInfo, parsePacketInfo},
|
||||
}
|
||||
|
||||
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: 1}},
|
||||
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: 1}},
|
||||
ssoReceiveTTL: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_RECVTTL, Len: 4}},
|
||||
ssoPacketInfo: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_RECVPKTINFO, Len: 4}},
|
||||
ssoHeaderPrepend: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_HDRINCL, Len: 4}},
|
||||
ssoJoinGroup: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysMCAST_JOIN_GROUP, Len: sizeofGroupReq}, typ: ssoTypeGroupReq},
|
||||
ssoLeaveGroup: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysMCAST_LEAVE_GROUP, Len: sizeofGroupReq}, typ: ssoTypeGroupReq},
|
||||
ssoJoinSourceGroup: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysMCAST_JOIN_SOURCE_GROUP, Len: sizeofGroupSourceReq}, typ: ssoTypeGroupSourceReq},
|
||||
ssoLeaveSourceGroup: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysMCAST_LEAVE_SOURCE_GROUP, Len: sizeofGroupSourceReq}, typ: ssoTypeGroupSourceReq},
|
||||
ssoBlockSourceGroup: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysMCAST_BLOCK_SOURCE, Len: sizeofGroupSourceReq}, typ: ssoTypeGroupSourceReq},
|
||||
ssoUnblockSourceGroup: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysMCAST_UNBLOCK_SOURCE, Len: sizeofGroupSourceReq}, typ: ssoTypeGroupSourceReq},
|
||||
}
|
||||
)
|
||||
|
||||
func (pi *inetPktinfo) setIfindex(i int) {
|
||||
pi.Ifindex = uint32(i)
|
||||
}
|
||||
|
||||
func (gr *groupReq) setGroup(grp net.IP) {
|
||||
sa := (*sockaddrInet)(unsafe.Pointer(uintptr(unsafe.Pointer(gr)) + 4))
|
||||
sa.Family = syscall.AF_INET
|
||||
copy(sa.Addr[:], grp)
|
||||
}
|
||||
|
||||
func (gsr *groupSourceReq) setSourceGroup(grp, src net.IP) {
|
||||
sa := (*sockaddrInet)(unsafe.Pointer(uintptr(unsafe.Pointer(gsr)) + 4))
|
||||
sa.Family = syscall.AF_INET
|
||||
copy(sa.Addr[:], grp)
|
||||
sa = (*sockaddrInet)(unsafe.Pointer(uintptr(unsafe.Pointer(gsr)) + 260))
|
||||
sa.Family = syscall.AF_INET
|
||||
copy(sa.Addr[:], src)
|
||||
}
|
54
vendor/golang.org/x/net/ipv4/sys_ssmreq.go
generated
vendored
Normal file
54
vendor/golang.org/x/net/ipv4/sys_ssmreq.go
generated
vendored
Normal file
@ -0,0 +1,54 @@
|
||||
// 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.
|
||||
|
||||
// +build darwin freebsd linux solaris
|
||||
|
||||
package ipv4
|
||||
|
||||
import (
|
||||
"net"
|
||||
"unsafe"
|
||||
|
||||
"golang.org/x/net/internal/socket"
|
||||
)
|
||||
|
||||
var freebsd32o64 bool
|
||||
|
||||
func (so *sockOpt) setGroupReq(c *socket.Conn, ifi *net.Interface, grp net.IP) error {
|
||||
var gr groupReq
|
||||
if ifi != nil {
|
||||
gr.Interface = uint32(ifi.Index)
|
||||
}
|
||||
gr.setGroup(grp)
|
||||
var b []byte
|
||||
if freebsd32o64 {
|
||||
var d [sizeofGroupReq + 4]byte
|
||||
s := (*[sizeofGroupReq]byte)(unsafe.Pointer(&gr))
|
||||
copy(d[:4], s[:4])
|
||||
copy(d[8:], s[4:])
|
||||
b = d[:]
|
||||
} else {
|
||||
b = (*[sizeofGroupReq]byte)(unsafe.Pointer(&gr))[:sizeofGroupReq]
|
||||
}
|
||||
return so.Set(c, b)
|
||||
}
|
||||
|
||||
func (so *sockOpt) setGroupSourceReq(c *socket.Conn, ifi *net.Interface, grp, src net.IP) error {
|
||||
var gsr groupSourceReq
|
||||
if ifi != nil {
|
||||
gsr.Interface = uint32(ifi.Index)
|
||||
}
|
||||
gsr.setSourceGroup(grp, src)
|
||||
var b []byte
|
||||
if freebsd32o64 {
|
||||
var d [sizeofGroupSourceReq + 4]byte
|
||||
s := (*[sizeofGroupSourceReq]byte)(unsafe.Pointer(&gsr))
|
||||
copy(d[:4], s[:4])
|
||||
copy(d[8:], s[4:])
|
||||
b = d[:]
|
||||
} else {
|
||||
b = (*[sizeofGroupSourceReq]byte)(unsafe.Pointer(&gsr))[:sizeofGroupSourceReq]
|
||||
}
|
||||
return so.Set(c, b)
|
||||
}
|
21
vendor/golang.org/x/net/ipv4/sys_ssmreq_stub.go
generated
vendored
Normal file
21
vendor/golang.org/x/net/ipv4/sys_ssmreq_stub.go
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
// 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.
|
||||
|
||||
// +build !darwin,!freebsd,!linux,!solaris
|
||||
|
||||
package ipv4
|
||||
|
||||
import (
|
||||
"net"
|
||||
|
||||
"golang.org/x/net/internal/socket"
|
||||
)
|
||||
|
||||
func (so *sockOpt) setGroupReq(c *socket.Conn, ifi *net.Interface, grp net.IP) error {
|
||||
return errOpNoSupport
|
||||
}
|
||||
|
||||
func (so *sockOpt) setGroupSourceReq(c *socket.Conn, ifi *net.Interface, grp, src net.IP) error {
|
||||
return errOpNoSupport
|
||||
}
|
4
vendor/golang.org/x/net/ipv4/sys_stub.go
generated
vendored
4
vendor/golang.org/x/net/ipv4/sys_stub.go
generated
vendored
@ -2,12 +2,12 @@
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// +build nacl plan9 solaris
|
||||
// +build !darwin,!dragonfly,!freebsd,!linux,!netbsd,!openbsd,!solaris,!windows
|
||||
|
||||
package ipv4
|
||||
|
||||
var (
|
||||
ctlOpts = [ctlMax]ctlOpt{}
|
||||
|
||||
sockOpts = [ssoMax]sockOpt{}
|
||||
sockOpts = map[int]*sockOpt{}
|
||||
)
|
||||
|
36
vendor/golang.org/x/net/ipv4/sys_windows.go
generated
vendored
36
vendor/golang.org/x/net/ipv4/sys_windows.go
generated
vendored
@ -4,6 +4,11 @@
|
||||
|
||||
package ipv4
|
||||
|
||||
import (
|
||||
"golang.org/x/net/internal/iana"
|
||||
"golang.org/x/net/internal/socket"
|
||||
)
|
||||
|
||||
const (
|
||||
// See ws2tcpip.h.
|
||||
sysIP_OPTIONS = 0x1
|
||||
@ -20,22 +25,22 @@ const (
|
||||
sysIP_DROP_SOURCE_MEMBERSHIP = 0x10
|
||||
sysIP_PKTINFO = 0x13
|
||||
|
||||
sysSizeofInetPktinfo = 0x8
|
||||
sysSizeofIPMreq = 0x8
|
||||
sysSizeofIPMreqSource = 0xc
|
||||
sizeofInetPktinfo = 0x8
|
||||
sizeofIPMreq = 0x8
|
||||
sizeofIPMreqSource = 0xc
|
||||
)
|
||||
|
||||
type sysInetPktinfo struct {
|
||||
type inetPktinfo struct {
|
||||
Addr [4]byte
|
||||
Ifindex int32
|
||||
}
|
||||
|
||||
type sysIPMreq struct {
|
||||
type ipMreq struct {
|
||||
Multiaddr [4]byte
|
||||
Interface [4]byte
|
||||
}
|
||||
|
||||
type sysIPMreqSource struct {
|
||||
type ipMreqSource struct {
|
||||
Multiaddr [4]byte
|
||||
Sourceaddr [4]byte
|
||||
Interface [4]byte
|
||||
@ -45,17 +50,18 @@ type sysIPMreqSource struct {
|
||||
var (
|
||||
ctlOpts = [ctlMax]ctlOpt{}
|
||||
|
||||
sockOpts = [ssoMax]sockOpt{
|
||||
ssoTOS: {sysIP_TOS, ssoTypeInt},
|
||||
ssoTTL: {sysIP_TTL, ssoTypeInt},
|
||||
ssoMulticastTTL: {sysIP_MULTICAST_TTL, ssoTypeInt},
|
||||
ssoMulticastInterface: {sysIP_MULTICAST_IF, ssoTypeInterface},
|
||||
ssoMulticastLoopback: {sysIP_MULTICAST_LOOP, ssoTypeInt},
|
||||
ssoJoinGroup: {sysIP_ADD_MEMBERSHIP, ssoTypeIPMreq},
|
||||
ssoLeaveGroup: {sysIP_DROP_MEMBERSHIP, ssoTypeIPMreq},
|
||||
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 *sysInetPktinfo) setIfindex(i int) {
|
||||
func (pi *inetPktinfo) setIfindex(i int) {
|
||||
pi.Ifindex = int32(i)
|
||||
}
|
||||
|
31
vendor/golang.org/x/net/ipv4/syscall_linux_386.go
generated
vendored
31
vendor/golang.org/x/net/ipv4/syscall_linux_386.go
generated
vendored
@ -1,31 +0,0 @@
|
||||
// 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 (
|
||||
"syscall"
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
const (
|
||||
sysGETSOCKOPT = 0xf
|
||||
sysSETSOCKOPT = 0xe
|
||||
)
|
||||
|
||||
func socketcall(call int, a0, a1, a2, a3, a4, a5 uintptr) (int, syscall.Errno)
|
||||
|
||||
func getsockopt(fd, level, name int, v unsafe.Pointer, l *uint32) error {
|
||||
if _, errno := socketcall(sysGETSOCKOPT, uintptr(fd), uintptr(level), uintptr(name), uintptr(v), uintptr(unsafe.Pointer(l)), 0); errno != 0 {
|
||||
return error(errno)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func setsockopt(fd, level, name int, v unsafe.Pointer, l uint32) error {
|
||||
if _, errno := socketcall(sysSETSOCKOPT, uintptr(fd), uintptr(level), uintptr(name), uintptr(v), uintptr(l), 0); errno != 0 {
|
||||
return error(errno)
|
||||
}
|
||||
return nil
|
||||
}
|
26
vendor/golang.org/x/net/ipv4/syscall_unix.go
generated
vendored
26
vendor/golang.org/x/net/ipv4/syscall_unix.go
generated
vendored
@ -1,26 +0,0 @@
|
||||
// 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.
|
||||
|
||||
// +build darwin dragonfly freebsd linux,!386 netbsd openbsd
|
||||
|
||||
package ipv4
|
||||
|
||||
import (
|
||||
"syscall"
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
func getsockopt(fd, level, name int, v unsafe.Pointer, l *uint32) error {
|
||||
if _, _, errno := syscall.Syscall6(syscall.SYS_GETSOCKOPT, uintptr(fd), uintptr(level), uintptr(name), uintptr(v), uintptr(unsafe.Pointer(l)), 0); errno != 0 {
|
||||
return error(errno)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func setsockopt(fd, level, name int, v unsafe.Pointer, l uint32) error {
|
||||
if _, _, errno := syscall.Syscall6(syscall.SYS_SETSOCKOPT, uintptr(fd), uintptr(level), uintptr(name), uintptr(v), uintptr(l), 0); errno != 0 {
|
||||
return error(errno)
|
||||
}
|
||||
return nil
|
||||
}
|
8
vendor/golang.org/x/net/ipv4/thunk_linux_386.s
generated
vendored
8
vendor/golang.org/x/net/ipv4/thunk_linux_386.s
generated
vendored
@ -1,8 +0,0 @@
|
||||
// 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.
|
||||
|
||||
// +build go1.2
|
||||
|
||||
TEXT ·socketcall(SB),4,$0-36
|
||||
JMP syscall·socketcall(SB)
|
32
vendor/golang.org/x/net/ipv4/zsys_darwin.go
generated
vendored
32
vendor/golang.org/x/net/ipv4/zsys_darwin.go
generated
vendored
@ -37,18 +37,18 @@ const (
|
||||
sysMCAST_BLOCK_SOURCE = 0x54
|
||||
sysMCAST_UNBLOCK_SOURCE = 0x55
|
||||
|
||||
sysSizeofSockaddrStorage = 0x80
|
||||
sysSizeofSockaddrInet = 0x10
|
||||
sysSizeofInetPktinfo = 0xc
|
||||
sizeofSockaddrStorage = 0x80
|
||||
sizeofSockaddrInet = 0x10
|
||||
sizeofInetPktinfo = 0xc
|
||||
|
||||
sysSizeofIPMreq = 0x8
|
||||
sysSizeofIPMreqn = 0xc
|
||||
sysSizeofIPMreqSource = 0xc
|
||||
sysSizeofGroupReq = 0x84
|
||||
sysSizeofGroupSourceReq = 0x104
|
||||
sizeofIPMreq = 0x8
|
||||
sizeofIPMreqn = 0xc
|
||||
sizeofIPMreqSource = 0xc
|
||||
sizeofGroupReq = 0x84
|
||||
sizeofGroupSourceReq = 0x104
|
||||
)
|
||||
|
||||
type sysSockaddrStorage struct {
|
||||
type sockaddrStorage struct {
|
||||
Len uint8
|
||||
Family uint8
|
||||
X__ss_pad1 [6]int8
|
||||
@ -56,7 +56,7 @@ type sysSockaddrStorage struct {
|
||||
X__ss_pad2 [112]int8
|
||||
}
|
||||
|
||||
type sysSockaddrInet struct {
|
||||
type sockaddrInet struct {
|
||||
Len uint8
|
||||
Family uint8
|
||||
Port uint16
|
||||
@ -64,35 +64,35 @@ type sysSockaddrInet struct {
|
||||
Zero [8]int8
|
||||
}
|
||||
|
||||
type sysInetPktinfo struct {
|
||||
type inetPktinfo struct {
|
||||
Ifindex uint32
|
||||
Spec_dst [4]byte /* in_addr */
|
||||
Addr [4]byte /* in_addr */
|
||||
}
|
||||
|
||||
type sysIPMreq struct {
|
||||
type ipMreq struct {
|
||||
Multiaddr [4]byte /* in_addr */
|
||||
Interface [4]byte /* in_addr */
|
||||
}
|
||||
|
||||
type sysIPMreqn struct {
|
||||
type ipMreqn struct {
|
||||
Multiaddr [4]byte /* in_addr */
|
||||
Address [4]byte /* in_addr */
|
||||
Ifindex int32
|
||||
}
|
||||
|
||||
type sysIPMreqSource struct {
|
||||
type ipMreqSource struct {
|
||||
Multiaddr [4]byte /* in_addr */
|
||||
Sourceaddr [4]byte /* in_addr */
|
||||
Interface [4]byte /* in_addr */
|
||||
}
|
||||
|
||||
type sysGroupReq struct {
|
||||
type groupReq struct {
|
||||
Interface uint32
|
||||
Pad_cgo_0 [128]byte
|
||||
}
|
||||
|
||||
type sysGroupSourceReq struct {
|
||||
type groupSourceReq struct {
|
||||
Interface uint32
|
||||
Pad_cgo_0 [128]byte
|
||||
Pad_cgo_1 [128]byte
|
||||
|
6
vendor/golang.org/x/net/ipv4/zsys_dragonfly.go
generated
vendored
6
vendor/golang.org/x/net/ipv4/zsys_dragonfly.go
generated
vendored
@ -1,8 +1,6 @@
|
||||
// Created by cgo -godefs - DO NOT EDIT
|
||||
// cgo -godefs defs_dragonfly.go
|
||||
|
||||
// +build dragonfly
|
||||
|
||||
package ipv4
|
||||
|
||||
const (
|
||||
@ -24,10 +22,10 @@ const (
|
||||
sysIP_ADD_MEMBERSHIP = 0xc
|
||||
sysIP_DROP_MEMBERSHIP = 0xd
|
||||
|
||||
sysSizeofIPMreq = 0x8
|
||||
sizeofIPMreq = 0x8
|
||||
)
|
||||
|
||||
type sysIPMreq struct {
|
||||
type ipMreq struct {
|
||||
Multiaddr [4]byte /* in_addr */
|
||||
Interface [4]byte /* in_addr */
|
||||
}
|
||||
|
34
vendor/golang.org/x/net/ipv4/zsys_freebsd_386.go
generated
vendored
34
vendor/golang.org/x/net/ipv4/zsys_freebsd_386.go
generated
vendored
@ -38,17 +38,17 @@ const (
|
||||
sysMCAST_BLOCK_SOURCE = 0x54
|
||||
sysMCAST_UNBLOCK_SOURCE = 0x55
|
||||
|
||||
sysSizeofSockaddrStorage = 0x80
|
||||
sysSizeofSockaddrInet = 0x10
|
||||
sizeofSockaddrStorage = 0x80
|
||||
sizeofSockaddrInet = 0x10
|
||||
|
||||
sysSizeofIPMreq = 0x8
|
||||
sysSizeofIPMreqn = 0xc
|
||||
sysSizeofIPMreqSource = 0xc
|
||||
sysSizeofGroupReq = 0x84
|
||||
sysSizeofGroupSourceReq = 0x104
|
||||
sizeofIPMreq = 0x8
|
||||
sizeofIPMreqn = 0xc
|
||||
sizeofIPMreqSource = 0xc
|
||||
sizeofGroupReq = 0x84
|
||||
sizeofGroupSourceReq = 0x104
|
||||
)
|
||||
|
||||
type sysSockaddrStorage struct {
|
||||
type sockaddrStorage struct {
|
||||
Len uint8
|
||||
Family uint8
|
||||
X__ss_pad1 [6]int8
|
||||
@ -56,7 +56,7 @@ type sysSockaddrStorage struct {
|
||||
X__ss_pad2 [112]int8
|
||||
}
|
||||
|
||||
type sysSockaddrInet struct {
|
||||
type sockaddrInet struct {
|
||||
Len uint8
|
||||
Family uint8
|
||||
Port uint16
|
||||
@ -64,30 +64,30 @@ type sysSockaddrInet struct {
|
||||
Zero [8]int8
|
||||
}
|
||||
|
||||
type sysIPMreq struct {
|
||||
type ipMreq struct {
|
||||
Multiaddr [4]byte /* in_addr */
|
||||
Interface [4]byte /* in_addr */
|
||||
}
|
||||
|
||||
type sysIPMreqn struct {
|
||||
type ipMreqn struct {
|
||||
Multiaddr [4]byte /* in_addr */
|
||||
Address [4]byte /* in_addr */
|
||||
Ifindex int32
|
||||
}
|
||||
|
||||
type sysIPMreqSource struct {
|
||||
type ipMreqSource struct {
|
||||
Multiaddr [4]byte /* in_addr */
|
||||
Sourceaddr [4]byte /* in_addr */
|
||||
Interface [4]byte /* in_addr */
|
||||
}
|
||||
|
||||
type sysGroupReq struct {
|
||||
type groupReq struct {
|
||||
Interface uint32
|
||||
Group sysSockaddrStorage
|
||||
Group sockaddrStorage
|
||||
}
|
||||
|
||||
type sysGroupSourceReq struct {
|
||||
type groupSourceReq struct {
|
||||
Interface uint32
|
||||
Group sysSockaddrStorage
|
||||
Source sysSockaddrStorage
|
||||
Group sockaddrStorage
|
||||
Source sockaddrStorage
|
||||
}
|
||||
|
34
vendor/golang.org/x/net/ipv4/zsys_freebsd_amd64.go
generated
vendored
34
vendor/golang.org/x/net/ipv4/zsys_freebsd_amd64.go
generated
vendored
@ -38,17 +38,17 @@ const (
|
||||
sysMCAST_BLOCK_SOURCE = 0x54
|
||||
sysMCAST_UNBLOCK_SOURCE = 0x55
|
||||
|
||||
sysSizeofSockaddrStorage = 0x80
|
||||
sysSizeofSockaddrInet = 0x10
|
||||
sizeofSockaddrStorage = 0x80
|
||||
sizeofSockaddrInet = 0x10
|
||||
|
||||
sysSizeofIPMreq = 0x8
|
||||
sysSizeofIPMreqn = 0xc
|
||||
sysSizeofIPMreqSource = 0xc
|
||||
sysSizeofGroupReq = 0x88
|
||||
sysSizeofGroupSourceReq = 0x108
|
||||
sizeofIPMreq = 0x8
|
||||
sizeofIPMreqn = 0xc
|
||||
sizeofIPMreqSource = 0xc
|
||||
sizeofGroupReq = 0x88
|
||||
sizeofGroupSourceReq = 0x108
|
||||
)
|
||||
|
||||
type sysSockaddrStorage struct {
|
||||
type sockaddrStorage struct {
|
||||
Len uint8
|
||||
Family uint8
|
||||
X__ss_pad1 [6]int8
|
||||
@ -56,7 +56,7 @@ type sysSockaddrStorage struct {
|
||||
X__ss_pad2 [112]int8
|
||||
}
|
||||
|
||||
type sysSockaddrInet struct {
|
||||
type sockaddrInet struct {
|
||||
Len uint8
|
||||
Family uint8
|
||||
Port uint16
|
||||
@ -64,32 +64,32 @@ type sysSockaddrInet struct {
|
||||
Zero [8]int8
|
||||
}
|
||||
|
||||
type sysIPMreq struct {
|
||||
type ipMreq struct {
|
||||
Multiaddr [4]byte /* in_addr */
|
||||
Interface [4]byte /* in_addr */
|
||||
}
|
||||
|
||||
type sysIPMreqn struct {
|
||||
type ipMreqn struct {
|
||||
Multiaddr [4]byte /* in_addr */
|
||||
Address [4]byte /* in_addr */
|
||||
Ifindex int32
|
||||
}
|
||||
|
||||
type sysIPMreqSource struct {
|
||||
type ipMreqSource struct {
|
||||
Multiaddr [4]byte /* in_addr */
|
||||
Sourceaddr [4]byte /* in_addr */
|
||||
Interface [4]byte /* in_addr */
|
||||
}
|
||||
|
||||
type sysGroupReq struct {
|
||||
type groupReq struct {
|
||||
Interface uint32
|
||||
Pad_cgo_0 [4]byte
|
||||
Group sysSockaddrStorage
|
||||
Group sockaddrStorage
|
||||
}
|
||||
|
||||
type sysGroupSourceReq struct {
|
||||
type groupSourceReq struct {
|
||||
Interface uint32
|
||||
Pad_cgo_0 [4]byte
|
||||
Group sysSockaddrStorage
|
||||
Source sysSockaddrStorage
|
||||
Group sockaddrStorage
|
||||
Source sockaddrStorage
|
||||
}
|
||||
|
34
vendor/golang.org/x/net/ipv4/zsys_freebsd_arm.go
generated
vendored
34
vendor/golang.org/x/net/ipv4/zsys_freebsd_arm.go
generated
vendored
@ -38,17 +38,17 @@ const (
|
||||
sysMCAST_BLOCK_SOURCE = 0x54
|
||||
sysMCAST_UNBLOCK_SOURCE = 0x55
|
||||
|
||||
sysSizeofSockaddrStorage = 0x80
|
||||
sysSizeofSockaddrInet = 0x10
|
||||
sizeofSockaddrStorage = 0x80
|
||||
sizeofSockaddrInet = 0x10
|
||||
|
||||
sysSizeofIPMreq = 0x8
|
||||
sysSizeofIPMreqn = 0xc
|
||||
sysSizeofIPMreqSource = 0xc
|
||||
sysSizeofGroupReq = 0x88
|
||||
sysSizeofGroupSourceReq = 0x108
|
||||
sizeofIPMreq = 0x8
|
||||
sizeofIPMreqn = 0xc
|
||||
sizeofIPMreqSource = 0xc
|
||||
sizeofGroupReq = 0x88
|
||||
sizeofGroupSourceReq = 0x108
|
||||
)
|
||||
|
||||
type sysSockaddrStorage struct {
|
||||
type sockaddrStorage struct {
|
||||
Len uint8
|
||||
Family uint8
|
||||
X__ss_pad1 [6]int8
|
||||
@ -56,7 +56,7 @@ type sysSockaddrStorage struct {
|
||||
X__ss_pad2 [112]int8
|
||||
}
|
||||
|
||||
type sysSockaddrInet struct {
|
||||
type sockaddrInet struct {
|
||||
Len uint8
|
||||
Family uint8
|
||||
Port uint16
|
||||
@ -64,32 +64,32 @@ type sysSockaddrInet struct {
|
||||
Zero [8]int8
|
||||
}
|
||||
|
||||
type sysIPMreq struct {
|
||||
type ipMreq struct {
|
||||
Multiaddr [4]byte /* in_addr */
|
||||
Interface [4]byte /* in_addr */
|
||||
}
|
||||
|
||||
type sysIPMreqn struct {
|
||||
type ipMreqn struct {
|
||||
Multiaddr [4]byte /* in_addr */
|
||||
Address [4]byte /* in_addr */
|
||||
Ifindex int32
|
||||
}
|
||||
|
||||
type sysIPMreqSource struct {
|
||||
type ipMreqSource struct {
|
||||
Multiaddr [4]byte /* in_addr */
|
||||
Sourceaddr [4]byte /* in_addr */
|
||||
Interface [4]byte /* in_addr */
|
||||
}
|
||||
|
||||
type sysGroupReq struct {
|
||||
type groupReq struct {
|
||||
Interface uint32
|
||||
Pad_cgo_0 [4]byte
|
||||
Group sysSockaddrStorage
|
||||
Group sockaddrStorage
|
||||
}
|
||||
|
||||
type sysGroupSourceReq struct {
|
||||
type groupSourceReq struct {
|
||||
Interface uint32
|
||||
Pad_cgo_0 [4]byte
|
||||
Group sysSockaddrStorage
|
||||
Source sysSockaddrStorage
|
||||
Group sockaddrStorage
|
||||
Source sockaddrStorage
|
||||
}
|
||||
|
54
vendor/golang.org/x/net/ipv4/zsys_linux_386.go
generated
vendored
54
vendor/golang.org/x/net/ipv4/zsys_linux_386.go
generated
vendored
@ -58,39 +58,41 @@ const (
|
||||
sysSOL_SOCKET = 0x1
|
||||
sysSO_ATTACH_FILTER = 0x1a
|
||||
|
||||
sysSizeofKernelSockaddrStorage = 0x80
|
||||
sysSizeofSockaddrInet = 0x10
|
||||
sysSizeofInetPktinfo = 0xc
|
||||
sysSizeofSockExtendedErr = 0x10
|
||||
sizeofKernelSockaddrStorage = 0x80
|
||||
sizeofSockaddrInet = 0x10
|
||||
sizeofInetPktinfo = 0xc
|
||||
sizeofSockExtendedErr = 0x10
|
||||
|
||||
sysSizeofIPMreq = 0x8
|
||||
sysSizeofIPMreqn = 0xc
|
||||
sysSizeofIPMreqSource = 0xc
|
||||
sysSizeofGroupReq = 0x84
|
||||
sysSizeofGroupSourceReq = 0x104
|
||||
sizeofIPMreq = 0x8
|
||||
sizeofIPMreqn = 0xc
|
||||
sizeofIPMreqSource = 0xc
|
||||
sizeofGroupReq = 0x84
|
||||
sizeofGroupSourceReq = 0x104
|
||||
|
||||
sysSizeofICMPFilter = 0x4
|
||||
sizeofICMPFilter = 0x4
|
||||
|
||||
sizeofSockFprog = 0x8
|
||||
)
|
||||
|
||||
type sysKernelSockaddrStorage struct {
|
||||
type kernelSockaddrStorage struct {
|
||||
Family uint16
|
||||
X__data [126]int8
|
||||
}
|
||||
|
||||
type sysSockaddrInet struct {
|
||||
type sockaddrInet struct {
|
||||
Family uint16
|
||||
Port uint16
|
||||
Addr [4]byte /* in_addr */
|
||||
X__pad [8]uint8
|
||||
}
|
||||
|
||||
type sysInetPktinfo struct {
|
||||
type inetPktinfo struct {
|
||||
Ifindex int32
|
||||
Spec_dst [4]byte /* in_addr */
|
||||
Addr [4]byte /* in_addr */
|
||||
}
|
||||
|
||||
type sysSockExtendedErr struct {
|
||||
type sockExtendedErr struct {
|
||||
Errno uint32
|
||||
Origin uint8
|
||||
Type uint8
|
||||
@ -100,45 +102,45 @@ type sysSockExtendedErr struct {
|
||||
Data uint32
|
||||
}
|
||||
|
||||
type sysIPMreq struct {
|
||||
type ipMreq struct {
|
||||
Multiaddr [4]byte /* in_addr */
|
||||
Interface [4]byte /* in_addr */
|
||||
}
|
||||
|
||||
type sysIPMreqn struct {
|
||||
type ipMreqn struct {
|
||||
Multiaddr [4]byte /* in_addr */
|
||||
Address [4]byte /* in_addr */
|
||||
Ifindex int32
|
||||
}
|
||||
|
||||
type sysIPMreqSource struct {
|
||||
type ipMreqSource struct {
|
||||
Multiaddr uint32
|
||||
Interface uint32
|
||||
Sourceaddr uint32
|
||||
}
|
||||
|
||||
type sysGroupReq struct {
|
||||
type groupReq struct {
|
||||
Interface uint32
|
||||
Group sysKernelSockaddrStorage
|
||||
Group kernelSockaddrStorage
|
||||
}
|
||||
|
||||
type sysGroupSourceReq struct {
|
||||
type groupSourceReq struct {
|
||||
Interface uint32
|
||||
Group sysKernelSockaddrStorage
|
||||
Source sysKernelSockaddrStorage
|
||||
Group kernelSockaddrStorage
|
||||
Source kernelSockaddrStorage
|
||||
}
|
||||
|
||||
type sysICMPFilter struct {
|
||||
type icmpFilter struct {
|
||||
Data uint32
|
||||
}
|
||||
|
||||
type sysSockFProg struct {
|
||||
type sockFProg struct {
|
||||
Len uint16
|
||||
Pad_cgo_0 [2]byte
|
||||
Filter *sysSockFilter
|
||||
Filter *sockFilter
|
||||
}
|
||||
|
||||
type sysSockFilter struct {
|
||||
type sockFilter struct {
|
||||
Code uint16
|
||||
Jt uint8
|
||||
Jf uint8
|
||||
|
54
vendor/golang.org/x/net/ipv4/zsys_linux_amd64.go
generated
vendored
54
vendor/golang.org/x/net/ipv4/zsys_linux_amd64.go
generated
vendored
@ -58,39 +58,41 @@ const (
|
||||
sysSOL_SOCKET = 0x1
|
||||
sysSO_ATTACH_FILTER = 0x1a
|
||||
|
||||
sysSizeofKernelSockaddrStorage = 0x80
|
||||
sysSizeofSockaddrInet = 0x10
|
||||
sysSizeofInetPktinfo = 0xc
|
||||
sysSizeofSockExtendedErr = 0x10
|
||||
sizeofKernelSockaddrStorage = 0x80
|
||||
sizeofSockaddrInet = 0x10
|
||||
sizeofInetPktinfo = 0xc
|
||||
sizeofSockExtendedErr = 0x10
|
||||
|
||||
sysSizeofIPMreq = 0x8
|
||||
sysSizeofIPMreqn = 0xc
|
||||
sysSizeofIPMreqSource = 0xc
|
||||
sysSizeofGroupReq = 0x88
|
||||
sysSizeofGroupSourceReq = 0x108
|
||||
sizeofIPMreq = 0x8
|
||||
sizeofIPMreqn = 0xc
|
||||
sizeofIPMreqSource = 0xc
|
||||
sizeofGroupReq = 0x88
|
||||
sizeofGroupSourceReq = 0x108
|
||||
|
||||
sysSizeofICMPFilter = 0x4
|
||||
sizeofICMPFilter = 0x4
|
||||
|
||||
sizeofSockFprog = 0x10
|
||||
)
|
||||
|
||||
type sysKernelSockaddrStorage struct {
|
||||
type kernelSockaddrStorage struct {
|
||||
Family uint16
|
||||
X__data [126]int8
|
||||
}
|
||||
|
||||
type sysSockaddrInet struct {
|
||||
type sockaddrInet struct {
|
||||
Family uint16
|
||||
Port uint16
|
||||
Addr [4]byte /* in_addr */
|
||||
X__pad [8]uint8
|
||||
}
|
||||
|
||||
type sysInetPktinfo struct {
|
||||
type inetPktinfo struct {
|
||||
Ifindex int32
|
||||
Spec_dst [4]byte /* in_addr */
|
||||
Addr [4]byte /* in_addr */
|
||||
}
|
||||
|
||||
type sysSockExtendedErr struct {
|
||||
type sockExtendedErr struct {
|
||||
Errno uint32
|
||||
Origin uint8
|
||||
Type uint8
|
||||
@ -100,47 +102,47 @@ type sysSockExtendedErr struct {
|
||||
Data uint32
|
||||
}
|
||||
|
||||
type sysIPMreq struct {
|
||||
type ipMreq struct {
|
||||
Multiaddr [4]byte /* in_addr */
|
||||
Interface [4]byte /* in_addr */
|
||||
}
|
||||
|
||||
type sysIPMreqn struct {
|
||||
type ipMreqn struct {
|
||||
Multiaddr [4]byte /* in_addr */
|
||||
Address [4]byte /* in_addr */
|
||||
Ifindex int32
|
||||
}
|
||||
|
||||
type sysIPMreqSource struct {
|
||||
type ipMreqSource struct {
|
||||
Multiaddr uint32
|
||||
Interface uint32
|
||||
Sourceaddr uint32
|
||||
}
|
||||
|
||||
type sysGroupReq struct {
|
||||
type groupReq struct {
|
||||
Interface uint32
|
||||
Pad_cgo_0 [4]byte
|
||||
Group sysKernelSockaddrStorage
|
||||
Group kernelSockaddrStorage
|
||||
}
|
||||
|
||||
type sysGroupSourceReq struct {
|
||||
type groupSourceReq struct {
|
||||
Interface uint32
|
||||
Pad_cgo_0 [4]byte
|
||||
Group sysKernelSockaddrStorage
|
||||
Source sysKernelSockaddrStorage
|
||||
Group kernelSockaddrStorage
|
||||
Source kernelSockaddrStorage
|
||||
}
|
||||
|
||||
type sysICMPFilter struct {
|
||||
type icmpFilter struct {
|
||||
Data uint32
|
||||
}
|
||||
|
||||
type sysSockFProg struct {
|
||||
type sockFProg struct {
|
||||
Len uint16
|
||||
Pad_cgo_0 [6]byte
|
||||
Filter *sysSockFilter
|
||||
Filter *sockFilter
|
||||
}
|
||||
|
||||
type sysSockFilter struct {
|
||||
type sockFilter struct {
|
||||
Code uint16
|
||||
Jt uint8
|
||||
Jf uint8
|
||||
|
54
vendor/golang.org/x/net/ipv4/zsys_linux_arm.go
generated
vendored
54
vendor/golang.org/x/net/ipv4/zsys_linux_arm.go
generated
vendored
@ -58,39 +58,41 @@ const (
|
||||
sysSOL_SOCKET = 0x1
|
||||
sysSO_ATTACH_FILTER = 0x1a
|
||||
|
||||
sysSizeofKernelSockaddrStorage = 0x80
|
||||
sysSizeofSockaddrInet = 0x10
|
||||
sysSizeofInetPktinfo = 0xc
|
||||
sysSizeofSockExtendedErr = 0x10
|
||||
sizeofKernelSockaddrStorage = 0x80
|
||||
sizeofSockaddrInet = 0x10
|
||||
sizeofInetPktinfo = 0xc
|
||||
sizeofSockExtendedErr = 0x10
|
||||
|
||||
sysSizeofIPMreq = 0x8
|
||||
sysSizeofIPMreqn = 0xc
|
||||
sysSizeofIPMreqSource = 0xc
|
||||
sysSizeofGroupReq = 0x84
|
||||
sysSizeofGroupSourceReq = 0x104
|
||||
sizeofIPMreq = 0x8
|
||||
sizeofIPMreqn = 0xc
|
||||
sizeofIPMreqSource = 0xc
|
||||
sizeofGroupReq = 0x84
|
||||
sizeofGroupSourceReq = 0x104
|
||||
|
||||
sysSizeofICMPFilter = 0x4
|
||||
sizeofICMPFilter = 0x4
|
||||
|
||||
sizeofSockFprog = 0x8
|
||||
)
|
||||
|
||||
type sysKernelSockaddrStorage struct {
|
||||
type kernelSockaddrStorage struct {
|
||||
Family uint16
|
||||
X__data [126]int8
|
||||
}
|
||||
|
||||
type sysSockaddrInet struct {
|
||||
type sockaddrInet struct {
|
||||
Family uint16
|
||||
Port uint16
|
||||
Addr [4]byte /* in_addr */
|
||||
X__pad [8]uint8
|
||||
}
|
||||
|
||||
type sysInetPktinfo struct {
|
||||
type inetPktinfo struct {
|
||||
Ifindex int32
|
||||
Spec_dst [4]byte /* in_addr */
|
||||
Addr [4]byte /* in_addr */
|
||||
}
|
||||
|
||||
type sysSockExtendedErr struct {
|
||||
type sockExtendedErr struct {
|
||||
Errno uint32
|
||||
Origin uint8
|
||||
Type uint8
|
||||
@ -100,45 +102,45 @@ type sysSockExtendedErr struct {
|
||||
Data uint32
|
||||
}
|
||||
|
||||
type sysIPMreq struct {
|
||||
type ipMreq struct {
|
||||
Multiaddr [4]byte /* in_addr */
|
||||
Interface [4]byte /* in_addr */
|
||||
}
|
||||
|
||||
type sysIPMreqn struct {
|
||||
type ipMreqn struct {
|
||||
Multiaddr [4]byte /* in_addr */
|
||||
Address [4]byte /* in_addr */
|
||||
Ifindex int32
|
||||
}
|
||||
|
||||
type sysIPMreqSource struct {
|
||||
type ipMreqSource struct {
|
||||
Multiaddr uint32
|
||||
Interface uint32
|
||||
Sourceaddr uint32
|
||||
}
|
||||
|
||||
type sysGroupReq struct {
|
||||
type groupReq struct {
|
||||
Interface uint32
|
||||
Group sysKernelSockaddrStorage
|
||||
Group kernelSockaddrStorage
|
||||
}
|
||||
|
||||
type sysGroupSourceReq struct {
|
||||
type groupSourceReq struct {
|
||||
Interface uint32
|
||||
Group sysKernelSockaddrStorage
|
||||
Source sysKernelSockaddrStorage
|
||||
Group kernelSockaddrStorage
|
||||
Source kernelSockaddrStorage
|
||||
}
|
||||
|
||||
type sysICMPFilter struct {
|
||||
type icmpFilter struct {
|
||||
Data uint32
|
||||
}
|
||||
|
||||
type sysSockFProg struct {
|
||||
type sockFProg struct {
|
||||
Len uint16
|
||||
Pad_cgo_0 [2]byte
|
||||
Filter *sysSockFilter
|
||||
Filter *sockFilter
|
||||
}
|
||||
|
||||
type sysSockFilter struct {
|
||||
type sockFilter struct {
|
||||
Code uint16
|
||||
Jt uint8
|
||||
Jf uint8
|
||||
|
56
vendor/golang.org/x/net/ipv4/zsys_linux_arm64.go
generated
vendored
56
vendor/golang.org/x/net/ipv4/zsys_linux_arm64.go
generated
vendored
@ -1,8 +1,6 @@
|
||||
// Created by cgo -godefs - DO NOT EDIT
|
||||
// cgo -godefs defs_linux.go
|
||||
|
||||
// +build linux,arm64
|
||||
|
||||
package ipv4
|
||||
|
||||
const (
|
||||
@ -60,39 +58,41 @@ const (
|
||||
sysSOL_SOCKET = 0x1
|
||||
sysSO_ATTACH_FILTER = 0x1a
|
||||
|
||||
sysSizeofKernelSockaddrStorage = 0x80
|
||||
sysSizeofSockaddrInet = 0x10
|
||||
sysSizeofInetPktinfo = 0xc
|
||||
sysSizeofSockExtendedErr = 0x10
|
||||
sizeofKernelSockaddrStorage = 0x80
|
||||
sizeofSockaddrInet = 0x10
|
||||
sizeofInetPktinfo = 0xc
|
||||
sizeofSockExtendedErr = 0x10
|
||||
|
||||
sysSizeofIPMreq = 0x8
|
||||
sysSizeofIPMreqn = 0xc
|
||||
sysSizeofIPMreqSource = 0xc
|
||||
sysSizeofGroupReq = 0x88
|
||||
sysSizeofGroupSourceReq = 0x108
|
||||
sizeofIPMreq = 0x8
|
||||
sizeofIPMreqn = 0xc
|
||||
sizeofIPMreqSource = 0xc
|
||||
sizeofGroupReq = 0x88
|
||||
sizeofGroupSourceReq = 0x108
|
||||
|
||||
sysSizeofICMPFilter = 0x4
|
||||
sizeofICMPFilter = 0x4
|
||||
|
||||
sizeofSockFprog = 0x10
|
||||
)
|
||||
|
||||
type sysKernelSockaddrStorage struct {
|
||||
type kernelSockaddrStorage struct {
|
||||
Family uint16
|
||||
X__data [126]int8
|
||||
}
|
||||
|
||||
type sysSockaddrInet struct {
|
||||
type sockaddrInet struct {
|
||||
Family uint16
|
||||
Port uint16
|
||||
Addr [4]byte /* in_addr */
|
||||
X__pad [8]uint8
|
||||
}
|
||||
|
||||
type sysInetPktinfo struct {
|
||||
type inetPktinfo struct {
|
||||
Ifindex int32
|
||||
Spec_dst [4]byte /* in_addr */
|
||||
Addr [4]byte /* in_addr */
|
||||
}
|
||||
|
||||
type sysSockExtendedErr struct {
|
||||
type sockExtendedErr struct {
|
||||
Errno uint32
|
||||
Origin uint8
|
||||
Type uint8
|
||||
@ -102,47 +102,47 @@ type sysSockExtendedErr struct {
|
||||
Data uint32
|
||||
}
|
||||
|
||||
type sysIPMreq struct {
|
||||
type ipMreq struct {
|
||||
Multiaddr [4]byte /* in_addr */
|
||||
Interface [4]byte /* in_addr */
|
||||
}
|
||||
|
||||
type sysIPMreqn struct {
|
||||
type ipMreqn struct {
|
||||
Multiaddr [4]byte /* in_addr */
|
||||
Address [4]byte /* in_addr */
|
||||
Ifindex int32
|
||||
}
|
||||
|
||||
type sysIPMreqSource struct {
|
||||
type ipMreqSource struct {
|
||||
Multiaddr uint32
|
||||
Interface uint32
|
||||
Sourceaddr uint32
|
||||
}
|
||||
|
||||
type sysGroupReq struct {
|
||||
type groupReq struct {
|
||||
Interface uint32
|
||||
Pad_cgo_0 [4]byte
|
||||
Group sysKernelSockaddrStorage
|
||||
Group kernelSockaddrStorage
|
||||
}
|
||||
|
||||
type sysGroupSourceReq struct {
|
||||
type groupSourceReq struct {
|
||||
Interface uint32
|
||||
Pad_cgo_0 [4]byte
|
||||
Group sysKernelSockaddrStorage
|
||||
Source sysKernelSockaddrStorage
|
||||
Group kernelSockaddrStorage
|
||||
Source kernelSockaddrStorage
|
||||
}
|
||||
|
||||
type sysICMPFilter struct {
|
||||
type icmpFilter struct {
|
||||
Data uint32
|
||||
}
|
||||
|
||||
type sysSockFProg struct {
|
||||
type sockFProg struct {
|
||||
Len uint16
|
||||
Pad_cgo_0 [6]byte
|
||||
Filter *sysSockFilter
|
||||
Filter *sockFilter
|
||||
}
|
||||
|
||||
type sysSockFilter struct {
|
||||
type sockFilter struct {
|
||||
Code uint16
|
||||
Jt uint8
|
||||
Jf uint8
|
||||
|
148
vendor/golang.org/x/net/ipv4/zsys_linux_mips.go
generated
vendored
Normal file
148
vendor/golang.org/x/net/ipv4/zsys_linux_mips.go
generated
vendored
Normal file
@ -0,0 +1,148 @@
|
||||
// Created by cgo -godefs - DO NOT EDIT
|
||||
// cgo -godefs defs_linux.go
|
||||
|
||||
package ipv4
|
||||
|
||||
const (
|
||||
sysIP_TOS = 0x1
|
||||
sysIP_TTL = 0x2
|
||||
sysIP_HDRINCL = 0x3
|
||||
sysIP_OPTIONS = 0x4
|
||||
sysIP_ROUTER_ALERT = 0x5
|
||||
sysIP_RECVOPTS = 0x6
|
||||
sysIP_RETOPTS = 0x7
|
||||
sysIP_PKTINFO = 0x8
|
||||
sysIP_PKTOPTIONS = 0x9
|
||||
sysIP_MTU_DISCOVER = 0xa
|
||||
sysIP_RECVERR = 0xb
|
||||
sysIP_RECVTTL = 0xc
|
||||
sysIP_RECVTOS = 0xd
|
||||
sysIP_MTU = 0xe
|
||||
sysIP_FREEBIND = 0xf
|
||||
sysIP_TRANSPARENT = 0x13
|
||||
sysIP_RECVRETOPTS = 0x7
|
||||
sysIP_ORIGDSTADDR = 0x14
|
||||
sysIP_RECVORIGDSTADDR = 0x14
|
||||
sysIP_MINTTL = 0x15
|
||||
sysIP_NODEFRAG = 0x16
|
||||
sysIP_UNICAST_IF = 0x32
|
||||
|
||||
sysIP_MULTICAST_IF = 0x20
|
||||
sysIP_MULTICAST_TTL = 0x21
|
||||
sysIP_MULTICAST_LOOP = 0x22
|
||||
sysIP_ADD_MEMBERSHIP = 0x23
|
||||
sysIP_DROP_MEMBERSHIP = 0x24
|
||||
sysIP_UNBLOCK_SOURCE = 0x25
|
||||
sysIP_BLOCK_SOURCE = 0x26
|
||||
sysIP_ADD_SOURCE_MEMBERSHIP = 0x27
|
||||
sysIP_DROP_SOURCE_MEMBERSHIP = 0x28
|
||||
sysIP_MSFILTER = 0x29
|
||||
sysMCAST_JOIN_GROUP = 0x2a
|
||||
sysMCAST_LEAVE_GROUP = 0x2d
|
||||
sysMCAST_JOIN_SOURCE_GROUP = 0x2e
|
||||
sysMCAST_LEAVE_SOURCE_GROUP = 0x2f
|
||||
sysMCAST_BLOCK_SOURCE = 0x2b
|
||||
sysMCAST_UNBLOCK_SOURCE = 0x2c
|
||||
sysMCAST_MSFILTER = 0x30
|
||||
sysIP_MULTICAST_ALL = 0x31
|
||||
|
||||
sysICMP_FILTER = 0x1
|
||||
|
||||
sysSO_EE_ORIGIN_NONE = 0x0
|
||||
sysSO_EE_ORIGIN_LOCAL = 0x1
|
||||
sysSO_EE_ORIGIN_ICMP = 0x2
|
||||
sysSO_EE_ORIGIN_ICMP6 = 0x3
|
||||
sysSO_EE_ORIGIN_TXSTATUS = 0x4
|
||||
sysSO_EE_ORIGIN_TIMESTAMPING = 0x4
|
||||
|
||||
sysSOL_SOCKET = 0x1
|
||||
sysSO_ATTACH_FILTER = 0x1a
|
||||
|
||||
sizeofKernelSockaddrStorage = 0x80
|
||||
sizeofSockaddrInet = 0x10
|
||||
sizeofInetPktinfo = 0xc
|
||||
sizeofSockExtendedErr = 0x10
|
||||
|
||||
sizeofIPMreq = 0x8
|
||||
sizeofIPMreqn = 0xc
|
||||
sizeofIPMreqSource = 0xc
|
||||
sizeofGroupReq = 0x84
|
||||
sizeofGroupSourceReq = 0x104
|
||||
|
||||
sizeofICMPFilter = 0x4
|
||||
|
||||
sizeofSockFprog = 0x8
|
||||
)
|
||||
|
||||
type kernelSockaddrStorage struct {
|
||||
Family uint16
|
||||
X__data [126]int8
|
||||
}
|
||||
|
||||
type sockaddrInet struct {
|
||||
Family uint16
|
||||
Port uint16
|
||||
Addr [4]byte /* in_addr */
|
||||
X__pad [8]uint8
|
||||
}
|
||||
|
||||
type inetPktinfo struct {
|
||||
Ifindex int32
|
||||
Spec_dst [4]byte /* in_addr */
|
||||
Addr [4]byte /* in_addr */
|
||||
}
|
||||
|
||||
type sockExtendedErr struct {
|
||||
Errno uint32
|
||||
Origin uint8
|
||||
Type uint8
|
||||
Code uint8
|
||||
Pad uint8
|
||||
Info uint32
|
||||
Data uint32
|
||||
}
|
||||
|
||||
type ipMreq struct {
|
||||
Multiaddr [4]byte /* in_addr */
|
||||
Interface [4]byte /* in_addr */
|
||||
}
|
||||
|
||||
type ipMreqn struct {
|
||||
Multiaddr [4]byte /* in_addr */
|
||||
Address [4]byte /* in_addr */
|
||||
Ifindex int32
|
||||
}
|
||||
|
||||
type ipMreqSource struct {
|
||||
Multiaddr uint32
|
||||
Interface uint32
|
||||
Sourceaddr uint32
|
||||
}
|
||||
|
||||
type groupReq struct {
|
||||
Interface uint32
|
||||
Group kernelSockaddrStorage
|
||||
}
|
||||
|
||||
type groupSourceReq struct {
|
||||
Interface uint32
|
||||
Group kernelSockaddrStorage
|
||||
Source kernelSockaddrStorage
|
||||
}
|
||||
|
||||
type icmpFilter struct {
|
||||
Data uint32
|
||||
}
|
||||
|
||||
type sockFProg struct {
|
||||
Len uint16
|
||||
Pad_cgo_0 [2]byte
|
||||
Filter *sockFilter
|
||||
}
|
||||
|
||||
type sockFilter struct {
|
||||
Code uint16
|
||||
Jt uint8
|
||||
Jf uint8
|
||||
K uint32
|
||||
}
|
56
vendor/golang.org/x/net/ipv4/zsys_linux_mips64.go
generated
vendored
56
vendor/golang.org/x/net/ipv4/zsys_linux_mips64.go
generated
vendored
@ -1,8 +1,6 @@
|
||||
// Created by cgo -godefs - DO NOT EDIT
|
||||
// cgo -godefs defs_linux.go
|
||||
|
||||
// +build linux,mips64
|
||||
|
||||
package ipv4
|
||||
|
||||
const (
|
||||
@ -60,39 +58,41 @@ const (
|
||||
sysSOL_SOCKET = 0x1
|
||||
sysSO_ATTACH_FILTER = 0x1a
|
||||
|
||||
sysSizeofKernelSockaddrStorage = 0x80
|
||||
sysSizeofSockaddrInet = 0x10
|
||||
sysSizeofInetPktinfo = 0xc
|
||||
sysSizeofSockExtendedErr = 0x10
|
||||
sizeofKernelSockaddrStorage = 0x80
|
||||
sizeofSockaddrInet = 0x10
|
||||
sizeofInetPktinfo = 0xc
|
||||
sizeofSockExtendedErr = 0x10
|
||||
|
||||
sysSizeofIPMreq = 0x8
|
||||
sysSizeofIPMreqn = 0xc
|
||||
sysSizeofIPMreqSource = 0xc
|
||||
sysSizeofGroupReq = 0x88
|
||||
sysSizeofGroupSourceReq = 0x108
|
||||
sizeofIPMreq = 0x8
|
||||
sizeofIPMreqn = 0xc
|
||||
sizeofIPMreqSource = 0xc
|
||||
sizeofGroupReq = 0x88
|
||||
sizeofGroupSourceReq = 0x108
|
||||
|
||||
sysSizeofICMPFilter = 0x4
|
||||
sizeofICMPFilter = 0x4
|
||||
|
||||
sizeofSockFprog = 0x10
|
||||
)
|
||||
|
||||
type sysKernelSockaddrStorage struct {
|
||||
type kernelSockaddrStorage struct {
|
||||
Family uint16
|
||||
X__data [126]int8
|
||||
}
|
||||
|
||||
type sysSockaddrInet struct {
|
||||
type sockaddrInet struct {
|
||||
Family uint16
|
||||
Port uint16
|
||||
Addr [4]byte /* in_addr */
|
||||
X__pad [8]uint8
|
||||
}
|
||||
|
||||
type sysInetPktinfo struct {
|
||||
type inetPktinfo struct {
|
||||
Ifindex int32
|
||||
Spec_dst [4]byte /* in_addr */
|
||||
Addr [4]byte /* in_addr */
|
||||
}
|
||||
|
||||
type sysSockExtendedErr struct {
|
||||
type sockExtendedErr struct {
|
||||
Errno uint32
|
||||
Origin uint8
|
||||
Type uint8
|
||||
@ -102,47 +102,47 @@ type sysSockExtendedErr struct {
|
||||
Data uint32
|
||||
}
|
||||
|
||||
type sysIPMreq struct {
|
||||
type ipMreq struct {
|
||||
Multiaddr [4]byte /* in_addr */
|
||||
Interface [4]byte /* in_addr */
|
||||
}
|
||||
|
||||
type sysIPMreqn struct {
|
||||
type ipMreqn struct {
|
||||
Multiaddr [4]byte /* in_addr */
|
||||
Address [4]byte /* in_addr */
|
||||
Ifindex int32
|
||||
}
|
||||
|
||||
type sysIPMreqSource struct {
|
||||
type ipMreqSource struct {
|
||||
Multiaddr uint32
|
||||
Interface uint32
|
||||
Sourceaddr uint32
|
||||
}
|
||||
|
||||
type sysGroupReq struct {
|
||||
type groupReq struct {
|
||||
Interface uint32
|
||||
Pad_cgo_0 [4]byte
|
||||
Group sysKernelSockaddrStorage
|
||||
Group kernelSockaddrStorage
|
||||
}
|
||||
|
||||
type sysGroupSourceReq struct {
|
||||
type groupSourceReq struct {
|
||||
Interface uint32
|
||||
Pad_cgo_0 [4]byte
|
||||
Group sysKernelSockaddrStorage
|
||||
Source sysKernelSockaddrStorage
|
||||
Group kernelSockaddrStorage
|
||||
Source kernelSockaddrStorage
|
||||
}
|
||||
|
||||
type sysICMPFilter struct {
|
||||
type icmpFilter struct {
|
||||
Data uint32
|
||||
}
|
||||
|
||||
type sysSockFProg struct {
|
||||
type sockFProg struct {
|
||||
Len uint16
|
||||
Pad_cgo_0 [6]byte
|
||||
Filter *sysSockFilter
|
||||
Filter *sockFilter
|
||||
}
|
||||
|
||||
type sysSockFilter struct {
|
||||
type sockFilter struct {
|
||||
Code uint16
|
||||
Jt uint8
|
||||
Jf uint8
|
||||
|
56
vendor/golang.org/x/net/ipv4/zsys_linux_mips64le.go
generated
vendored
56
vendor/golang.org/x/net/ipv4/zsys_linux_mips64le.go
generated
vendored
@ -1,8 +1,6 @@
|
||||
// Created by cgo -godefs - DO NOT EDIT
|
||||
// cgo -godefs defs_linux.go
|
||||
|
||||
// +build linux,mips64le
|
||||
|
||||
package ipv4
|
||||
|
||||
const (
|
||||
@ -60,39 +58,41 @@ const (
|
||||
sysSOL_SOCKET = 0x1
|
||||
sysSO_ATTACH_FILTER = 0x1a
|
||||
|
||||
sysSizeofKernelSockaddrStorage = 0x80
|
||||
sysSizeofSockaddrInet = 0x10
|
||||
sysSizeofInetPktinfo = 0xc
|
||||
sysSizeofSockExtendedErr = 0x10
|
||||
sizeofKernelSockaddrStorage = 0x80
|
||||
sizeofSockaddrInet = 0x10
|
||||
sizeofInetPktinfo = 0xc
|
||||
sizeofSockExtendedErr = 0x10
|
||||
|
||||
sysSizeofIPMreq = 0x8
|
||||
sysSizeofIPMreqn = 0xc
|
||||
sysSizeofIPMreqSource = 0xc
|
||||
sysSizeofGroupReq = 0x88
|
||||
sysSizeofGroupSourceReq = 0x108
|
||||
sizeofIPMreq = 0x8
|
||||
sizeofIPMreqn = 0xc
|
||||
sizeofIPMreqSource = 0xc
|
||||
sizeofGroupReq = 0x88
|
||||
sizeofGroupSourceReq = 0x108
|
||||
|
||||
sysSizeofICMPFilter = 0x4
|
||||
sizeofICMPFilter = 0x4
|
||||
|
||||
sizeofSockFprog = 0x10
|
||||
)
|
||||
|
||||
type sysKernelSockaddrStorage struct {
|
||||
type kernelSockaddrStorage struct {
|
||||
Family uint16
|
||||
X__data [126]int8
|
||||
}
|
||||
|
||||
type sysSockaddrInet struct {
|
||||
type sockaddrInet struct {
|
||||
Family uint16
|
||||
Port uint16
|
||||
Addr [4]byte /* in_addr */
|
||||
X__pad [8]uint8
|
||||
}
|
||||
|
||||
type sysInetPktinfo struct {
|
||||
type inetPktinfo struct {
|
||||
Ifindex int32
|
||||
Spec_dst [4]byte /* in_addr */
|
||||
Addr [4]byte /* in_addr */
|
||||
}
|
||||
|
||||
type sysSockExtendedErr struct {
|
||||
type sockExtendedErr struct {
|
||||
Errno uint32
|
||||
Origin uint8
|
||||
Type uint8
|
||||
@ -102,47 +102,47 @@ type sysSockExtendedErr struct {
|
||||
Data uint32
|
||||
}
|
||||
|
||||
type sysIPMreq struct {
|
||||
type ipMreq struct {
|
||||
Multiaddr [4]byte /* in_addr */
|
||||
Interface [4]byte /* in_addr */
|
||||
}
|
||||
|
||||
type sysIPMreqn struct {
|
||||
type ipMreqn struct {
|
||||
Multiaddr [4]byte /* in_addr */
|
||||
Address [4]byte /* in_addr */
|
||||
Ifindex int32
|
||||
}
|
||||
|
||||
type sysIPMreqSource struct {
|
||||
type ipMreqSource struct {
|
||||
Multiaddr uint32
|
||||
Interface uint32
|
||||
Sourceaddr uint32
|
||||
}
|
||||
|
||||
type sysGroupReq struct {
|
||||
type groupReq struct {
|
||||
Interface uint32
|
||||
Pad_cgo_0 [4]byte
|
||||
Group sysKernelSockaddrStorage
|
||||
Group kernelSockaddrStorage
|
||||
}
|
||||
|
||||
type sysGroupSourceReq struct {
|
||||
type groupSourceReq struct {
|
||||
Interface uint32
|
||||
Pad_cgo_0 [4]byte
|
||||
Group sysKernelSockaddrStorage
|
||||
Source sysKernelSockaddrStorage
|
||||
Group kernelSockaddrStorage
|
||||
Source kernelSockaddrStorage
|
||||
}
|
||||
|
||||
type sysICMPFilter struct {
|
||||
type icmpFilter struct {
|
||||
Data uint32
|
||||
}
|
||||
|
||||
type sysSockFProg struct {
|
||||
type sockFProg struct {
|
||||
Len uint16
|
||||
Pad_cgo_0 [6]byte
|
||||
Filter *sysSockFilter
|
||||
Filter *sockFilter
|
||||
}
|
||||
|
||||
type sysSockFilter struct {
|
||||
type sockFilter struct {
|
||||
Code uint16
|
||||
Jt uint8
|
||||
Jf uint8
|
||||
|
148
vendor/golang.org/x/net/ipv4/zsys_linux_mipsle.go
generated
vendored
Normal file
148
vendor/golang.org/x/net/ipv4/zsys_linux_mipsle.go
generated
vendored
Normal file
@ -0,0 +1,148 @@
|
||||
// Created by cgo -godefs - DO NOT EDIT
|
||||
// cgo -godefs defs_linux.go
|
||||
|
||||
package ipv4
|
||||
|
||||
const (
|
||||
sysIP_TOS = 0x1
|
||||
sysIP_TTL = 0x2
|
||||
sysIP_HDRINCL = 0x3
|
||||
sysIP_OPTIONS = 0x4
|
||||
sysIP_ROUTER_ALERT = 0x5
|
||||
sysIP_RECVOPTS = 0x6
|
||||
sysIP_RETOPTS = 0x7
|
||||
sysIP_PKTINFO = 0x8
|
||||
sysIP_PKTOPTIONS = 0x9
|
||||
sysIP_MTU_DISCOVER = 0xa
|
||||
sysIP_RECVERR = 0xb
|
||||
sysIP_RECVTTL = 0xc
|
||||
sysIP_RECVTOS = 0xd
|
||||
sysIP_MTU = 0xe
|
||||
sysIP_FREEBIND = 0xf
|
||||
sysIP_TRANSPARENT = 0x13
|
||||
sysIP_RECVRETOPTS = 0x7
|
||||
sysIP_ORIGDSTADDR = 0x14
|
||||
sysIP_RECVORIGDSTADDR = 0x14
|
||||
sysIP_MINTTL = 0x15
|
||||
sysIP_NODEFRAG = 0x16
|
||||
sysIP_UNICAST_IF = 0x32
|
||||
|
||||
sysIP_MULTICAST_IF = 0x20
|
||||
sysIP_MULTICAST_TTL = 0x21
|
||||
sysIP_MULTICAST_LOOP = 0x22
|
||||
sysIP_ADD_MEMBERSHIP = 0x23
|
||||
sysIP_DROP_MEMBERSHIP = 0x24
|
||||
sysIP_UNBLOCK_SOURCE = 0x25
|
||||
sysIP_BLOCK_SOURCE = 0x26
|
||||
sysIP_ADD_SOURCE_MEMBERSHIP = 0x27
|
||||
sysIP_DROP_SOURCE_MEMBERSHIP = 0x28
|
||||
sysIP_MSFILTER = 0x29
|
||||
sysMCAST_JOIN_GROUP = 0x2a
|
||||
sysMCAST_LEAVE_GROUP = 0x2d
|
||||
sysMCAST_JOIN_SOURCE_GROUP = 0x2e
|
||||
sysMCAST_LEAVE_SOURCE_GROUP = 0x2f
|
||||
sysMCAST_BLOCK_SOURCE = 0x2b
|
||||
sysMCAST_UNBLOCK_SOURCE = 0x2c
|
||||
sysMCAST_MSFILTER = 0x30
|
||||
sysIP_MULTICAST_ALL = 0x31
|
||||
|
||||
sysICMP_FILTER = 0x1
|
||||
|
||||
sysSO_EE_ORIGIN_NONE = 0x0
|
||||
sysSO_EE_ORIGIN_LOCAL = 0x1
|
||||
sysSO_EE_ORIGIN_ICMP = 0x2
|
||||
sysSO_EE_ORIGIN_ICMP6 = 0x3
|
||||
sysSO_EE_ORIGIN_TXSTATUS = 0x4
|
||||
sysSO_EE_ORIGIN_TIMESTAMPING = 0x4
|
||||
|
||||
sysSOL_SOCKET = 0x1
|
||||
sysSO_ATTACH_FILTER = 0x1a
|
||||
|
||||
sizeofKernelSockaddrStorage = 0x80
|
||||
sizeofSockaddrInet = 0x10
|
||||
sizeofInetPktinfo = 0xc
|
||||
sizeofSockExtendedErr = 0x10
|
||||
|
||||
sizeofIPMreq = 0x8
|
||||
sizeofIPMreqn = 0xc
|
||||
sizeofIPMreqSource = 0xc
|
||||
sizeofGroupReq = 0x84
|
||||
sizeofGroupSourceReq = 0x104
|
||||
|
||||
sizeofICMPFilter = 0x4
|
||||
|
||||
sizeofSockFprog = 0x8
|
||||
)
|
||||
|
||||
type kernelSockaddrStorage struct {
|
||||
Family uint16
|
||||
X__data [126]int8
|
||||
}
|
||||
|
||||
type sockaddrInet struct {
|
||||
Family uint16
|
||||
Port uint16
|
||||
Addr [4]byte /* in_addr */
|
||||
X__pad [8]uint8
|
||||
}
|
||||
|
||||
type inetPktinfo struct {
|
||||
Ifindex int32
|
||||
Spec_dst [4]byte /* in_addr */
|
||||
Addr [4]byte /* in_addr */
|
||||
}
|
||||
|
||||
type sockExtendedErr struct {
|
||||
Errno uint32
|
||||
Origin uint8
|
||||
Type uint8
|
||||
Code uint8
|
||||
Pad uint8
|
||||
Info uint32
|
||||
Data uint32
|
||||
}
|
||||
|
||||
type ipMreq struct {
|
||||
Multiaddr [4]byte /* in_addr */
|
||||
Interface [4]byte /* in_addr */
|
||||
}
|
||||
|
||||
type ipMreqn struct {
|
||||
Multiaddr [4]byte /* in_addr */
|
||||
Address [4]byte /* in_addr */
|
||||
Ifindex int32
|
||||
}
|
||||
|
||||
type ipMreqSource struct {
|
||||
Multiaddr uint32
|
||||
Interface uint32
|
||||
Sourceaddr uint32
|
||||
}
|
||||
|
||||
type groupReq struct {
|
||||
Interface uint32
|
||||
Group kernelSockaddrStorage
|
||||
}
|
||||
|
||||
type groupSourceReq struct {
|
||||
Interface uint32
|
||||
Group kernelSockaddrStorage
|
||||
Source kernelSockaddrStorage
|
||||
}
|
||||
|
||||
type icmpFilter struct {
|
||||
Data uint32
|
||||
}
|
||||
|
||||
type sockFProg struct {
|
||||
Len uint16
|
||||
Pad_cgo_0 [2]byte
|
||||
Filter *sockFilter
|
||||
}
|
||||
|
||||
type sockFilter struct {
|
||||
Code uint16
|
||||
Jt uint8
|
||||
Jf uint8
|
||||
K uint32
|
||||
}
|
56
vendor/golang.org/x/net/ipv4/zsys_linux_ppc.go
generated
vendored
56
vendor/golang.org/x/net/ipv4/zsys_linux_ppc.go
generated
vendored
@ -1,8 +1,6 @@
|
||||
// Created by cgo -godefs - DO NOT EDIT
|
||||
// cgo -godefs defs_linux.go
|
||||
|
||||
// +build linux,ppc
|
||||
|
||||
package ipv4
|
||||
|
||||
const (
|
||||
@ -60,39 +58,41 @@ const (
|
||||
sysSOL_SOCKET = 0x1
|
||||
sysSO_ATTACH_FILTER = 0x1a
|
||||
|
||||
sysSizeofKernelSockaddrStorage = 0x80
|
||||
sysSizeofSockaddrInet = 0x10
|
||||
sysSizeofInetPktinfo = 0xc
|
||||
sysSizeofSockExtendedErr = 0x10
|
||||
sizeofKernelSockaddrStorage = 0x80
|
||||
sizeofSockaddrInet = 0x10
|
||||
sizeofInetPktinfo = 0xc
|
||||
sizeofSockExtendedErr = 0x10
|
||||
|
||||
sysSizeofIPMreq = 0x8
|
||||
sysSizeofIPMreqn = 0xc
|
||||
sysSizeofIPMreqSource = 0xc
|
||||
sysSizeofGroupReq = 0x84
|
||||
sysSizeofGroupSourceReq = 0x104
|
||||
sizeofIPMreq = 0x8
|
||||
sizeofIPMreqn = 0xc
|
||||
sizeofIPMreqSource = 0xc
|
||||
sizeofGroupReq = 0x84
|
||||
sizeofGroupSourceReq = 0x104
|
||||
|
||||
sysSizeofICMPFilter = 0x4
|
||||
sizeofICMPFilter = 0x4
|
||||
|
||||
sizeofSockFprog = 0x8
|
||||
)
|
||||
|
||||
type sysKernelSockaddrStorage struct {
|
||||
type kernelSockaddrStorage struct {
|
||||
Family uint16
|
||||
X__data [126]uint8
|
||||
}
|
||||
|
||||
type sysSockaddrInet struct {
|
||||
type sockaddrInet struct {
|
||||
Family uint16
|
||||
Port uint16
|
||||
Addr [4]byte /* in_addr */
|
||||
X__pad [8]uint8
|
||||
}
|
||||
|
||||
type sysInetPktinfo struct {
|
||||
type inetPktinfo struct {
|
||||
Ifindex int32
|
||||
Spec_dst [4]byte /* in_addr */
|
||||
Addr [4]byte /* in_addr */
|
||||
}
|
||||
|
||||
type sysSockExtendedErr struct {
|
||||
type sockExtendedErr struct {
|
||||
Errno uint32
|
||||
Origin uint8
|
||||
Type uint8
|
||||
@ -102,45 +102,45 @@ type sysSockExtendedErr struct {
|
||||
Data uint32
|
||||
}
|
||||
|
||||
type sysIPMreq struct {
|
||||
type ipMreq struct {
|
||||
Multiaddr [4]byte /* in_addr */
|
||||
Interface [4]byte /* in_addr */
|
||||
}
|
||||
|
||||
type sysIPMreqn struct {
|
||||
type ipMreqn struct {
|
||||
Multiaddr [4]byte /* in_addr */
|
||||
Address [4]byte /* in_addr */
|
||||
Ifindex int32
|
||||
}
|
||||
|
||||
type sysIPMreqSource struct {
|
||||
type ipMreqSource struct {
|
||||
Multiaddr uint32
|
||||
Interface uint32
|
||||
Sourceaddr uint32
|
||||
}
|
||||
|
||||
type sysGroupReq struct {
|
||||
type groupReq struct {
|
||||
Interface uint32
|
||||
Group sysKernelSockaddrStorage
|
||||
Group kernelSockaddrStorage
|
||||
}
|
||||
|
||||
type sysGroupSourceReq struct {
|
||||
type groupSourceReq struct {
|
||||
Interface uint32
|
||||
Group sysKernelSockaddrStorage
|
||||
Source sysKernelSockaddrStorage
|
||||
Group kernelSockaddrStorage
|
||||
Source kernelSockaddrStorage
|
||||
}
|
||||
|
||||
type sysICMPFilter struct {
|
||||
type icmpFilter struct {
|
||||
Data uint32
|
||||
}
|
||||
|
||||
type sysSockFProg struct {
|
||||
type sockFProg struct {
|
||||
Len uint16
|
||||
Pad_cgo_0 [2]byte
|
||||
Filter *sysSockFilter
|
||||
Filter *sockFilter
|
||||
}
|
||||
|
||||
type sysSockFilter struct {
|
||||
type sockFilter struct {
|
||||
Code uint16
|
||||
Jt uint8
|
||||
Jf uint8
|
||||
|
56
vendor/golang.org/x/net/ipv4/zsys_linux_ppc64.go
generated
vendored
56
vendor/golang.org/x/net/ipv4/zsys_linux_ppc64.go
generated
vendored
@ -1,8 +1,6 @@
|
||||
// Created by cgo -godefs - DO NOT EDIT
|
||||
// cgo -godefs defs_linux.go
|
||||
|
||||
// +build linux,ppc64
|
||||
|
||||
package ipv4
|
||||
|
||||
const (
|
||||
@ -60,39 +58,41 @@ const (
|
||||
sysSOL_SOCKET = 0x1
|
||||
sysSO_ATTACH_FILTER = 0x1a
|
||||
|
||||
sysSizeofKernelSockaddrStorage = 0x80
|
||||
sysSizeofSockaddrInet = 0x10
|
||||
sysSizeofInetPktinfo = 0xc
|
||||
sysSizeofSockExtendedErr = 0x10
|
||||
sizeofKernelSockaddrStorage = 0x80
|
||||
sizeofSockaddrInet = 0x10
|
||||
sizeofInetPktinfo = 0xc
|
||||
sizeofSockExtendedErr = 0x10
|
||||
|
||||
sysSizeofIPMreq = 0x8
|
||||
sysSizeofIPMreqn = 0xc
|
||||
sysSizeofIPMreqSource = 0xc
|
||||
sysSizeofGroupReq = 0x88
|
||||
sysSizeofGroupSourceReq = 0x108
|
||||
sizeofIPMreq = 0x8
|
||||
sizeofIPMreqn = 0xc
|
||||
sizeofIPMreqSource = 0xc
|
||||
sizeofGroupReq = 0x88
|
||||
sizeofGroupSourceReq = 0x108
|
||||
|
||||
sysSizeofICMPFilter = 0x4
|
||||
sizeofICMPFilter = 0x4
|
||||
|
||||
sizeofSockFprog = 0x10
|
||||
)
|
||||
|
||||
type sysKernelSockaddrStorage struct {
|
||||
type kernelSockaddrStorage struct {
|
||||
Family uint16
|
||||
X__data [126]int8
|
||||
}
|
||||
|
||||
type sysSockaddrInet struct {
|
||||
type sockaddrInet struct {
|
||||
Family uint16
|
||||
Port uint16
|
||||
Addr [4]byte /* in_addr */
|
||||
X__pad [8]uint8
|
||||
}
|
||||
|
||||
type sysInetPktinfo struct {
|
||||
type inetPktinfo struct {
|
||||
Ifindex int32
|
||||
Spec_dst [4]byte /* in_addr */
|
||||
Addr [4]byte /* in_addr */
|
||||
}
|
||||
|
||||
type sysSockExtendedErr struct {
|
||||
type sockExtendedErr struct {
|
||||
Errno uint32
|
||||
Origin uint8
|
||||
Type uint8
|
||||
@ -102,47 +102,47 @@ type sysSockExtendedErr struct {
|
||||
Data uint32
|
||||
}
|
||||
|
||||
type sysIPMreq struct {
|
||||
type ipMreq struct {
|
||||
Multiaddr [4]byte /* in_addr */
|
||||
Interface [4]byte /* in_addr */
|
||||
}
|
||||
|
||||
type sysIPMreqn struct {
|
||||
type ipMreqn struct {
|
||||
Multiaddr [4]byte /* in_addr */
|
||||
Address [4]byte /* in_addr */
|
||||
Ifindex int32
|
||||
}
|
||||
|
||||
type sysIPMreqSource struct {
|
||||
type ipMreqSource struct {
|
||||
Multiaddr uint32
|
||||
Interface uint32
|
||||
Sourceaddr uint32
|
||||
}
|
||||
|
||||
type sysGroupReq struct {
|
||||
type groupReq struct {
|
||||
Interface uint32
|
||||
Pad_cgo_0 [4]byte
|
||||
Group sysKernelSockaddrStorage
|
||||
Group kernelSockaddrStorage
|
||||
}
|
||||
|
||||
type sysGroupSourceReq struct {
|
||||
type groupSourceReq struct {
|
||||
Interface uint32
|
||||
Pad_cgo_0 [4]byte
|
||||
Group sysKernelSockaddrStorage
|
||||
Source sysKernelSockaddrStorage
|
||||
Group kernelSockaddrStorage
|
||||
Source kernelSockaddrStorage
|
||||
}
|
||||
|
||||
type sysICMPFilter struct {
|
||||
type icmpFilter struct {
|
||||
Data uint32
|
||||
}
|
||||
|
||||
type sysSockFProg struct {
|
||||
type sockFProg struct {
|
||||
Len uint16
|
||||
Pad_cgo_0 [6]byte
|
||||
Filter *sysSockFilter
|
||||
Filter *sockFilter
|
||||
}
|
||||
|
||||
type sysSockFilter struct {
|
||||
type sockFilter struct {
|
||||
Code uint16
|
||||
Jt uint8
|
||||
Jf uint8
|
||||
|
56
vendor/golang.org/x/net/ipv4/zsys_linux_ppc64le.go
generated
vendored
56
vendor/golang.org/x/net/ipv4/zsys_linux_ppc64le.go
generated
vendored
@ -1,8 +1,6 @@
|
||||
// Created by cgo -godefs - DO NOT EDIT
|
||||
// cgo -godefs defs_linux.go
|
||||
|
||||
// +build linux,ppc64le
|
||||
|
||||
package ipv4
|
||||
|
||||
const (
|
||||
@ -60,39 +58,41 @@ const (
|
||||
sysSOL_SOCKET = 0x1
|
||||
sysSO_ATTACH_FILTER = 0x1a
|
||||
|
||||
sysSizeofKernelSockaddrStorage = 0x80
|
||||
sysSizeofSockaddrInet = 0x10
|
||||
sysSizeofInetPktinfo = 0xc
|
||||
sysSizeofSockExtendedErr = 0x10
|
||||
sizeofKernelSockaddrStorage = 0x80
|
||||
sizeofSockaddrInet = 0x10
|
||||
sizeofInetPktinfo = 0xc
|
||||
sizeofSockExtendedErr = 0x10
|
||||
|
||||
sysSizeofIPMreq = 0x8
|
||||
sysSizeofIPMreqn = 0xc
|
||||
sysSizeofIPMreqSource = 0xc
|
||||
sysSizeofGroupReq = 0x88
|
||||
sysSizeofGroupSourceReq = 0x108
|
||||
sizeofIPMreq = 0x8
|
||||
sizeofIPMreqn = 0xc
|
||||
sizeofIPMreqSource = 0xc
|
||||
sizeofGroupReq = 0x88
|
||||
sizeofGroupSourceReq = 0x108
|
||||
|
||||
sysSizeofICMPFilter = 0x4
|
||||
sizeofICMPFilter = 0x4
|
||||
|
||||
sizeofSockFprog = 0x10
|
||||
)
|
||||
|
||||
type sysKernelSockaddrStorage struct {
|
||||
type kernelSockaddrStorage struct {
|
||||
Family uint16
|
||||
X__data [126]int8
|
||||
}
|
||||
|
||||
type sysSockaddrInet struct {
|
||||
type sockaddrInet struct {
|
||||
Family uint16
|
||||
Port uint16
|
||||
Addr [4]byte /* in_addr */
|
||||
X__pad [8]uint8
|
||||
}
|
||||
|
||||
type sysInetPktinfo struct {
|
||||
type inetPktinfo struct {
|
||||
Ifindex int32
|
||||
Spec_dst [4]byte /* in_addr */
|
||||
Addr [4]byte /* in_addr */
|
||||
}
|
||||
|
||||
type sysSockExtendedErr struct {
|
||||
type sockExtendedErr struct {
|
||||
Errno uint32
|
||||
Origin uint8
|
||||
Type uint8
|
||||
@ -102,47 +102,47 @@ type sysSockExtendedErr struct {
|
||||
Data uint32
|
||||
}
|
||||
|
||||
type sysIPMreq struct {
|
||||
type ipMreq struct {
|
||||
Multiaddr [4]byte /* in_addr */
|
||||
Interface [4]byte /* in_addr */
|
||||
}
|
||||
|
||||
type sysIPMreqn struct {
|
||||
type ipMreqn struct {
|
||||
Multiaddr [4]byte /* in_addr */
|
||||
Address [4]byte /* in_addr */
|
||||
Ifindex int32
|
||||
}
|
||||
|
||||
type sysIPMreqSource struct {
|
||||
type ipMreqSource struct {
|
||||
Multiaddr uint32
|
||||
Interface uint32
|
||||
Sourceaddr uint32
|
||||
}
|
||||
|
||||
type sysGroupReq struct {
|
||||
type groupReq struct {
|
||||
Interface uint32
|
||||
Pad_cgo_0 [4]byte
|
||||
Group sysKernelSockaddrStorage
|
||||
Group kernelSockaddrStorage
|
||||
}
|
||||
|
||||
type sysGroupSourceReq struct {
|
||||
type groupSourceReq struct {
|
||||
Interface uint32
|
||||
Pad_cgo_0 [4]byte
|
||||
Group sysKernelSockaddrStorage
|
||||
Source sysKernelSockaddrStorage
|
||||
Group kernelSockaddrStorage
|
||||
Source kernelSockaddrStorage
|
||||
}
|
||||
|
||||
type sysICMPFilter struct {
|
||||
type icmpFilter struct {
|
||||
Data uint32
|
||||
}
|
||||
|
||||
type sysSockFProg struct {
|
||||
type sockFProg struct {
|
||||
Len uint16
|
||||
Pad_cgo_0 [6]byte
|
||||
Filter *sysSockFilter
|
||||
Filter *sockFilter
|
||||
}
|
||||
|
||||
type sysSockFilter struct {
|
||||
type sockFilter struct {
|
||||
Code uint16
|
||||
Jt uint8
|
||||
Jf uint8
|
||||
|
56
vendor/golang.org/x/net/ipv4/zsys_linux_s390x.go
generated
vendored
56
vendor/golang.org/x/net/ipv4/zsys_linux_s390x.go
generated
vendored
@ -1,8 +1,6 @@
|
||||
// Created by cgo -godefs - DO NOT EDIT
|
||||
// cgo -godefs defs_linux.go
|
||||
|
||||
// +build linux,s390x
|
||||
|
||||
package ipv4
|
||||
|
||||
const (
|
||||
@ -60,39 +58,41 @@ const (
|
||||
sysSOL_SOCKET = 0x1
|
||||
sysSO_ATTACH_FILTER = 0x1a
|
||||
|
||||
sysSizeofKernelSockaddrStorage = 0x80
|
||||
sysSizeofSockaddrInet = 0x10
|
||||
sysSizeofInetPktinfo = 0xc
|
||||
sysSizeofSockExtendedErr = 0x10
|
||||
sizeofKernelSockaddrStorage = 0x80
|
||||
sizeofSockaddrInet = 0x10
|
||||
sizeofInetPktinfo = 0xc
|
||||
sizeofSockExtendedErr = 0x10
|
||||
|
||||
sysSizeofIPMreq = 0x8
|
||||
sysSizeofIPMreqn = 0xc
|
||||
sysSizeofIPMreqSource = 0xc
|
||||
sysSizeofGroupReq = 0x88
|
||||
sysSizeofGroupSourceReq = 0x108
|
||||
sizeofIPMreq = 0x8
|
||||
sizeofIPMreqn = 0xc
|
||||
sizeofIPMreqSource = 0xc
|
||||
sizeofGroupReq = 0x88
|
||||
sizeofGroupSourceReq = 0x108
|
||||
|
||||
sysSizeofICMPFilter = 0x4
|
||||
sizeofICMPFilter = 0x4
|
||||
|
||||
sizeofSockFprog = 0x10
|
||||
)
|
||||
|
||||
type sysKernelSockaddrStorage struct {
|
||||
type kernelSockaddrStorage struct {
|
||||
Family uint16
|
||||
X__data [126]int8
|
||||
}
|
||||
|
||||
type sysSockaddrInet struct {
|
||||
type sockaddrInet struct {
|
||||
Family uint16
|
||||
Port uint16
|
||||
Addr [4]byte /* in_addr */
|
||||
X__pad [8]uint8
|
||||
}
|
||||
|
||||
type sysInetPktinfo struct {
|
||||
type inetPktinfo struct {
|
||||
Ifindex int32
|
||||
Spec_dst [4]byte /* in_addr */
|
||||
Addr [4]byte /* in_addr */
|
||||
}
|
||||
|
||||
type sysSockExtendedErr struct {
|
||||
type sockExtendedErr struct {
|
||||
Errno uint32
|
||||
Origin uint8
|
||||
Type uint8
|
||||
@ -102,47 +102,47 @@ type sysSockExtendedErr struct {
|
||||
Data uint32
|
||||
}
|
||||
|
||||
type sysIPMreq struct {
|
||||
type ipMreq struct {
|
||||
Multiaddr [4]byte /* in_addr */
|
||||
Interface [4]byte /* in_addr */
|
||||
}
|
||||
|
||||
type sysIPMreqn struct {
|
||||
type ipMreqn struct {
|
||||
Multiaddr [4]byte /* in_addr */
|
||||
Address [4]byte /* in_addr */
|
||||
Ifindex int32
|
||||
}
|
||||
|
||||
type sysIPMreqSource struct {
|
||||
type ipMreqSource struct {
|
||||
Multiaddr uint32
|
||||
Interface uint32
|
||||
Sourceaddr uint32
|
||||
}
|
||||
|
||||
type sysGroupReq struct {
|
||||
type groupReq struct {
|
||||
Interface uint32
|
||||
Pad_cgo_0 [4]byte
|
||||
Group sysKernelSockaddrStorage
|
||||
Group kernelSockaddrStorage
|
||||
}
|
||||
|
||||
type sysGroupSourceReq struct {
|
||||
type groupSourceReq struct {
|
||||
Interface uint32
|
||||
Pad_cgo_0 [4]byte
|
||||
Group sysKernelSockaddrStorage
|
||||
Source sysKernelSockaddrStorage
|
||||
Group kernelSockaddrStorage
|
||||
Source kernelSockaddrStorage
|
||||
}
|
||||
|
||||
type sysICMPFilter struct {
|
||||
type icmpFilter struct {
|
||||
Data uint32
|
||||
}
|
||||
|
||||
type sysSockFProg struct {
|
||||
type sockFProg struct {
|
||||
Len uint16
|
||||
Pad_cgo_0 [6]byte
|
||||
Filter *sysSockFilter
|
||||
Filter *sockFilter
|
||||
}
|
||||
|
||||
type sysSockFilter struct {
|
||||
type sockFilter struct {
|
||||
Code uint16
|
||||
Jt uint8
|
||||
Jf uint8
|
||||
|
4
vendor/golang.org/x/net/ipv4/zsys_netbsd.go
generated
vendored
4
vendor/golang.org/x/net/ipv4/zsys_netbsd.go
generated
vendored
@ -21,10 +21,10 @@ const (
|
||||
sysIP_ADD_MEMBERSHIP = 0xc
|
||||
sysIP_DROP_MEMBERSHIP = 0xd
|
||||
|
||||
sysSizeofIPMreq = 0x8
|
||||
sizeofIPMreq = 0x8
|
||||
)
|
||||
|
||||
type sysIPMreq struct {
|
||||
type ipMreq struct {
|
||||
Multiaddr [4]byte /* in_addr */
|
||||
Interface [4]byte /* in_addr */
|
||||
}
|
||||
|
4
vendor/golang.org/x/net/ipv4/zsys_openbsd.go
generated
vendored
4
vendor/golang.org/x/net/ipv4/zsys_openbsd.go
generated
vendored
@ -21,10 +21,10 @@ const (
|
||||
sysIP_ADD_MEMBERSHIP = 0xc
|
||||
sysIP_DROP_MEMBERSHIP = 0xd
|
||||
|
||||
sysSizeofIPMreq = 0x8
|
||||
sizeofIPMreq = 0x8
|
||||
)
|
||||
|
||||
type sysIPMreq struct {
|
||||
type ipMreq struct {
|
||||
Multiaddr [4]byte /* in_addr */
|
||||
Interface [4]byte /* in_addr */
|
||||
}
|
||||
|
94
vendor/golang.org/x/net/ipv4/zsys_solaris.go
generated
vendored
94
vendor/golang.org/x/net/ipv4/zsys_solaris.go
generated
vendored
@ -1,30 +1,20 @@
|
||||
// Created by cgo -godefs - DO NOT EDIT
|
||||
// cgo -godefs defs_solaris.go
|
||||
|
||||
// +build solaris
|
||||
|
||||
package ipv4
|
||||
|
||||
const (
|
||||
sysIP_OPTIONS = 0x1
|
||||
sysIP_HDRINCL = 0x2
|
||||
sysIP_TOS = 0x3
|
||||
sysIP_TTL = 0x4
|
||||
sysIP_RECVOPTS = 0x5
|
||||
sysIP_RECVRETOPTS = 0x6
|
||||
sysIP_RECVDSTADDR = 0x7
|
||||
sysIP_RETOPTS = 0x8
|
||||
sysIP_RECVIF = 0x9
|
||||
sysIP_RECVSLLA = 0xa
|
||||
sysIP_RECVTTL = 0xb
|
||||
sysIP_NEXTHOP = 0x19
|
||||
sysIP_PKTINFO = 0x1a
|
||||
sysIP_RECVPKTINFO = 0x1a
|
||||
sysIP_DONTFRAG = 0x1b
|
||||
sysIP_BOUND_IF = 0x41
|
||||
sysIP_UNSPEC_SRC = 0x42
|
||||
sysIP_BROADCAST_TTL = 0x43
|
||||
sysIP_DHCPINIT_IF = 0x45
|
||||
sysIP_OPTIONS = 0x1
|
||||
sysIP_HDRINCL = 0x2
|
||||
sysIP_TOS = 0x3
|
||||
sysIP_TTL = 0x4
|
||||
sysIP_RECVOPTS = 0x5
|
||||
sysIP_RECVRETOPTS = 0x6
|
||||
sysIP_RECVDSTADDR = 0x7
|
||||
sysIP_RETOPTS = 0x8
|
||||
sysIP_RECVIF = 0x9
|
||||
sysIP_RECVSLLA = 0xa
|
||||
sysIP_RECVTTL = 0xb
|
||||
|
||||
sysIP_MULTICAST_IF = 0x10
|
||||
sysIP_MULTICAST_TTL = 0x11
|
||||
@ -35,26 +25,76 @@ const (
|
||||
sysIP_UNBLOCK_SOURCE = 0x16
|
||||
sysIP_ADD_SOURCE_MEMBERSHIP = 0x17
|
||||
sysIP_DROP_SOURCE_MEMBERSHIP = 0x18
|
||||
sysIP_NEXTHOP = 0x19
|
||||
|
||||
sysSizeofInetPktinfo = 0xc
|
||||
sysIP_PKTINFO = 0x1a
|
||||
sysIP_RECVPKTINFO = 0x1a
|
||||
sysIP_DONTFRAG = 0x1b
|
||||
|
||||
sysSizeofIPMreq = 0x8
|
||||
sysSizeofIPMreqSource = 0xc
|
||||
sysIP_BOUND_IF = 0x41
|
||||
sysIP_UNSPEC_SRC = 0x42
|
||||
sysIP_BROADCAST_TTL = 0x43
|
||||
sysIP_DHCPINIT_IF = 0x45
|
||||
|
||||
sysIP_REUSEADDR = 0x104
|
||||
sysIP_DONTROUTE = 0x105
|
||||
sysIP_BROADCAST = 0x106
|
||||
|
||||
sysMCAST_JOIN_GROUP = 0x29
|
||||
sysMCAST_LEAVE_GROUP = 0x2a
|
||||
sysMCAST_BLOCK_SOURCE = 0x2b
|
||||
sysMCAST_UNBLOCK_SOURCE = 0x2c
|
||||
sysMCAST_JOIN_SOURCE_GROUP = 0x2d
|
||||
sysMCAST_LEAVE_SOURCE_GROUP = 0x2e
|
||||
|
||||
sizeofSockaddrStorage = 0x100
|
||||
sizeofSockaddrInet = 0x10
|
||||
sizeofInetPktinfo = 0xc
|
||||
|
||||
sizeofIPMreq = 0x8
|
||||
sizeofIPMreqSource = 0xc
|
||||
sizeofGroupReq = 0x104
|
||||
sizeofGroupSourceReq = 0x204
|
||||
)
|
||||
|
||||
type sysInetPktinfo struct {
|
||||
type sockaddrStorage struct {
|
||||
Family uint16
|
||||
X_ss_pad1 [6]int8
|
||||
X_ss_align float64
|
||||
X_ss_pad2 [240]int8
|
||||
}
|
||||
|
||||
type sockaddrInet struct {
|
||||
Family uint16
|
||||
Port uint16
|
||||
Addr [4]byte /* in_addr */
|
||||
Zero [8]int8
|
||||
}
|
||||
|
||||
type inetPktinfo struct {
|
||||
Ifindex uint32
|
||||
Spec_dst [4]byte /* in_addr */
|
||||
Addr [4]byte /* in_addr */
|
||||
}
|
||||
|
||||
type sysIPMreq struct {
|
||||
type ipMreq struct {
|
||||
Multiaddr [4]byte /* in_addr */
|
||||
Interface [4]byte /* in_addr */
|
||||
}
|
||||
|
||||
type sysIPMreqSource struct {
|
||||
type ipMreqSource struct {
|
||||
Multiaddr [4]byte /* in_addr */
|
||||
Sourceaddr [4]byte /* in_addr */
|
||||
Interface [4]byte /* in_addr */
|
||||
}
|
||||
|
||||
type groupReq struct {
|
||||
Interface uint32
|
||||
Pad_cgo_0 [256]byte
|
||||
}
|
||||
|
||||
type groupSourceReq struct {
|
||||
Interface uint32
|
||||
Pad_cgo_0 [256]byte
|
||||
Pad_cgo_1 [256]byte
|
||||
}
|
||||
|
Reference in New Issue
Block a user