mirror of
https://github.com/fatedier/frp.git
synced 2026-01-11 22:23:12 +00:00
vendor: add kcp-go package
This commit is contained in:
3
vendor/golang.org/x/net/AUTHORS
generated
vendored
Normal file
3
vendor/golang.org/x/net/AUTHORS
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
# This source code refers to The Go Authors for copyright purposes.
|
||||
# The master list of authors is in the main Go distribution,
|
||||
# visible at http://tip.golang.org/AUTHORS.
|
||||
3
vendor/golang.org/x/net/CONTRIBUTORS
generated
vendored
Normal file
3
vendor/golang.org/x/net/CONTRIBUTORS
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
# This source code was written by the Go contributors.
|
||||
# The master list of contributors is in the main Go distribution,
|
||||
# visible at http://tip.golang.org/CONTRIBUTORS.
|
||||
27
vendor/golang.org/x/net/LICENSE
generated
vendored
Normal file
27
vendor/golang.org/x/net/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
Copyright (c) 2009 The Go Authors. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the following disclaimer
|
||||
in the documentation and/or other materials provided with the
|
||||
distribution.
|
||||
* Neither the name of Google Inc. nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
22
vendor/golang.org/x/net/PATENTS
generated
vendored
Normal file
22
vendor/golang.org/x/net/PATENTS
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
Additional IP Rights Grant (Patents)
|
||||
|
||||
"This implementation" means the copyrightable works distributed by
|
||||
Google as part of the Go project.
|
||||
|
||||
Google hereby grants to You a perpetual, worldwide, non-exclusive,
|
||||
no-charge, royalty-free, irrevocable (except as stated in this section)
|
||||
patent license to make, have made, use, offer to sell, sell, import,
|
||||
transfer and otherwise run, modify and propagate the contents of this
|
||||
implementation of Go, where such license applies only to those patent
|
||||
claims, both currently owned or controlled by Google and acquired in
|
||||
the future, licensable by Google that are necessarily infringed by this
|
||||
implementation of Go. This grant does not include claims that would be
|
||||
infringed only as a consequence of further modification of this
|
||||
implementation. If you or your agent or exclusive licensee institute or
|
||||
order or agree to the institution of patent litigation against any
|
||||
entity (including a cross-claim or counterclaim in a lawsuit) alleging
|
||||
that this implementation of Go or any code incorporated within this
|
||||
implementation of Go constitutes direct or contributory patent
|
||||
infringement, or inducement of patent infringement, then any patent
|
||||
rights granted to you under this License for this implementation of Go
|
||||
shall terminate as of the date such litigation is filed.
|
||||
41
vendor/golang.org/x/net/bpf/asm.go
generated
vendored
Normal file
41
vendor/golang.org/x/net/bpf/asm.go
generated
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
// 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 bpf
|
||||
|
||||
import "fmt"
|
||||
|
||||
// Assemble converts insts into raw instructions suitable for loading
|
||||
// into a BPF virtual machine.
|
||||
//
|
||||
// Currently, no optimization is attempted, the assembled program flow
|
||||
// is exactly as provided.
|
||||
func Assemble(insts []Instruction) ([]RawInstruction, error) {
|
||||
ret := make([]RawInstruction, len(insts))
|
||||
var err error
|
||||
for i, inst := range insts {
|
||||
ret[i], err = inst.Assemble()
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("assembling instruction %d: %s", i+1, err)
|
||||
}
|
||||
}
|
||||
return ret, nil
|
||||
}
|
||||
|
||||
// Disassemble attempts to parse raw back into
|
||||
// Instructions. Unrecognized RawInstructions are assumed to be an
|
||||
// extension not implemented by this package, and are passed through
|
||||
// unchanged to the output. The allDecoded value reports whether insts
|
||||
// contains no RawInstructions.
|
||||
func Disassemble(raw []RawInstruction) (insts []Instruction, allDecoded bool) {
|
||||
insts = make([]Instruction, len(raw))
|
||||
allDecoded = true
|
||||
for i, r := range raw {
|
||||
insts[i] = r.Disassemble()
|
||||
if _, ok := insts[i].(RawInstruction); ok {
|
||||
allDecoded = false
|
||||
}
|
||||
}
|
||||
return insts, allDecoded
|
||||
}
|
||||
215
vendor/golang.org/x/net/bpf/constants.go
generated
vendored
Normal file
215
vendor/golang.org/x/net/bpf/constants.go
generated
vendored
Normal file
@@ -0,0 +1,215 @@
|
||||
// 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 bpf
|
||||
|
||||
// A Register is a register of the BPF virtual machine.
|
||||
type Register uint16
|
||||
|
||||
const (
|
||||
// RegA is the accumulator register. RegA is always the
|
||||
// destination register of ALU operations.
|
||||
RegA Register = iota
|
||||
// RegX is the indirection register, used by LoadIndirect
|
||||
// operations.
|
||||
RegX
|
||||
)
|
||||
|
||||
// An ALUOp is an arithmetic or logic operation.
|
||||
type ALUOp uint16
|
||||
|
||||
// ALU binary operation types.
|
||||
const (
|
||||
ALUOpAdd ALUOp = iota << 4
|
||||
ALUOpSub
|
||||
ALUOpMul
|
||||
ALUOpDiv
|
||||
ALUOpOr
|
||||
ALUOpAnd
|
||||
ALUOpShiftLeft
|
||||
ALUOpShiftRight
|
||||
aluOpNeg // Not exported because it's the only unary ALU operation, and gets its own instruction type.
|
||||
ALUOpMod
|
||||
ALUOpXor
|
||||
)
|
||||
|
||||
// A JumpTest is a comparison operator used in conditional jumps.
|
||||
type JumpTest uint16
|
||||
|
||||
// Supported operators for conditional jumps.
|
||||
const (
|
||||
// K == A
|
||||
JumpEqual JumpTest = iota
|
||||
// K != A
|
||||
JumpNotEqual
|
||||
// K > A
|
||||
JumpGreaterThan
|
||||
// K < A
|
||||
JumpLessThan
|
||||
// K >= A
|
||||
JumpGreaterOrEqual
|
||||
// K <= A
|
||||
JumpLessOrEqual
|
||||
// K & A != 0
|
||||
JumpBitsSet
|
||||
// K & A == 0
|
||||
JumpBitsNotSet
|
||||
)
|
||||
|
||||
// An Extension is a function call provided by the kernel that
|
||||
// performs advanced operations that are expensive or impossible
|
||||
// within the BPF virtual machine.
|
||||
//
|
||||
// Extensions are only implemented by the Linux kernel.
|
||||
//
|
||||
// TODO: should we prune this list? Some of these extensions seem
|
||||
// either broken or near-impossible to use correctly, whereas other
|
||||
// (len, random, ifindex) are quite useful.
|
||||
type Extension int
|
||||
|
||||
// Extension functions available in the Linux kernel.
|
||||
const (
|
||||
// ExtLen returns the length of the packet.
|
||||
ExtLen Extension = 1
|
||||
// ExtProto returns the packet's L3 protocol type.
|
||||
ExtProto = 0
|
||||
// ExtType returns the packet's type (skb->pkt_type in the kernel)
|
||||
//
|
||||
// TODO: better documentation. How nice an API do we want to
|
||||
// provide for these esoteric extensions?
|
||||
ExtType = 4
|
||||
// ExtPayloadOffset returns the offset of the packet payload, or
|
||||
// the first protocol header that the kernel does not know how to
|
||||
// parse.
|
||||
ExtPayloadOffset = 52
|
||||
// ExtInterfaceIndex returns the index of the interface on which
|
||||
// the packet was received.
|
||||
ExtInterfaceIndex = 8
|
||||
// ExtNetlinkAttr returns the netlink attribute of type X at
|
||||
// offset A.
|
||||
ExtNetlinkAttr = 12
|
||||
// ExtNetlinkAttrNested returns the nested netlink attribute of
|
||||
// type X at offset A.
|
||||
ExtNetlinkAttrNested = 16
|
||||
// ExtMark returns the packet's mark value.
|
||||
ExtMark = 20
|
||||
// ExtQueue returns the packet's assigned hardware queue.
|
||||
ExtQueue = 24
|
||||
// ExtLinkLayerType returns the packet's hardware address type
|
||||
// (e.g. Ethernet, Infiniband).
|
||||
ExtLinkLayerType = 28
|
||||
// ExtRXHash returns the packets receive hash.
|
||||
//
|
||||
// TODO: figure out what this rxhash actually is.
|
||||
ExtRXHash = 32
|
||||
// ExtCPUID returns the ID of the CPU processing the current
|
||||
// packet.
|
||||
ExtCPUID = 36
|
||||
// ExtVLANTag returns the packet's VLAN tag.
|
||||
ExtVLANTag = 44
|
||||
// ExtVLANTagPresent returns non-zero if the packet has a VLAN
|
||||
// tag.
|
||||
//
|
||||
// TODO: I think this might be a lie: it reads bit 0x1000 of the
|
||||
// VLAN header, which changed meaning in recent revisions of the
|
||||
// spec - this extension may now return meaningless information.
|
||||
ExtVLANTagPresent = 48
|
||||
// ExtVLANProto returns 0x8100 if the frame has a VLAN header,
|
||||
// 0x88a8 if the frame has a "Q-in-Q" double VLAN header, or some
|
||||
// other value if no VLAN information is present.
|
||||
ExtVLANProto = 60
|
||||
// ExtRand returns a uniformly random uint32.
|
||||
ExtRand = 56
|
||||
)
|
||||
|
||||
// The following gives names to various bit patterns used in opcode construction.
|
||||
|
||||
const (
|
||||
opMaskCls uint16 = 0x7
|
||||
// opClsLoad masks
|
||||
opMaskLoadDest = 0x01
|
||||
opMaskLoadWidth = 0x18
|
||||
opMaskLoadMode = 0xe0
|
||||
// opClsALU
|
||||
opMaskOperandSrc = 0x08
|
||||
opMaskOperator = 0xf0
|
||||
// opClsJump
|
||||
opMaskJumpConst = 0x0f
|
||||
opMaskJumpCond = 0xf0
|
||||
)
|
||||
|
||||
const (
|
||||
// +---------------+-----------------+---+---+---+
|
||||
// | AddrMode (3b) | LoadWidth (2b) | 0 | 0 | 0 |
|
||||
// +---------------+-----------------+---+---+---+
|
||||
opClsLoadA uint16 = iota
|
||||
// +---------------+-----------------+---+---+---+
|
||||
// | AddrMode (3b) | LoadWidth (2b) | 0 | 0 | 1 |
|
||||
// +---------------+-----------------+---+---+---+
|
||||
opClsLoadX
|
||||
// +---+---+---+---+---+---+---+---+
|
||||
// | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 |
|
||||
// +---+---+---+---+---+---+---+---+
|
||||
opClsStoreA
|
||||
// +---+---+---+---+---+---+---+---+
|
||||
// | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 |
|
||||
// +---+---+---+---+---+---+---+---+
|
||||
opClsStoreX
|
||||
// +---------------+-----------------+---+---+---+
|
||||
// | Operator (4b) | OperandSrc (1b) | 1 | 0 | 0 |
|
||||
// +---------------+-----------------+---+---+---+
|
||||
opClsALU
|
||||
// +-----------------------------+---+---+---+---+
|
||||
// | TestOperator (4b) | 0 | 1 | 0 | 1 |
|
||||
// +-----------------------------+---+---+---+---+
|
||||
opClsJump
|
||||
// +---+-------------------------+---+---+---+---+
|
||||
// | 0 | 0 | 0 | RetSrc (1b) | 0 | 1 | 1 | 0 |
|
||||
// +---+-------------------------+---+---+---+---+
|
||||
opClsReturn
|
||||
// +---+-------------------------+---+---+---+---+
|
||||
// | 0 | 0 | 0 | TXAorTAX (1b) | 0 | 1 | 1 | 1 |
|
||||
// +---+-------------------------+---+---+---+---+
|
||||
opClsMisc
|
||||
)
|
||||
|
||||
const (
|
||||
opAddrModeImmediate uint16 = iota << 5
|
||||
opAddrModeAbsolute
|
||||
opAddrModeIndirect
|
||||
opAddrModeScratch
|
||||
opAddrModePacketLen // actually an extension, not an addressing mode.
|
||||
opAddrModeMemShift
|
||||
)
|
||||
|
||||
const (
|
||||
opLoadWidth4 uint16 = iota << 3
|
||||
opLoadWidth2
|
||||
opLoadWidth1
|
||||
)
|
||||
|
||||
// Operator defined by ALUOp*
|
||||
|
||||
const (
|
||||
opALUSrcConstant uint16 = iota << 3
|
||||
opALUSrcX
|
||||
)
|
||||
|
||||
const (
|
||||
opJumpAlways = iota << 4
|
||||
opJumpEqual
|
||||
opJumpGT
|
||||
opJumpGE
|
||||
opJumpSet
|
||||
)
|
||||
|
||||
const (
|
||||
opRetSrcConstant uint16 = iota << 4
|
||||
opRetSrcA
|
||||
)
|
||||
|
||||
const (
|
||||
opMiscTAX = 0x00
|
||||
opMiscTXA = 0x80
|
||||
)
|
||||
81
vendor/golang.org/x/net/bpf/doc.go
generated
vendored
Normal file
81
vendor/golang.org/x/net/bpf/doc.go
generated
vendored
Normal file
@@ -0,0 +1,81 @@
|
||||
// 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 bpf implements marshaling and unmarshaling of programs for the
|
||||
Berkeley Packet Filter virtual machine.
|
||||
|
||||
BPF's main use is to specify a packet filter for network taps, so that
|
||||
the kernel doesn't have to expensively copy every packet it sees to
|
||||
userspace. However, it's been repurposed to other areas where running
|
||||
user code in-kernel is needed. For example, Linux's seccomp uses BPF
|
||||
to apply security policies to system calls. For simplicity, this
|
||||
documentation refers only to packets, but other uses of BPF have their
|
||||
own data payloads.
|
||||
|
||||
BPF programs run in a restricted virtual machine. It has almost no
|
||||
access to kernel functions, and while conditional branches are
|
||||
allowed, they can only jump forwards, to guarantee that there are no
|
||||
infinite loops.
|
||||
|
||||
The virtual machine
|
||||
|
||||
The BPF VM is an accumulator machine. Its main register, called
|
||||
register A, is an implicit source and destination in all arithmetic
|
||||
and logic operations. The machine also has 16 scratch registers for
|
||||
temporary storage, and an indirection register (register X) for
|
||||
indirect memory access. All registers are 32 bits wide.
|
||||
|
||||
Each run of a BPF program is given one packet, which is placed in the
|
||||
VM's read-only "main memory". LoadAbsolute and LoadIndirect
|
||||
instructions can fetch up to 32 bits at a time into register A for
|
||||
examination.
|
||||
|
||||
The goal of a BPF program is to produce and return a verdict (uint32),
|
||||
which tells the kernel what to do with the packet. In the context of
|
||||
packet filtering, the returned value is the number of bytes of the
|
||||
packet to forward to userspace, or 0 to ignore the packet. Other
|
||||
contexts like seccomp define their own return values.
|
||||
|
||||
In order to simplify programs, attempts to read past the end of the
|
||||
packet terminate the program execution with a verdict of 0 (ignore
|
||||
packet). This means that the vast majority of BPF programs don't need
|
||||
to do any explicit bounds checking.
|
||||
|
||||
In addition to the bytes of the packet, some BPF programs have access
|
||||
to extensions, which are essentially calls to kernel utility
|
||||
functions. Currently, the only extensions supported by this package
|
||||
are the Linux packet filter extensions.
|
||||
|
||||
Examples
|
||||
|
||||
This packet filter selects all ARP packets.
|
||||
|
||||
bpf.Assemble([]bpf.Instruction{
|
||||
// Load "EtherType" field from the ethernet header.
|
||||
bpf.LoadAbsolute{Off: 12, Size: 2},
|
||||
// Skip over the next instruction if EtherType is not ARP.
|
||||
bpf.JumpIf{Cond: bpf.JumpNotEqual, Val: 0x0806, SkipTrue: 1},
|
||||
// Verdict is "send up to 4k of the packet to userspace."
|
||||
bpf.RetConstant{Val: 4096},
|
||||
// Verdict is "ignore packet."
|
||||
bpf.RetConstant{Val: 0},
|
||||
})
|
||||
|
||||
This packet filter captures a random 1% sample of traffic.
|
||||
|
||||
bpf.Assemble([]bpf.Instruction{
|
||||
// Get a 32-bit random number from the Linux kernel.
|
||||
bpf.LoadExtension{Num: bpf.ExtRand},
|
||||
// 1% dice roll?
|
||||
bpf.JumpIf{Cond: bpf.JumpLessThan, Val: 2^32/100, SkipFalse: 1},
|
||||
// Capture.
|
||||
bpf.RetConstant{Val: 4096},
|
||||
// Ignore.
|
||||
bpf.RetConstant{Val: 0},
|
||||
})
|
||||
|
||||
*/
|
||||
package bpf
|
||||
434
vendor/golang.org/x/net/bpf/instructions.go
generated
vendored
Normal file
434
vendor/golang.org/x/net/bpf/instructions.go
generated
vendored
Normal file
@@ -0,0 +1,434 @@
|
||||
// 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 bpf
|
||||
|
||||
import "fmt"
|
||||
|
||||
// An Instruction is one instruction executed by the BPF virtual
|
||||
// machine.
|
||||
type Instruction interface {
|
||||
// Assemble assembles the Instruction into a RawInstruction.
|
||||
Assemble() (RawInstruction, error)
|
||||
}
|
||||
|
||||
// A RawInstruction is a raw BPF virtual machine instruction.
|
||||
type RawInstruction struct {
|
||||
// Operation to execute.
|
||||
Op uint16
|
||||
// For conditional jump instructions, the number of instructions
|
||||
// to skip if the condition is true/false.
|
||||
Jt uint8
|
||||
Jf uint8
|
||||
// Constant parameter. The meaning depends on the Op.
|
||||
K uint32
|
||||
}
|
||||
|
||||
// Assemble implements the Instruction Assemble method.
|
||||
func (ri RawInstruction) Assemble() (RawInstruction, error) { return ri, nil }
|
||||
|
||||
// Disassemble parses ri into an Instruction and returns it. If ri is
|
||||
// not recognized by this package, ri itself is returned.
|
||||
func (ri RawInstruction) Disassemble() Instruction {
|
||||
switch ri.Op & opMaskCls {
|
||||
case opClsLoadA, opClsLoadX:
|
||||
reg := Register(ri.Op & opMaskLoadDest)
|
||||
sz := 0
|
||||
switch ri.Op & opMaskLoadWidth {
|
||||
case opLoadWidth4:
|
||||
sz = 4
|
||||
case opLoadWidth2:
|
||||
sz = 2
|
||||
case opLoadWidth1:
|
||||
sz = 1
|
||||
default:
|
||||
return ri
|
||||
}
|
||||
switch ri.Op & opMaskLoadMode {
|
||||
case opAddrModeImmediate:
|
||||
if sz != 4 {
|
||||
return ri
|
||||
}
|
||||
return LoadConstant{Dst: reg, Val: ri.K}
|
||||
case opAddrModeScratch:
|
||||
if sz != 4 || ri.K > 15 {
|
||||
return ri
|
||||
}
|
||||
return LoadScratch{Dst: reg, N: int(ri.K)}
|
||||
case opAddrModeAbsolute:
|
||||
return LoadAbsolute{Size: sz, Off: ri.K}
|
||||
case opAddrModeIndirect:
|
||||
return LoadIndirect{Size: sz, Off: ri.K}
|
||||
case opAddrModePacketLen:
|
||||
if sz != 4 {
|
||||
return ri
|
||||
}
|
||||
return LoadExtension{Num: ExtLen}
|
||||
case opAddrModeMemShift:
|
||||
return LoadMemShift{Off: ri.K}
|
||||
default:
|
||||
return ri
|
||||
}
|
||||
|
||||
case opClsStoreA:
|
||||
if ri.Op != opClsStoreA || ri.K > 15 {
|
||||
return ri
|
||||
}
|
||||
return StoreScratch{Src: RegA, N: int(ri.K)}
|
||||
|
||||
case opClsStoreX:
|
||||
if ri.Op != opClsStoreX || ri.K > 15 {
|
||||
return ri
|
||||
}
|
||||
return StoreScratch{Src: RegX, N: int(ri.K)}
|
||||
|
||||
case opClsALU:
|
||||
switch op := ALUOp(ri.Op & opMaskOperator); op {
|
||||
case ALUOpAdd, ALUOpSub, ALUOpMul, ALUOpDiv, ALUOpOr, ALUOpAnd, ALUOpShiftLeft, ALUOpShiftRight, ALUOpMod, ALUOpXor:
|
||||
if ri.Op&opMaskOperandSrc != 0 {
|
||||
return ALUOpX{Op: op}
|
||||
}
|
||||
return ALUOpConstant{Op: op, Val: ri.K}
|
||||
case aluOpNeg:
|
||||
return NegateA{}
|
||||
default:
|
||||
return ri
|
||||
}
|
||||
|
||||
case opClsJump:
|
||||
if ri.Op&opMaskJumpConst != opClsJump {
|
||||
return ri
|
||||
}
|
||||
switch ri.Op & opMaskJumpCond {
|
||||
case opJumpAlways:
|
||||
return Jump{Skip: ri.K}
|
||||
case opJumpEqual:
|
||||
return JumpIf{
|
||||
Cond: JumpEqual,
|
||||
Val: ri.K,
|
||||
SkipTrue: ri.Jt,
|
||||
SkipFalse: ri.Jf,
|
||||
}
|
||||
case opJumpGT:
|
||||
return JumpIf{
|
||||
Cond: JumpGreaterThan,
|
||||
Val: ri.K,
|
||||
SkipTrue: ri.Jt,
|
||||
SkipFalse: ri.Jf,
|
||||
}
|
||||
case opJumpGE:
|
||||
return JumpIf{
|
||||
Cond: JumpGreaterOrEqual,
|
||||
Val: ri.K,
|
||||
SkipTrue: ri.Jt,
|
||||
SkipFalse: ri.Jf,
|
||||
}
|
||||
case opJumpSet:
|
||||
return JumpIf{
|
||||
Cond: JumpBitsSet,
|
||||
Val: ri.K,
|
||||
SkipTrue: ri.Jt,
|
||||
SkipFalse: ri.Jf,
|
||||
}
|
||||
default:
|
||||
return ri
|
||||
}
|
||||
|
||||
case opClsReturn:
|
||||
switch ri.Op {
|
||||
case opClsReturn | opRetSrcA:
|
||||
return RetA{}
|
||||
case opClsReturn | opRetSrcConstant:
|
||||
return RetConstant{Val: ri.K}
|
||||
default:
|
||||
return ri
|
||||
}
|
||||
|
||||
case opClsMisc:
|
||||
switch ri.Op {
|
||||
case opClsMisc | opMiscTAX:
|
||||
return TAX{}
|
||||
case opClsMisc | opMiscTXA:
|
||||
return TXA{}
|
||||
default:
|
||||
return ri
|
||||
}
|
||||
|
||||
default:
|
||||
panic("unreachable") // switch is exhaustive on the bit pattern
|
||||
}
|
||||
}
|
||||
|
||||
// LoadConstant loads Val into register Dst.
|
||||
type LoadConstant struct {
|
||||
Dst Register
|
||||
Val uint32
|
||||
}
|
||||
|
||||
// Assemble implements the Instruction Assemble method.
|
||||
func (a LoadConstant) Assemble() (RawInstruction, error) {
|
||||
return assembleLoad(a.Dst, 4, opAddrModeImmediate, a.Val)
|
||||
}
|
||||
|
||||
// LoadScratch loads scratch[N] into register Dst.
|
||||
type LoadScratch struct {
|
||||
Dst Register
|
||||
N int // 0-15
|
||||
}
|
||||
|
||||
// Assemble implements the Instruction Assemble method.
|
||||
func (a LoadScratch) Assemble() (RawInstruction, error) {
|
||||
if a.N < 0 || a.N > 15 {
|
||||
return RawInstruction{}, fmt.Errorf("invalid scratch slot %d", a.N)
|
||||
}
|
||||
return assembleLoad(a.Dst, 4, opAddrModeScratch, uint32(a.N))
|
||||
}
|
||||
|
||||
// LoadAbsolute loads packet[Off:Off+Size] as an integer value into
|
||||
// register A.
|
||||
type LoadAbsolute struct {
|
||||
Off uint32
|
||||
Size int // 1, 2 or 4
|
||||
}
|
||||
|
||||
// Assemble implements the Instruction Assemble method.
|
||||
func (a LoadAbsolute) Assemble() (RawInstruction, error) {
|
||||
return assembleLoad(RegA, a.Size, opAddrModeAbsolute, a.Off)
|
||||
}
|
||||
|
||||
// LoadIndirect loads packet[X+Off:X+Off+Size] as an integer value
|
||||
// into register A.
|
||||
type LoadIndirect struct {
|
||||
Off uint32
|
||||
Size int // 1, 2 or 4
|
||||
}
|
||||
|
||||
// Assemble implements the Instruction Assemble method.
|
||||
func (a LoadIndirect) Assemble() (RawInstruction, error) {
|
||||
return assembleLoad(RegA, a.Size, opAddrModeIndirect, a.Off)
|
||||
}
|
||||
|
||||
// LoadMemShift multiplies the first 4 bits of the byte at packet[Off]
|
||||
// by 4 and stores the result in register X.
|
||||
//
|
||||
// This instruction is mainly useful to load into X the length of an
|
||||
// IPv4 packet header in a single instruction, rather than have to do
|
||||
// the arithmetic on the header's first byte by hand.
|
||||
type LoadMemShift struct {
|
||||
Off uint32
|
||||
}
|
||||
|
||||
// Assemble implements the Instruction Assemble method.
|
||||
func (a LoadMemShift) Assemble() (RawInstruction, error) {
|
||||
return assembleLoad(RegX, 1, opAddrModeMemShift, a.Off)
|
||||
}
|
||||
|
||||
// LoadExtension invokes a linux-specific extension and stores the
|
||||
// result in register A.
|
||||
type LoadExtension struct {
|
||||
Num Extension
|
||||
}
|
||||
|
||||
// Assemble implements the Instruction Assemble method.
|
||||
func (a LoadExtension) Assemble() (RawInstruction, error) {
|
||||
if a.Num == ExtLen {
|
||||
return assembleLoad(RegA, 4, opAddrModePacketLen, 0)
|
||||
}
|
||||
return assembleLoad(RegA, 4, opAddrModeAbsolute, uint32(-0x1000+a.Num))
|
||||
}
|
||||
|
||||
// StoreScratch stores register Src into scratch[N].
|
||||
type StoreScratch struct {
|
||||
Src Register
|
||||
N int // 0-15
|
||||
}
|
||||
|
||||
// Assemble implements the Instruction Assemble method.
|
||||
func (a StoreScratch) Assemble() (RawInstruction, error) {
|
||||
if a.N < 0 || a.N > 15 {
|
||||
return RawInstruction{}, fmt.Errorf("invalid scratch slot %d", a.N)
|
||||
}
|
||||
var op uint16
|
||||
switch a.Src {
|
||||
case RegA:
|
||||
op = opClsStoreA
|
||||
case RegX:
|
||||
op = opClsStoreX
|
||||
default:
|
||||
return RawInstruction{}, fmt.Errorf("invalid source register %v", a.Src)
|
||||
}
|
||||
|
||||
return RawInstruction{
|
||||
Op: op,
|
||||
K: uint32(a.N),
|
||||
}, nil
|
||||
}
|
||||
|
||||
// ALUOpConstant executes A = A <Op> Val.
|
||||
type ALUOpConstant struct {
|
||||
Op ALUOp
|
||||
Val uint32
|
||||
}
|
||||
|
||||
// Assemble implements the Instruction Assemble method.
|
||||
func (a ALUOpConstant) Assemble() (RawInstruction, error) {
|
||||
return RawInstruction{
|
||||
Op: opClsALU | opALUSrcConstant | uint16(a.Op),
|
||||
K: a.Val,
|
||||
}, nil
|
||||
}
|
||||
|
||||
// ALUOpX executes A = A <Op> X
|
||||
type ALUOpX struct {
|
||||
Op ALUOp
|
||||
}
|
||||
|
||||
// Assemble implements the Instruction Assemble method.
|
||||
func (a ALUOpX) Assemble() (RawInstruction, error) {
|
||||
return RawInstruction{
|
||||
Op: opClsALU | opALUSrcX | uint16(a.Op),
|
||||
}, nil
|
||||
}
|
||||
|
||||
// NegateA executes A = -A.
|
||||
type NegateA struct{}
|
||||
|
||||
// Assemble implements the Instruction Assemble method.
|
||||
func (a NegateA) Assemble() (RawInstruction, error) {
|
||||
return RawInstruction{
|
||||
Op: opClsALU | uint16(aluOpNeg),
|
||||
}, nil
|
||||
}
|
||||
|
||||
// Jump skips the following Skip instructions in the program.
|
||||
type Jump struct {
|
||||
Skip uint32
|
||||
}
|
||||
|
||||
// Assemble implements the Instruction Assemble method.
|
||||
func (a Jump) Assemble() (RawInstruction, error) {
|
||||
return RawInstruction{
|
||||
Op: opClsJump | opJumpAlways,
|
||||
K: a.Skip,
|
||||
}, nil
|
||||
}
|
||||
|
||||
// JumpIf skips the following Skip instructions in the program if A
|
||||
// <Cond> Val is true.
|
||||
type JumpIf struct {
|
||||
Cond JumpTest
|
||||
Val uint32
|
||||
SkipTrue uint8
|
||||
SkipFalse uint8
|
||||
}
|
||||
|
||||
// Assemble implements the Instruction Assemble method.
|
||||
func (a JumpIf) Assemble() (RawInstruction, error) {
|
||||
var (
|
||||
cond uint16
|
||||
flip bool
|
||||
)
|
||||
switch a.Cond {
|
||||
case JumpEqual:
|
||||
cond = opJumpEqual
|
||||
case JumpNotEqual:
|
||||
cond, flip = opJumpEqual, true
|
||||
case JumpGreaterThan:
|
||||
cond = opJumpGT
|
||||
case JumpLessThan:
|
||||
cond, flip = opJumpGE, true
|
||||
case JumpGreaterOrEqual:
|
||||
cond = opJumpGE
|
||||
case JumpLessOrEqual:
|
||||
cond, flip = opJumpGT, true
|
||||
case JumpBitsSet:
|
||||
cond = opJumpSet
|
||||
case JumpBitsNotSet:
|
||||
cond, flip = opJumpSet, true
|
||||
default:
|
||||
return RawInstruction{}, fmt.Errorf("unknown JumpTest %v", a.Cond)
|
||||
}
|
||||
jt, jf := a.SkipTrue, a.SkipFalse
|
||||
if flip {
|
||||
jt, jf = jf, jt
|
||||
}
|
||||
return RawInstruction{
|
||||
Op: opClsJump | cond,
|
||||
Jt: jt,
|
||||
Jf: jf,
|
||||
K: a.Val,
|
||||
}, nil
|
||||
}
|
||||
|
||||
// RetA exits the BPF program, returning the value of register A.
|
||||
type RetA struct{}
|
||||
|
||||
// Assemble implements the Instruction Assemble method.
|
||||
func (a RetA) Assemble() (RawInstruction, error) {
|
||||
return RawInstruction{
|
||||
Op: opClsReturn | opRetSrcA,
|
||||
}, nil
|
||||
}
|
||||
|
||||
// RetConstant exits the BPF program, returning a constant value.
|
||||
type RetConstant struct {
|
||||
Val uint32
|
||||
}
|
||||
|
||||
// Assemble implements the Instruction Assemble method.
|
||||
func (a RetConstant) Assemble() (RawInstruction, error) {
|
||||
return RawInstruction{
|
||||
Op: opClsReturn | opRetSrcConstant,
|
||||
K: a.Val,
|
||||
}, nil
|
||||
}
|
||||
|
||||
// TXA copies the value of register X to register A.
|
||||
type TXA struct{}
|
||||
|
||||
// Assemble implements the Instruction Assemble method.
|
||||
func (a TXA) Assemble() (RawInstruction, error) {
|
||||
return RawInstruction{
|
||||
Op: opClsMisc | opMiscTXA,
|
||||
}, nil
|
||||
}
|
||||
|
||||
// TAX copies the value of register A to register X.
|
||||
type TAX struct{}
|
||||
|
||||
// Assemble implements the Instruction Assemble method.
|
||||
func (a TAX) Assemble() (RawInstruction, error) {
|
||||
return RawInstruction{
|
||||
Op: opClsMisc | opMiscTAX,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func assembleLoad(dst Register, loadSize int, mode uint16, k uint32) (RawInstruction, error) {
|
||||
var (
|
||||
cls uint16
|
||||
sz uint16
|
||||
)
|
||||
switch dst {
|
||||
case RegA:
|
||||
cls = opClsLoadA
|
||||
case RegX:
|
||||
cls = opClsLoadX
|
||||
default:
|
||||
return RawInstruction{}, fmt.Errorf("invalid target register %v", dst)
|
||||
}
|
||||
switch loadSize {
|
||||
case 1:
|
||||
sz = opLoadWidth1
|
||||
case 2:
|
||||
sz = opLoadWidth2
|
||||
case 4:
|
||||
sz = opLoadWidth4
|
||||
default:
|
||||
return RawInstruction{}, fmt.Errorf("invalid load byte length %d", sz)
|
||||
}
|
||||
return RawInstruction{
|
||||
Op: cls | sz | mode,
|
||||
K: k,
|
||||
}, nil
|
||||
}
|
||||
180
vendor/golang.org/x/net/internal/iana/const.go
generated
vendored
Normal file
180
vendor/golang.org/x/net/internal/iana/const.go
generated
vendored
Normal file
@@ -0,0 +1,180 @@
|
||||
// go generate gen.go
|
||||
// GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
|
||||
|
||||
// Package iana provides protocol number resources managed by the Internet Assigned Numbers Authority (IANA).
|
||||
package iana
|
||||
|
||||
// Differentiated Services Field Codepoints (DSCP), Updated: 2013-06-25
|
||||
const (
|
||||
DiffServCS0 = 0x0 // CS0
|
||||
DiffServCS1 = 0x20 // CS1
|
||||
DiffServCS2 = 0x40 // CS2
|
||||
DiffServCS3 = 0x60 // CS3
|
||||
DiffServCS4 = 0x80 // CS4
|
||||
DiffServCS5 = 0xa0 // CS5
|
||||
DiffServCS6 = 0xc0 // CS6
|
||||
DiffServCS7 = 0xe0 // CS7
|
||||
DiffServAF11 = 0x28 // AF11
|
||||
DiffServAF12 = 0x30 // AF12
|
||||
DiffServAF13 = 0x38 // AF13
|
||||
DiffServAF21 = 0x48 // AF21
|
||||
DiffServAF22 = 0x50 // AF22
|
||||
DiffServAF23 = 0x58 // AF23
|
||||
DiffServAF31 = 0x68 // AF31
|
||||
DiffServAF32 = 0x70 // AF32
|
||||
DiffServAF33 = 0x78 // AF33
|
||||
DiffServAF41 = 0x88 // AF41
|
||||
DiffServAF42 = 0x90 // AF42
|
||||
DiffServAF43 = 0x98 // AF43
|
||||
DiffServEFPHB = 0xb8 // EF PHB
|
||||
DiffServVOICEADMIT = 0xb0 // VOICE-ADMIT
|
||||
)
|
||||
|
||||
// IPv4 TOS Byte and IPv6 Traffic Class Octet, Updated: 2001-09-06
|
||||
const (
|
||||
NotECNTransport = 0x0 // Not-ECT (Not ECN-Capable Transport)
|
||||
ECNTransport1 = 0x1 // ECT(1) (ECN-Capable Transport(1))
|
||||
ECNTransport0 = 0x2 // ECT(0) (ECN-Capable Transport(0))
|
||||
CongestionExperienced = 0x3 // CE (Congestion Experienced)
|
||||
)
|
||||
|
||||
// Protocol Numbers, Updated: 2015-10-06
|
||||
const (
|
||||
ProtocolIP = 0 // IPv4 encapsulation, pseudo protocol number
|
||||
ProtocolHOPOPT = 0 // IPv6 Hop-by-Hop Option
|
||||
ProtocolICMP = 1 // Internet Control Message
|
||||
ProtocolIGMP = 2 // Internet Group Management
|
||||
ProtocolGGP = 3 // Gateway-to-Gateway
|
||||
ProtocolIPv4 = 4 // IPv4 encapsulation
|
||||
ProtocolST = 5 // Stream
|
||||
ProtocolTCP = 6 // Transmission Control
|
||||
ProtocolCBT = 7 // CBT
|
||||
ProtocolEGP = 8 // Exterior Gateway Protocol
|
||||
ProtocolIGP = 9 // any private interior gateway (used by Cisco for their IGRP)
|
||||
ProtocolBBNRCCMON = 10 // BBN RCC Monitoring
|
||||
ProtocolNVPII = 11 // Network Voice Protocol
|
||||
ProtocolPUP = 12 // PUP
|
||||
ProtocolEMCON = 14 // EMCON
|
||||
ProtocolXNET = 15 // Cross Net Debugger
|
||||
ProtocolCHAOS = 16 // Chaos
|
||||
ProtocolUDP = 17 // User Datagram
|
||||
ProtocolMUX = 18 // Multiplexing
|
||||
ProtocolDCNMEAS = 19 // DCN Measurement Subsystems
|
||||
ProtocolHMP = 20 // Host Monitoring
|
||||
ProtocolPRM = 21 // Packet Radio Measurement
|
||||
ProtocolXNSIDP = 22 // XEROX NS IDP
|
||||
ProtocolTRUNK1 = 23 // Trunk-1
|
||||
ProtocolTRUNK2 = 24 // Trunk-2
|
||||
ProtocolLEAF1 = 25 // Leaf-1
|
||||
ProtocolLEAF2 = 26 // Leaf-2
|
||||
ProtocolRDP = 27 // Reliable Data Protocol
|
||||
ProtocolIRTP = 28 // Internet Reliable Transaction
|
||||
ProtocolISOTP4 = 29 // ISO Transport Protocol Class 4
|
||||
ProtocolNETBLT = 30 // Bulk Data Transfer Protocol
|
||||
ProtocolMFENSP = 31 // MFE Network Services Protocol
|
||||
ProtocolMERITINP = 32 // MERIT Internodal Protocol
|
||||
ProtocolDCCP = 33 // Datagram Congestion Control Protocol
|
||||
Protocol3PC = 34 // Third Party Connect Protocol
|
||||
ProtocolIDPR = 35 // Inter-Domain Policy Routing Protocol
|
||||
ProtocolXTP = 36 // XTP
|
||||
ProtocolDDP = 37 // Datagram Delivery Protocol
|
||||
ProtocolIDPRCMTP = 38 // IDPR Control Message Transport Proto
|
||||
ProtocolTPPP = 39 // TP++ Transport Protocol
|
||||
ProtocolIL = 40 // IL Transport Protocol
|
||||
ProtocolIPv6 = 41 // IPv6 encapsulation
|
||||
ProtocolSDRP = 42 // Source Demand Routing Protocol
|
||||
ProtocolIPv6Route = 43 // Routing Header for IPv6
|
||||
ProtocolIPv6Frag = 44 // Fragment Header for IPv6
|
||||
ProtocolIDRP = 45 // Inter-Domain Routing Protocol
|
||||
ProtocolRSVP = 46 // Reservation Protocol
|
||||
ProtocolGRE = 47 // Generic Routing Encapsulation
|
||||
ProtocolDSR = 48 // Dynamic Source Routing Protocol
|
||||
ProtocolBNA = 49 // BNA
|
||||
ProtocolESP = 50 // Encap Security Payload
|
||||
ProtocolAH = 51 // Authentication Header
|
||||
ProtocolINLSP = 52 // Integrated Net Layer Security TUBA
|
||||
ProtocolNARP = 54 // NBMA Address Resolution Protocol
|
||||
ProtocolMOBILE = 55 // IP Mobility
|
||||
ProtocolTLSP = 56 // Transport Layer Security Protocol using Kryptonet key management
|
||||
ProtocolSKIP = 57 // SKIP
|
||||
ProtocolIPv6ICMP = 58 // ICMP for IPv6
|
||||
ProtocolIPv6NoNxt = 59 // No Next Header for IPv6
|
||||
ProtocolIPv6Opts = 60 // Destination Options for IPv6
|
||||
ProtocolCFTP = 62 // CFTP
|
||||
ProtocolSATEXPAK = 64 // SATNET and Backroom EXPAK
|
||||
ProtocolKRYPTOLAN = 65 // Kryptolan
|
||||
ProtocolRVD = 66 // MIT Remote Virtual Disk Protocol
|
||||
ProtocolIPPC = 67 // Internet Pluribus Packet Core
|
||||
ProtocolSATMON = 69 // SATNET Monitoring
|
||||
ProtocolVISA = 70 // VISA Protocol
|
||||
ProtocolIPCV = 71 // Internet Packet Core Utility
|
||||
ProtocolCPNX = 72 // Computer Protocol Network Executive
|
||||
ProtocolCPHB = 73 // Computer Protocol Heart Beat
|
||||
ProtocolWSN = 74 // Wang Span Network
|
||||
ProtocolPVP = 75 // Packet Video Protocol
|
||||
ProtocolBRSATMON = 76 // Backroom SATNET Monitoring
|
||||
ProtocolSUNND = 77 // SUN ND PROTOCOL-Temporary
|
||||
ProtocolWBMON = 78 // WIDEBAND Monitoring
|
||||
ProtocolWBEXPAK = 79 // WIDEBAND EXPAK
|
||||
ProtocolISOIP = 80 // ISO Internet Protocol
|
||||
ProtocolVMTP = 81 // VMTP
|
||||
ProtocolSECUREVMTP = 82 // SECURE-VMTP
|
||||
ProtocolVINES = 83 // VINES
|
||||
ProtocolTTP = 84 // Transaction Transport Protocol
|
||||
ProtocolIPTM = 84 // Internet Protocol Traffic Manager
|
||||
ProtocolNSFNETIGP = 85 // NSFNET-IGP
|
||||
ProtocolDGP = 86 // Dissimilar Gateway Protocol
|
||||
ProtocolTCF = 87 // TCF
|
||||
ProtocolEIGRP = 88 // EIGRP
|
||||
ProtocolOSPFIGP = 89 // OSPFIGP
|
||||
ProtocolSpriteRPC = 90 // Sprite RPC Protocol
|
||||
ProtocolLARP = 91 // Locus Address Resolution Protocol
|
||||
ProtocolMTP = 92 // Multicast Transport Protocol
|
||||
ProtocolAX25 = 93 // AX.25 Frames
|
||||
ProtocolIPIP = 94 // IP-within-IP Encapsulation Protocol
|
||||
ProtocolSCCSP = 96 // Semaphore Communications Sec. Pro.
|
||||
ProtocolETHERIP = 97 // Ethernet-within-IP Encapsulation
|
||||
ProtocolENCAP = 98 // Encapsulation Header
|
||||
ProtocolGMTP = 100 // GMTP
|
||||
ProtocolIFMP = 101 // Ipsilon Flow Management Protocol
|
||||
ProtocolPNNI = 102 // PNNI over IP
|
||||
ProtocolPIM = 103 // Protocol Independent Multicast
|
||||
ProtocolARIS = 104 // ARIS
|
||||
ProtocolSCPS = 105 // SCPS
|
||||
ProtocolQNX = 106 // QNX
|
||||
ProtocolAN = 107 // Active Networks
|
||||
ProtocolIPComp = 108 // IP Payload Compression Protocol
|
||||
ProtocolSNP = 109 // Sitara Networks Protocol
|
||||
ProtocolCompaqPeer = 110 // Compaq Peer Protocol
|
||||
ProtocolIPXinIP = 111 // IPX in IP
|
||||
ProtocolVRRP = 112 // Virtual Router Redundancy Protocol
|
||||
ProtocolPGM = 113 // PGM Reliable Transport Protocol
|
||||
ProtocolL2TP = 115 // Layer Two Tunneling Protocol
|
||||
ProtocolDDX = 116 // D-II Data Exchange (DDX)
|
||||
ProtocolIATP = 117 // Interactive Agent Transfer Protocol
|
||||
ProtocolSTP = 118 // Schedule Transfer Protocol
|
||||
ProtocolSRP = 119 // SpectraLink Radio Protocol
|
||||
ProtocolUTI = 120 // UTI
|
||||
ProtocolSMP = 121 // Simple Message Protocol
|
||||
ProtocolPTP = 123 // Performance Transparency Protocol
|
||||
ProtocolISIS = 124 // ISIS over IPv4
|
||||
ProtocolFIRE = 125 // FIRE
|
||||
ProtocolCRTP = 126 // Combat Radio Transport Protocol
|
||||
ProtocolCRUDP = 127 // Combat Radio User Datagram
|
||||
ProtocolSSCOPMCE = 128 // SSCOPMCE
|
||||
ProtocolIPLT = 129 // IPLT
|
||||
ProtocolSPS = 130 // Secure Packet Shield
|
||||
ProtocolPIPE = 131 // Private IP Encapsulation within IP
|
||||
ProtocolSCTP = 132 // Stream Control Transmission Protocol
|
||||
ProtocolFC = 133 // Fibre Channel
|
||||
ProtocolRSVPE2EIGNORE = 134 // RSVP-E2E-IGNORE
|
||||
ProtocolMobilityHeader = 135 // Mobility Header
|
||||
ProtocolUDPLite = 136 // UDPLite
|
||||
ProtocolMPLSinIP = 137 // MPLS-in-IP
|
||||
ProtocolMANET = 138 // MANET Protocols
|
||||
ProtocolHIP = 139 // Host Identity Protocol
|
||||
ProtocolShim6 = 140 // Shim6 Protocol
|
||||
ProtocolWESP = 141 // Wrapped Encapsulating Security Payload
|
||||
ProtocolROHC = 142 // Robust Header Compression
|
||||
ProtocolReserved = 255 // Reserved
|
||||
)
|
||||
293
vendor/golang.org/x/net/internal/iana/gen.go
generated
vendored
Normal file
293
vendor/golang.org/x/net/internal/iana/gen.go
generated
vendored
Normal file
@@ -0,0 +1,293 @@
|
||||
// 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.
|
||||
|
||||
// +build ignore
|
||||
|
||||
//go:generate go run gen.go
|
||||
|
||||
// This program generates internet protocol constants and tables by
|
||||
// reading IANA protocol registries.
|
||||
package main
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/xml"
|
||||
"fmt"
|
||||
"go/format"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"os"
|
||||
"strconv"
|
||||
"strings"
|
||||
)
|
||||
|
||||
var registries = []struct {
|
||||
url string
|
||||
parse func(io.Writer, io.Reader) error
|
||||
}{
|
||||
{
|
||||
"http://www.iana.org/assignments/dscp-registry/dscp-registry.xml",
|
||||
parseDSCPRegistry,
|
||||
},
|
||||
{
|
||||
"http://www.iana.org/assignments/ipv4-tos-byte/ipv4-tos-byte.xml",
|
||||
parseTOSTCByte,
|
||||
},
|
||||
{
|
||||
"http://www.iana.org/assignments/protocol-numbers/protocol-numbers.xml",
|
||||
parseProtocolNumbers,
|
||||
},
|
||||
}
|
||||
|
||||
func main() {
|
||||
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, "// Package iana provides protocol number resources managed by the Internet Assigned Numbers Authority (IANA).\n")
|
||||
fmt.Fprintf(&bb, `package iana // import "golang.org/x/net/internal/iana"`+"\n\n")
|
||||
for _, r := range registries {
|
||||
resp, err := http.Get(r.url)
|
||||
if err != nil {
|
||||
fmt.Fprintln(os.Stderr, err)
|
||||
os.Exit(1)
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
if resp.StatusCode != http.StatusOK {
|
||||
fmt.Fprintf(os.Stderr, "got HTTP status code %v for %v\n", resp.StatusCode, r.url)
|
||||
os.Exit(1)
|
||||
}
|
||||
if err := r.parse(&bb, resp.Body); err != nil {
|
||||
fmt.Fprintln(os.Stderr, err)
|
||||
os.Exit(1)
|
||||
}
|
||||
fmt.Fprintf(&bb, "\n")
|
||||
}
|
||||
b, err := format.Source(bb.Bytes())
|
||||
if err != nil {
|
||||
fmt.Fprintln(os.Stderr, err)
|
||||
os.Exit(1)
|
||||
}
|
||||
if err := ioutil.WriteFile("const.go", b, 0644); err != nil {
|
||||
fmt.Fprintln(os.Stderr, err)
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
|
||||
func parseDSCPRegistry(w io.Writer, r io.Reader) error {
|
||||
dec := xml.NewDecoder(r)
|
||||
var dr dscpRegistry
|
||||
if err := dec.Decode(&dr); err != nil {
|
||||
return err
|
||||
}
|
||||
drs := dr.escape()
|
||||
fmt.Fprintf(w, "// %s, Updated: %s\n", dr.Title, dr.Updated)
|
||||
fmt.Fprintf(w, "const (\n")
|
||||
for _, dr := range drs {
|
||||
fmt.Fprintf(w, "DiffServ%s = %#x", dr.Name, dr.Value)
|
||||
fmt.Fprintf(w, "// %s\n", dr.OrigName)
|
||||
}
|
||||
fmt.Fprintf(w, ")\n")
|
||||
return nil
|
||||
}
|
||||
|
||||
type dscpRegistry struct {
|
||||
XMLName xml.Name `xml:"registry"`
|
||||
Title string `xml:"title"`
|
||||
Updated string `xml:"updated"`
|
||||
Note string `xml:"note"`
|
||||
RegTitle string `xml:"registry>title"`
|
||||
PoolRecords []struct {
|
||||
Name string `xml:"name"`
|
||||
Space string `xml:"space"`
|
||||
} `xml:"registry>record"`
|
||||
Records []struct {
|
||||
Name string `xml:"name"`
|
||||
Space string `xml:"space"`
|
||||
} `xml:"registry>registry>record"`
|
||||
}
|
||||
|
||||
type canonDSCPRecord struct {
|
||||
OrigName string
|
||||
Name string
|
||||
Value int
|
||||
}
|
||||
|
||||
func (drr *dscpRegistry) escape() []canonDSCPRecord {
|
||||
drs := make([]canonDSCPRecord, len(drr.Records))
|
||||
sr := strings.NewReplacer(
|
||||
"+", "",
|
||||
"-", "",
|
||||
"/", "",
|
||||
".", "",
|
||||
" ", "",
|
||||
)
|
||||
for i, dr := range drr.Records {
|
||||
s := strings.TrimSpace(dr.Name)
|
||||
drs[i].OrigName = s
|
||||
drs[i].Name = sr.Replace(s)
|
||||
n, err := strconv.ParseUint(dr.Space, 2, 8)
|
||||
if err != nil {
|
||||
continue
|
||||
}
|
||||
drs[i].Value = int(n) << 2
|
||||
}
|
||||
return drs
|
||||
}
|
||||
|
||||
func parseTOSTCByte(w io.Writer, r io.Reader) error {
|
||||
dec := xml.NewDecoder(r)
|
||||
var ttb tosTCByte
|
||||
if err := dec.Decode(&ttb); err != nil {
|
||||
return err
|
||||
}
|
||||
trs := ttb.escape()
|
||||
fmt.Fprintf(w, "// %s, Updated: %s\n", ttb.Title, ttb.Updated)
|
||||
fmt.Fprintf(w, "const (\n")
|
||||
for _, tr := range trs {
|
||||
fmt.Fprintf(w, "%s = %#x", tr.Keyword, tr.Value)
|
||||
fmt.Fprintf(w, "// %s\n", tr.OrigKeyword)
|
||||
}
|
||||
fmt.Fprintf(w, ")\n")
|
||||
return nil
|
||||
}
|
||||
|
||||
type tosTCByte struct {
|
||||
XMLName xml.Name `xml:"registry"`
|
||||
Title string `xml:"title"`
|
||||
Updated string `xml:"updated"`
|
||||
Note string `xml:"note"`
|
||||
RegTitle string `xml:"registry>title"`
|
||||
Records []struct {
|
||||
Binary string `xml:"binary"`
|
||||
Keyword string `xml:"keyword"`
|
||||
} `xml:"registry>record"`
|
||||
}
|
||||
|
||||
type canonTOSTCByteRecord struct {
|
||||
OrigKeyword string
|
||||
Keyword string
|
||||
Value int
|
||||
}
|
||||
|
||||
func (ttb *tosTCByte) escape() []canonTOSTCByteRecord {
|
||||
trs := make([]canonTOSTCByteRecord, len(ttb.Records))
|
||||
sr := strings.NewReplacer(
|
||||
"Capable", "",
|
||||
"(", "",
|
||||
")", "",
|
||||
"+", "",
|
||||
"-", "",
|
||||
"/", "",
|
||||
".", "",
|
||||
" ", "",
|
||||
)
|
||||
for i, tr := range ttb.Records {
|
||||
s := strings.TrimSpace(tr.Keyword)
|
||||
trs[i].OrigKeyword = s
|
||||
ss := strings.Split(s, " ")
|
||||
if len(ss) > 1 {
|
||||
trs[i].Keyword = strings.Join(ss[1:], " ")
|
||||
} else {
|
||||
trs[i].Keyword = ss[0]
|
||||
}
|
||||
trs[i].Keyword = sr.Replace(trs[i].Keyword)
|
||||
n, err := strconv.ParseUint(tr.Binary, 2, 8)
|
||||
if err != nil {
|
||||
continue
|
||||
}
|
||||
trs[i].Value = int(n)
|
||||
}
|
||||
return trs
|
||||
}
|
||||
|
||||
func parseProtocolNumbers(w io.Writer, r io.Reader) error {
|
||||
dec := xml.NewDecoder(r)
|
||||
var pn protocolNumbers
|
||||
if err := dec.Decode(&pn); err != nil {
|
||||
return err
|
||||
}
|
||||
prs := pn.escape()
|
||||
prs = append([]canonProtocolRecord{{
|
||||
Name: "IP",
|
||||
Descr: "IPv4 encapsulation, pseudo protocol number",
|
||||
Value: 0,
|
||||
}}, prs...)
|
||||
fmt.Fprintf(w, "// %s, Updated: %s\n", pn.Title, pn.Updated)
|
||||
fmt.Fprintf(w, "const (\n")
|
||||
for _, pr := range prs {
|
||||
if pr.Name == "" {
|
||||
continue
|
||||
}
|
||||
fmt.Fprintf(w, "Protocol%s = %d", pr.Name, pr.Value)
|
||||
s := pr.Descr
|
||||
if s == "" {
|
||||
s = pr.OrigName
|
||||
}
|
||||
fmt.Fprintf(w, "// %s\n", s)
|
||||
}
|
||||
fmt.Fprintf(w, ")\n")
|
||||
return nil
|
||||
}
|
||||
|
||||
type protocolNumbers struct {
|
||||
XMLName xml.Name `xml:"registry"`
|
||||
Title string `xml:"title"`
|
||||
Updated string `xml:"updated"`
|
||||
RegTitle string `xml:"registry>title"`
|
||||
Note string `xml:"registry>note"`
|
||||
Records []struct {
|
||||
Value string `xml:"value"`
|
||||
Name string `xml:"name"`
|
||||
Descr string `xml:"description"`
|
||||
} `xml:"registry>record"`
|
||||
}
|
||||
|
||||
type canonProtocolRecord struct {
|
||||
OrigName string
|
||||
Name string
|
||||
Descr string
|
||||
Value int
|
||||
}
|
||||
|
||||
func (pn *protocolNumbers) escape() []canonProtocolRecord {
|
||||
prs := make([]canonProtocolRecord, len(pn.Records))
|
||||
sr := strings.NewReplacer(
|
||||
"-in-", "in",
|
||||
"-within-", "within",
|
||||
"-over-", "over",
|
||||
"+", "P",
|
||||
"-", "",
|
||||
"/", "",
|
||||
".", "",
|
||||
" ", "",
|
||||
)
|
||||
for i, pr := range pn.Records {
|
||||
if strings.Contains(pr.Name, "Deprecated") ||
|
||||
strings.Contains(pr.Name, "deprecated") {
|
||||
continue
|
||||
}
|
||||
prs[i].OrigName = pr.Name
|
||||
s := strings.TrimSpace(pr.Name)
|
||||
switch pr.Name {
|
||||
case "ISIS over IPv4":
|
||||
prs[i].Name = "ISIS"
|
||||
case "manet":
|
||||
prs[i].Name = "MANET"
|
||||
default:
|
||||
prs[i].Name = sr.Replace(s)
|
||||
}
|
||||
ss := strings.Split(pr.Descr, "\n")
|
||||
for i := range ss {
|
||||
ss[i] = strings.TrimSpace(ss[i])
|
||||
}
|
||||
if len(ss) > 1 {
|
||||
prs[i].Descr = strings.Join(ss, " ")
|
||||
} else {
|
||||
prs[i].Descr = ss[0]
|
||||
}
|
||||
prs[i].Value, _ = strconv.Atoi(pr.Value)
|
||||
}
|
||||
return prs
|
||||
}
|
||||
27
vendor/golang.org/x/net/ipv4/bpfopt_linux.go
generated
vendored
Normal file
27
vendor/golang.org/x/net/ipv4/bpfopt_linux.go
generated
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
// 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
Normal file
16
vendor/golang.org/x/net/ipv4/bpfopt_stub.go
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
// 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
|
||||
}
|
||||
70
vendor/golang.org/x/net/ipv4/control.go
generated
vendored
Normal file
70
vendor/golang.org/x/net/ipv4/control.go
generated
vendored
Normal file
@@ -0,0 +1,70 @@
|
||||
// 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 (
|
||||
"fmt"
|
||||
"net"
|
||||
"sync"
|
||||
)
|
||||
|
||||
type rawOpt struct {
|
||||
sync.RWMutex
|
||||
cflags ControlFlags
|
||||
}
|
||||
|
||||
func (c *rawOpt) set(f ControlFlags) { c.cflags |= f }
|
||||
func (c *rawOpt) clear(f ControlFlags) { c.cflags &^= f }
|
||||
func (c *rawOpt) isset(f ControlFlags) bool { return c.cflags&f != 0 }
|
||||
|
||||
type ControlFlags uint
|
||||
|
||||
const (
|
||||
FlagTTL ControlFlags = 1 << iota // pass the TTL on the received packet
|
||||
FlagSrc // pass the source address on the received packet
|
||||
FlagDst // pass the destination address on the received packet
|
||||
FlagInterface // pass the interface index on the received packet
|
||||
)
|
||||
|
||||
// A ControlMessage represents per packet basis IP-level socket options.
|
||||
type ControlMessage struct {
|
||||
// Receiving socket options: SetControlMessage allows to
|
||||
// receive the options from the protocol stack using ReadFrom
|
||||
// method of PacketConn or RawConn.
|
||||
//
|
||||
// Specifying socket options: ControlMessage for WriteTo
|
||||
// method of PacketConn or RawConn allows to send the options
|
||||
// to the protocol stack.
|
||||
//
|
||||
TTL int // time-to-live, receiving only
|
||||
Src net.IP // source address, specifying only
|
||||
Dst net.IP // destination address, receiving only
|
||||
IfIndex int // interface index, must be 1 <= value when specifying
|
||||
}
|
||||
|
||||
func (cm *ControlMessage) String() string {
|
||||
if cm == nil {
|
||||
return "<nil>"
|
||||
}
|
||||
return fmt.Sprintf("ttl=%d src=%v dst=%v ifindex=%d", cm.TTL, cm.Src, cm.Dst, cm.IfIndex)
|
||||
}
|
||||
|
||||
// Ancillary data socket options
|
||||
const (
|
||||
ctlTTL = iota // header field
|
||||
ctlSrc // header field
|
||||
ctlDst // header field
|
||||
ctlInterface // inbound or outbound interface
|
||||
ctlPacketInfo // inbound or outbound packet path
|
||||
ctlMax
|
||||
)
|
||||
|
||||
// A ctlOpt represents a binding for ancillary data socket option.
|
||||
type ctlOpt struct {
|
||||
name int // option name, must be equal or greater than 1
|
||||
length int // option length
|
||||
marshal func([]byte, *ControlMessage) []byte
|
||||
parse func(*ControlMessage, []byte)
|
||||
}
|
||||
40
vendor/golang.org/x/net/ipv4/control_bsd.go
generated
vendored
Normal file
40
vendor/golang.org/x/net/ipv4/control_bsd.go
generated
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
// 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"
|
||||
"syscall"
|
||||
"unsafe"
|
||||
|
||||
"golang.org/x/net/internal/iana"
|
||||
)
|
||||
|
||||
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):]
|
||||
}
|
||||
|
||||
func parseDst(cm *ControlMessage, b []byte) {
|
||||
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):]
|
||||
}
|
||||
|
||||
func parseInterface(cm *ControlMessage, b []byte) {
|
||||
sadl := (*syscall.SockaddrDatalink)(unsafe.Pointer(&b[0]))
|
||||
cm.IfIndex = int(sadl.Index)
|
||||
}
|
||||
37
vendor/golang.org/x/net/ipv4/control_pktinfo.go
generated
vendored
Normal file
37
vendor/golang.org/x/net/ipv4/control_pktinfo.go
generated
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
// 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 linux
|
||||
|
||||
package ipv4
|
||||
|
||||
import (
|
||||
"syscall"
|
||||
"unsafe"
|
||||
|
||||
"golang.org/x/net/internal/iana"
|
||||
)
|
||||
|
||||
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))
|
||||
if cm != nil {
|
||||
pi := (*sysInetPktinfo)(unsafe.Pointer(&b[syscall.CmsgLen(0)]))
|
||||
if ip := cm.Src.To4(); ip != nil {
|
||||
copy(pi.Spec_dst[:], ip)
|
||||
}
|
||||
if cm.IfIndex > 0 {
|
||||
pi.setIfindex(cm.IfIndex)
|
||||
}
|
||||
}
|
||||
return b[syscall.CmsgSpace(sysSizeofInetPktinfo):]
|
||||
}
|
||||
|
||||
func parsePacketInfo(cm *ControlMessage, b []byte) {
|
||||
pi := (*sysInetPktinfo)(unsafe.Pointer(&b[0]))
|
||||
cm.IfIndex = int(pi.Ifindex)
|
||||
cm.Dst = pi.Addr[:]
|
||||
}
|
||||
23
vendor/golang.org/x/net/ipv4/control_stub.go
generated
vendored
Normal file
23
vendor/golang.org/x/net/ipv4/control_stub.go
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
// 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 setControlMessage(fd int, 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
|
||||
}
|
||||
164
vendor/golang.org/x/net/ipv4/control_unix.go
generated
vendored
Normal file
164
vendor/golang.org/x/net/ipv4/control_unix.go
generated
vendored
Normal file
@@ -0,0 +1,164 @@
|
||||
// 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 (
|
||||
"os"
|
||||
"syscall"
|
||||
"unsafe"
|
||||
|
||||
"golang.org/x/net/internal/iana"
|
||||
)
|
||||
|
||||
func setControlMessage(fd int, 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 {
|
||||
return err
|
||||
}
|
||||
if on {
|
||||
opt.set(FlagTTL)
|
||||
} else {
|
||||
opt.clear(FlagTTL)
|
||||
}
|
||||
}
|
||||
if sockOpts[ssoPacketInfo].name > 0 {
|
||||
if cf&(FlagSrc|FlagDst|FlagInterface) != 0 {
|
||||
if err := setInt(fd, &sockOpts[ssoPacketInfo], boolint(on)); err != nil {
|
||||
return err
|
||||
}
|
||||
if on {
|
||||
opt.set(cf & (FlagSrc | FlagDst | FlagInterface))
|
||||
} else {
|
||||
opt.clear(cf & (FlagSrc | FlagDst | FlagInterface))
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if cf&FlagDst != 0 && sockOpts[ssoReceiveDst].name > 0 {
|
||||
if err := setInt(fd, &sockOpts[ssoReceiveDst], boolint(on)); err != nil {
|
||||
return err
|
||||
}
|
||||
if on {
|
||||
opt.set(FlagDst)
|
||||
} else {
|
||||
opt.clear(FlagDst)
|
||||
}
|
||||
}
|
||||
if cf&FlagInterface != 0 && sockOpts[ssoReceiveInterface].name > 0 {
|
||||
if err := setInt(fd, &sockOpts[ssoReceiveInterface], boolint(on)); err != nil {
|
||||
return err
|
||||
}
|
||||
if on {
|
||||
opt.set(FlagInterface)
|
||||
} else {
|
||||
opt.clear(FlagInterface)
|
||||
}
|
||||
}
|
||||
}
|
||||
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):]
|
||||
}
|
||||
|
||||
func parseTTL(cm *ControlMessage, b []byte) {
|
||||
cm.TTL = int(*(*byte)(unsafe.Pointer(&b[:1][0])))
|
||||
}
|
||||
27
vendor/golang.org/x/net/ipv4/control_windows.go
generated
vendored
Normal file
27
vendor/golang.org/x/net/ipv4/control_windows.go
generated
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
// 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"
|
||||
|
||||
func setControlMessage(fd syscall.Handle, 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
|
||||
}
|
||||
77
vendor/golang.org/x/net/ipv4/defs_darwin.go
generated
vendored
Normal file
77
vendor/golang.org/x/net/ipv4/defs_darwin.go
generated
vendored
Normal file
@@ -0,0 +1,77 @@
|
||||
// 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 ignore
|
||||
|
||||
// +godefs map struct_in_addr [4]byte /* in_addr */
|
||||
|
||||
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_STRIPHDR = C.IP_STRIPHDR
|
||||
sysIP_RECVTTL = C.IP_RECVTTL
|
||||
sysIP_BOUND_IF = C.IP_BOUND_IF
|
||||
sysIP_PKTINFO = C.IP_PKTINFO
|
||||
sysIP_RECVPKTINFO = C.IP_RECVPKTINFO
|
||||
|
||||
sysIP_MULTICAST_IF = C.IP_MULTICAST_IF
|
||||
sysIP_MULTICAST_TTL = C.IP_MULTICAST_TTL
|
||||
sysIP_MULTICAST_LOOP = C.IP_MULTICAST_LOOP
|
||||
sysIP_ADD_MEMBERSHIP = C.IP_ADD_MEMBERSHIP
|
||||
sysIP_DROP_MEMBERSHIP = C.IP_DROP_MEMBERSHIP
|
||||
sysIP_MULTICAST_VIF = C.IP_MULTICAST_VIF
|
||||
sysIP_MULTICAST_IFINDEX = C.IP_MULTICAST_IFINDEX
|
||||
sysIP_ADD_SOURCE_MEMBERSHIP = C.IP_ADD_SOURCE_MEMBERSHIP
|
||||
sysIP_DROP_SOURCE_MEMBERSHIP = C.IP_DROP_SOURCE_MEMBERSHIP
|
||||
sysIP_BLOCK_SOURCE = C.IP_BLOCK_SOURCE
|
||||
sysIP_UNBLOCK_SOURCE = C.IP_UNBLOCK_SOURCE
|
||||
sysMCAST_JOIN_GROUP = C.MCAST_JOIN_GROUP
|
||||
sysMCAST_LEAVE_GROUP = C.MCAST_LEAVE_GROUP
|
||||
sysMCAST_JOIN_SOURCE_GROUP = C.MCAST_JOIN_SOURCE_GROUP
|
||||
sysMCAST_LEAVE_SOURCE_GROUP = C.MCAST_LEAVE_SOURCE_GROUP
|
||||
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
|
||||
|
||||
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
|
||||
)
|
||||
|
||||
type sysSockaddrStorage C.struct_sockaddr_storage
|
||||
|
||||
type sysSockaddrInet C.struct_sockaddr_in
|
||||
|
||||
type sysInetPktinfo C.struct_in_pktinfo
|
||||
|
||||
type sysIPMreq C.struct_ip_mreq
|
||||
|
||||
type sysIPMreqn C.struct_ip_mreqn
|
||||
|
||||
type sysIPMreqSource C.struct_ip_mreq_source
|
||||
|
||||
type sysGroupReq C.struct_group_req
|
||||
|
||||
type sysGroupSourceReq C.struct_group_source_req
|
||||
38
vendor/golang.org/x/net/ipv4/defs_dragonfly.go
generated
vendored
Normal file
38
vendor/golang.org/x/net/ipv4/defs_dragonfly.go
generated
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
// 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 ignore
|
||||
|
||||
// +godefs map struct_in_addr [4]byte /* in_addr */
|
||||
|
||||
package ipv4
|
||||
|
||||
/*
|
||||
#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_RECVTTL = C.IP_RECVTTL
|
||||
|
||||
sysIP_MULTICAST_IF = C.IP_MULTICAST_IF
|
||||
sysIP_MULTICAST_TTL = C.IP_MULTICAST_TTL
|
||||
sysIP_MULTICAST_LOOP = C.IP_MULTICAST_LOOP
|
||||
sysIP_MULTICAST_VIF = C.IP_MULTICAST_VIF
|
||||
sysIP_ADD_MEMBERSHIP = C.IP_ADD_MEMBERSHIP
|
||||
sysIP_DROP_MEMBERSHIP = C.IP_DROP_MEMBERSHIP
|
||||
|
||||
sysSizeofIPMreq = C.sizeof_struct_ip_mreq
|
||||
)
|
||||
|
||||
type sysIPMreq C.struct_ip_mreq
|
||||
75
vendor/golang.org/x/net/ipv4/defs_freebsd.go
generated
vendored
Normal file
75
vendor/golang.org/x/net/ipv4/defs_freebsd.go
generated
vendored
Normal file
@@ -0,0 +1,75 @@
|
||||
// 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 ignore
|
||||
|
||||
// +godefs map struct_in_addr [4]byte /* in_addr */
|
||||
|
||||
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_SENDSRCADDR = C.IP_SENDSRCADDR
|
||||
sysIP_RETOPTS = C.IP_RETOPTS
|
||||
sysIP_RECVIF = C.IP_RECVIF
|
||||
sysIP_ONESBCAST = C.IP_ONESBCAST
|
||||
sysIP_BINDANY = C.IP_BINDANY
|
||||
sysIP_RECVTTL = C.IP_RECVTTL
|
||||
sysIP_MINTTL = C.IP_MINTTL
|
||||
sysIP_DONTFRAG = C.IP_DONTFRAG
|
||||
sysIP_RECVTOS = C.IP_RECVTOS
|
||||
|
||||
sysIP_MULTICAST_IF = C.IP_MULTICAST_IF
|
||||
sysIP_MULTICAST_TTL = C.IP_MULTICAST_TTL
|
||||
sysIP_MULTICAST_LOOP = C.IP_MULTICAST_LOOP
|
||||
sysIP_ADD_MEMBERSHIP = C.IP_ADD_MEMBERSHIP
|
||||
sysIP_DROP_MEMBERSHIP = C.IP_DROP_MEMBERSHIP
|
||||
sysIP_MULTICAST_VIF = C.IP_MULTICAST_VIF
|
||||
sysIP_ADD_SOURCE_MEMBERSHIP = C.IP_ADD_SOURCE_MEMBERSHIP
|
||||
sysIP_DROP_SOURCE_MEMBERSHIP = C.IP_DROP_SOURCE_MEMBERSHIP
|
||||
sysIP_BLOCK_SOURCE = C.IP_BLOCK_SOURCE
|
||||
sysIP_UNBLOCK_SOURCE = C.IP_UNBLOCK_SOURCE
|
||||
sysMCAST_JOIN_GROUP = C.MCAST_JOIN_GROUP
|
||||
sysMCAST_LEAVE_GROUP = C.MCAST_LEAVE_GROUP
|
||||
sysMCAST_JOIN_SOURCE_GROUP = C.MCAST_JOIN_SOURCE_GROUP
|
||||
sysMCAST_LEAVE_SOURCE_GROUP = C.MCAST_LEAVE_SOURCE_GROUP
|
||||
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
|
||||
|
||||
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
|
||||
)
|
||||
|
||||
type sysSockaddrStorage C.struct_sockaddr_storage
|
||||
|
||||
type sysSockaddrInet C.struct_sockaddr_in
|
||||
|
||||
type sysIPMreq C.struct_ip_mreq
|
||||
|
||||
type sysIPMreqn C.struct_ip_mreqn
|
||||
|
||||
type sysIPMreqSource C.struct_ip_mreq_source
|
||||
|
||||
type sysGroupReq C.struct_group_req
|
||||
|
||||
type sysGroupSourceReq C.struct_group_source_req
|
||||
120
vendor/golang.org/x/net/ipv4/defs_linux.go
generated
vendored
Normal file
120
vendor/golang.org/x/net/ipv4/defs_linux.go
generated
vendored
Normal file
@@ -0,0 +1,120 @@
|
||||
// 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 ignore
|
||||
|
||||
// +godefs map struct_in_addr [4]byte /* in_addr */
|
||||
|
||||
package ipv4
|
||||
|
||||
/*
|
||||
#include <time.h>
|
||||
|
||||
#include <linux/errqueue.h>
|
||||
#include <linux/icmp.h>
|
||||
#include <linux/in.h>
|
||||
#include <linux/filter.h>
|
||||
#include <sys/socket.h>
|
||||
*/
|
||||
import "C"
|
||||
|
||||
const (
|
||||
sysIP_TOS = C.IP_TOS
|
||||
sysIP_TTL = C.IP_TTL
|
||||
sysIP_HDRINCL = C.IP_HDRINCL
|
||||
sysIP_OPTIONS = C.IP_OPTIONS
|
||||
sysIP_ROUTER_ALERT = C.IP_ROUTER_ALERT
|
||||
sysIP_RECVOPTS = C.IP_RECVOPTS
|
||||
sysIP_RETOPTS = C.IP_RETOPTS
|
||||
sysIP_PKTINFO = C.IP_PKTINFO
|
||||
sysIP_PKTOPTIONS = C.IP_PKTOPTIONS
|
||||
sysIP_MTU_DISCOVER = C.IP_MTU_DISCOVER
|
||||
sysIP_RECVERR = C.IP_RECVERR
|
||||
sysIP_RECVTTL = C.IP_RECVTTL
|
||||
sysIP_RECVTOS = C.IP_RECVTOS
|
||||
sysIP_MTU = C.IP_MTU
|
||||
sysIP_FREEBIND = C.IP_FREEBIND
|
||||
sysIP_TRANSPARENT = C.IP_TRANSPARENT
|
||||
sysIP_RECVRETOPTS = C.IP_RECVRETOPTS
|
||||
sysIP_ORIGDSTADDR = C.IP_ORIGDSTADDR
|
||||
sysIP_RECVORIGDSTADDR = C.IP_RECVORIGDSTADDR
|
||||
sysIP_MINTTL = C.IP_MINTTL
|
||||
sysIP_NODEFRAG = C.IP_NODEFRAG
|
||||
sysIP_UNICAST_IF = C.IP_UNICAST_IF
|
||||
|
||||
sysIP_MULTICAST_IF = C.IP_MULTICAST_IF
|
||||
sysIP_MULTICAST_TTL = C.IP_MULTICAST_TTL
|
||||
sysIP_MULTICAST_LOOP = C.IP_MULTICAST_LOOP
|
||||
sysIP_ADD_MEMBERSHIP = C.IP_ADD_MEMBERSHIP
|
||||
sysIP_DROP_MEMBERSHIP = C.IP_DROP_MEMBERSHIP
|
||||
sysIP_UNBLOCK_SOURCE = C.IP_UNBLOCK_SOURCE
|
||||
sysIP_BLOCK_SOURCE = C.IP_BLOCK_SOURCE
|
||||
sysIP_ADD_SOURCE_MEMBERSHIP = C.IP_ADD_SOURCE_MEMBERSHIP
|
||||
sysIP_DROP_SOURCE_MEMBERSHIP = C.IP_DROP_SOURCE_MEMBERSHIP
|
||||
sysIP_MSFILTER = C.IP_MSFILTER
|
||||
sysMCAST_JOIN_GROUP = C.MCAST_JOIN_GROUP
|
||||
sysMCAST_LEAVE_GROUP = C.MCAST_LEAVE_GROUP
|
||||
sysMCAST_JOIN_SOURCE_GROUP = C.MCAST_JOIN_SOURCE_GROUP
|
||||
sysMCAST_LEAVE_SOURCE_GROUP = C.MCAST_LEAVE_SOURCE_GROUP
|
||||
sysMCAST_BLOCK_SOURCE = C.MCAST_BLOCK_SOURCE
|
||||
sysMCAST_UNBLOCK_SOURCE = C.MCAST_UNBLOCK_SOURCE
|
||||
sysMCAST_MSFILTER = C.MCAST_MSFILTER
|
||||
sysIP_MULTICAST_ALL = C.IP_MULTICAST_ALL
|
||||
|
||||
//sysIP_PMTUDISC_DONT = C.IP_PMTUDISC_DONT
|
||||
//sysIP_PMTUDISC_WANT = C.IP_PMTUDISC_WANT
|
||||
//sysIP_PMTUDISC_DO = C.IP_PMTUDISC_DO
|
||||
//sysIP_PMTUDISC_PROBE = C.IP_PMTUDISC_PROBE
|
||||
//sysIP_PMTUDISC_INTERFACE = C.IP_PMTUDISC_INTERFACE
|
||||
//sysIP_PMTUDISC_OMIT = C.IP_PMTUDISC_OMIT
|
||||
|
||||
sysICMP_FILTER = C.ICMP_FILTER
|
||||
|
||||
sysSO_EE_ORIGIN_NONE = C.SO_EE_ORIGIN_NONE
|
||||
sysSO_EE_ORIGIN_LOCAL = C.SO_EE_ORIGIN_LOCAL
|
||||
sysSO_EE_ORIGIN_ICMP = C.SO_EE_ORIGIN_ICMP
|
||||
sysSO_EE_ORIGIN_ICMP6 = C.SO_EE_ORIGIN_ICMP6
|
||||
sysSO_EE_ORIGIN_TXSTATUS = C.SO_EE_ORIGIN_TXSTATUS
|
||||
sysSO_EE_ORIGIN_TIMESTAMPING = C.SO_EE_ORIGIN_TIMESTAMPING
|
||||
|
||||
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
|
||||
|
||||
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
|
||||
|
||||
sysSizeofICMPFilter = C.sizeof_struct_icmp_filter
|
||||
)
|
||||
|
||||
type sysKernelSockaddrStorage C.struct___kernel_sockaddr_storage
|
||||
|
||||
type sysSockaddrInet C.struct_sockaddr_in
|
||||
|
||||
type sysInetPktinfo C.struct_in_pktinfo
|
||||
|
||||
type sysSockExtendedErr C.struct_sock_extended_err
|
||||
|
||||
type sysIPMreq C.struct_ip_mreq
|
||||
|
||||
type sysIPMreqn C.struct_ip_mreqn
|
||||
|
||||
type sysIPMreqSource C.struct_ip_mreq_source
|
||||
|
||||
type sysGroupReq C.struct_group_req
|
||||
|
||||
type sysGroupSourceReq C.struct_group_source_req
|
||||
|
||||
type sysICMPFilter C.struct_icmp_filter
|
||||
|
||||
type sysSockFProg C.struct_sock_fprog
|
||||
|
||||
type sysSockFilter C.struct_sock_filter
|
||||
37
vendor/golang.org/x/net/ipv4/defs_netbsd.go
generated
vendored
Normal file
37
vendor/golang.org/x/net/ipv4/defs_netbsd.go
generated
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
// 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 ignore
|
||||
|
||||
// +godefs map struct_in_addr [4]byte /* in_addr */
|
||||
|
||||
package ipv4
|
||||
|
||||
/*
|
||||
#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_RECVTTL = C.IP_RECVTTL
|
||||
|
||||
sysIP_MULTICAST_IF = C.IP_MULTICAST_IF
|
||||
sysIP_MULTICAST_TTL = C.IP_MULTICAST_TTL
|
||||
sysIP_MULTICAST_LOOP = C.IP_MULTICAST_LOOP
|
||||
sysIP_ADD_MEMBERSHIP = C.IP_ADD_MEMBERSHIP
|
||||
sysIP_DROP_MEMBERSHIP = C.IP_DROP_MEMBERSHIP
|
||||
|
||||
sysSizeofIPMreq = C.sizeof_struct_ip_mreq
|
||||
)
|
||||
|
||||
type sysIPMreq C.struct_ip_mreq
|
||||
37
vendor/golang.org/x/net/ipv4/defs_openbsd.go
generated
vendored
Normal file
37
vendor/golang.org/x/net/ipv4/defs_openbsd.go
generated
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
// 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 ignore
|
||||
|
||||
// +godefs map struct_in_addr [4]byte /* in_addr */
|
||||
|
||||
package ipv4
|
||||
|
||||
/*
|
||||
#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_RECVTTL = C.IP_RECVTTL
|
||||
|
||||
sysIP_MULTICAST_IF = C.IP_MULTICAST_IF
|
||||
sysIP_MULTICAST_TTL = C.IP_MULTICAST_TTL
|
||||
sysIP_MULTICAST_LOOP = C.IP_MULTICAST_LOOP
|
||||
sysIP_ADD_MEMBERSHIP = C.IP_ADD_MEMBERSHIP
|
||||
sysIP_DROP_MEMBERSHIP = C.IP_DROP_MEMBERSHIP
|
||||
|
||||
sysSizeofIPMreq = C.sizeof_struct_ip_mreq
|
||||
)
|
||||
|
||||
type sysIPMreq C.struct_ip_mreq
|
||||
57
vendor/golang.org/x/net/ipv4/defs_solaris.go
generated
vendored
Normal file
57
vendor/golang.org/x/net/ipv4/defs_solaris.go
generated
vendored
Normal file
@@ -0,0 +1,57 @@
|
||||
// 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 ignore
|
||||
|
||||
// +godefs map struct_in_addr [4]byte /* in_addr */
|
||||
|
||||
package ipv4
|
||||
|
||||
/*
|
||||
#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_MULTICAST_IF = C.IP_MULTICAST_IF
|
||||
sysIP_MULTICAST_TTL = C.IP_MULTICAST_TTL
|
||||
sysIP_MULTICAST_LOOP = C.IP_MULTICAST_LOOP
|
||||
sysIP_ADD_MEMBERSHIP = C.IP_ADD_MEMBERSHIP
|
||||
sysIP_DROP_MEMBERSHIP = C.IP_DROP_MEMBERSHIP
|
||||
sysIP_BLOCK_SOURCE = C.IP_BLOCK_SOURCE
|
||||
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
|
||||
|
||||
sysSizeofInetPktinfo = C.sizeof_struct_in_pktinfo
|
||||
|
||||
sysSizeofIPMreq = C.sizeof_struct_ip_mreq
|
||||
sysSizeofIPMreqSource = C.sizeof_struct_ip_mreq_source
|
||||
)
|
||||
|
||||
type sysInetPktinfo C.struct_in_pktinfo
|
||||
|
||||
type sysIPMreq C.struct_ip_mreq
|
||||
|
||||
type sysIPMreqSource C.struct_ip_mreq_source
|
||||
251
vendor/golang.org/x/net/ipv4/dgramopt_posix.go
generated
vendored
Normal file
251
vendor/golang.org/x/net/ipv4/dgramopt_posix.go
generated
vendored
Normal file
@@ -0,0 +1,251 @@
|
||||
// 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"
|
||||
)
|
||||
|
||||
// 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
|
||||
}
|
||||
fd, err := c.sysfd()
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
return getInt(fd, &sockOpts[ssoMulticastTTL])
|
||||
}
|
||||
|
||||
// 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
|
||||
}
|
||||
fd, err := c.sysfd()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return setInt(fd, &sockOpts[ssoMulticastTTL], ttl)
|
||||
}
|
||||
|
||||
// MulticastInterface returns the default interface for multicast
|
||||
// packet transmissions.
|
||||
func (c *dgramOpt) MulticastInterface() (*net.Interface, error) {
|
||||
if !c.ok() {
|
||||
return nil, syscall.EINVAL
|
||||
}
|
||||
fd, err := c.sysfd()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return getInterface(fd, &sockOpts[ssoMulticastInterface])
|
||||
}
|
||||
|
||||
// SetMulticastInterface sets the default interface for future
|
||||
// multicast packet transmissions.
|
||||
func (c *dgramOpt) SetMulticastInterface(ifi *net.Interface) error {
|
||||
if !c.ok() {
|
||||
return syscall.EINVAL
|
||||
}
|
||||
fd, err := c.sysfd()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return setInterface(fd, &sockOpts[ssoMulticastInterface], 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
|
||||
}
|
||||
fd, err := c.sysfd()
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
on, err := getInt(fd, &sockOpts[ssoMulticastLoopback])
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
return on == 1, nil
|
||||
}
|
||||
|
||||
// SetMulticastLoopback sets whether transmitted multicast packets
|
||||
// should be copied and send back to the originator.
|
||||
func (c *dgramOpt) SetMulticastLoopback(on bool) error {
|
||||
if !c.ok() {
|
||||
return syscall.EINVAL
|
||||
}
|
||||
fd, err := c.sysfd()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return setInt(fd, &sockOpts[ssoMulticastLoopback], boolint(on))
|
||||
}
|
||||
|
||||
// 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 {
|
||||
if !c.ok() {
|
||||
return syscall.EINVAL
|
||||
}
|
||||
fd, err := c.sysfd()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
grp := netAddrToIP4(group)
|
||||
if grp == nil {
|
||||
return errMissingAddress
|
||||
}
|
||||
return setGroup(fd, &sockOpts[ssoJoinGroup], ifi, grp)
|
||||
}
|
||||
|
||||
// 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 {
|
||||
if !c.ok() {
|
||||
return syscall.EINVAL
|
||||
}
|
||||
fd, err := c.sysfd()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
grp := netAddrToIP4(group)
|
||||
if grp == nil {
|
||||
return errMissingAddress
|
||||
}
|
||||
return setGroup(fd, &sockOpts[ssoLeaveGroup], ifi, grp)
|
||||
}
|
||||
|
||||
// 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 {
|
||||
if !c.ok() {
|
||||
return syscall.EINVAL
|
||||
}
|
||||
fd, err := c.sysfd()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
grp := netAddrToIP4(group)
|
||||
if grp == nil {
|
||||
return errMissingAddress
|
||||
}
|
||||
src := netAddrToIP4(source)
|
||||
if src == nil {
|
||||
return errMissingAddress
|
||||
}
|
||||
return setSourceGroup(fd, &sockOpts[ssoJoinSourceGroup], 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
|
||||
}
|
||||
fd, err := c.sysfd()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
grp := netAddrToIP4(group)
|
||||
if grp == nil {
|
||||
return errMissingAddress
|
||||
}
|
||||
src := netAddrToIP4(source)
|
||||
if src == nil {
|
||||
return errMissingAddress
|
||||
}
|
||||
return setSourceGroup(fd, &sockOpts[ssoLeaveSourceGroup], ifi, grp, src)
|
||||
}
|
||||
|
||||
// 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 {
|
||||
if !c.ok() {
|
||||
return syscall.EINVAL
|
||||
}
|
||||
fd, err := c.sysfd()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
grp := netAddrToIP4(group)
|
||||
if grp == nil {
|
||||
return errMissingAddress
|
||||
}
|
||||
src := netAddrToIP4(source)
|
||||
if src == nil {
|
||||
return errMissingAddress
|
||||
}
|
||||
return setSourceGroup(fd, &sockOpts[ssoBlockSourceGroup], 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
|
||||
}
|
||||
fd, err := c.sysfd()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
grp := netAddrToIP4(group)
|
||||
if grp == nil {
|
||||
return errMissingAddress
|
||||
}
|
||||
src := netAddrToIP4(source)
|
||||
if src == nil {
|
||||
return errMissingAddress
|
||||
}
|
||||
return setSourceGroup(fd, &sockOpts[ssoUnblockSourceGroup], 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
|
||||
}
|
||||
fd, err := c.sysfd()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return getICMPFilter(fd, &sockOpts[ssoICMPFilter])
|
||||
}
|
||||
|
||||
// SetICMPFilter deploys the ICMP filter.
|
||||
// Currently only Linux supports this.
|
||||
func (c *dgramOpt) SetICMPFilter(f *ICMPFilter) error {
|
||||
if !c.ok() {
|
||||
return syscall.EINVAL
|
||||
}
|
||||
fd, err := c.sysfd()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return setICMPFilter(fd, &sockOpts[ssoICMPFilter], f)
|
||||
}
|
||||
106
vendor/golang.org/x/net/ipv4/dgramopt_stub.go
generated
vendored
Normal file
106
vendor/golang.org/x/net/ipv4/dgramopt_stub.go
generated
vendored
Normal file
@@ -0,0 +1,106 @@
|
||||
// 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
|
||||
}
|
||||
242
vendor/golang.org/x/net/ipv4/doc.go
generated
vendored
Normal file
242
vendor/golang.org/x/net/ipv4/doc.go
generated
vendored
Normal file
@@ -0,0 +1,242 @@
|
||||
// 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 implements IP-level socket options for the Internet
|
||||
// Protocol version 4.
|
||||
//
|
||||
// The package provides IP-level socket options that allow
|
||||
// manipulation of IPv4 facilities.
|
||||
//
|
||||
// The IPv4 protocol and basic host requirements for IPv4 are defined
|
||||
// in RFC 791 and RFC 1122.
|
||||
// Host extensions for multicasting and socket interface extensions
|
||||
// for multicast source filters are defined in RFC 1112 and RFC 3678.
|
||||
// IGMPv1, IGMPv2 and IGMPv3 are defined in RFC 1112, RFC 2236 and RFC
|
||||
// 3376.
|
||||
// Source-specific multicast is defined in RFC 4607.
|
||||
//
|
||||
//
|
||||
// Unicasting
|
||||
//
|
||||
// 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
|
||||
// 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.
|
||||
//
|
||||
// ln, err := net.Listen("tcp4", "0.0.0.0:1024")
|
||||
// if err != nil {
|
||||
// // error handling
|
||||
// }
|
||||
// defer ln.Close()
|
||||
// for {
|
||||
// c, err := ln.Accept()
|
||||
// if err != nil {
|
||||
// // error handling
|
||||
// }
|
||||
// go func(c net.Conn) {
|
||||
// defer c.Close()
|
||||
//
|
||||
// The outgoing packets will be labeled DiffServ assured forwarding
|
||||
// class 1 low drop precedence, known as AF11 packets.
|
||||
//
|
||||
// if err := ipv4.NewConn(c).SetTOS(0x28); err != nil {
|
||||
// // error handling
|
||||
// }
|
||||
// if _, err := c.Write(data); err != nil {
|
||||
// // error handling
|
||||
// }
|
||||
// }(c)
|
||||
// }
|
||||
//
|
||||
//
|
||||
// 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
|
||||
// you begin multicasting, at a minimum joining network interfaces and
|
||||
// multicast groups.
|
||||
//
|
||||
// en0, err := net.InterfaceByName("en0")
|
||||
// if err != nil {
|
||||
// // error handling
|
||||
// }
|
||||
// en1, err := net.InterfaceByIndex(911)
|
||||
// if err != nil {
|
||||
// // error handling
|
||||
// }
|
||||
// group := net.IPv4(224, 0, 0, 250)
|
||||
//
|
||||
// First, an application listens to an appropriate address with an
|
||||
// appropriate service port.
|
||||
//
|
||||
// c, err := net.ListenPacket("udp4", "0.0.0.0:1024")
|
||||
// if err != nil {
|
||||
// // error handling
|
||||
// }
|
||||
// defer c.Close()
|
||||
//
|
||||
// Second, the application joins multicast groups, starts listening to
|
||||
// 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.
|
||||
//
|
||||
// p := ipv4.NewPacketConn(c)
|
||||
// if err := p.JoinGroup(en0, &net.UDPAddr{IP: group}); err != nil {
|
||||
// // error handling
|
||||
// }
|
||||
// if err := p.JoinGroup(en1, &net.UDPAddr{IP: group}); err != nil {
|
||||
// // error handling
|
||||
// }
|
||||
//
|
||||
// The application might set per packet control message transmissions
|
||||
// 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.
|
||||
//
|
||||
// if err := p.SetControlMessage(ipv4.FlagDst, true); err != nil {
|
||||
// // error handling
|
||||
// }
|
||||
//
|
||||
// The application could identify whether the received packets are
|
||||
// of interest by using the control message that contains the
|
||||
// destination address of the received packet.
|
||||
//
|
||||
// b := make([]byte, 1500)
|
||||
// for {
|
||||
// n, cm, src, err := p.ReadFrom(b)
|
||||
// if err != nil {
|
||||
// // error handling
|
||||
// }
|
||||
// if cm.Dst.IsMulticast() {
|
||||
// if cm.Dst.Equal(group) {
|
||||
// // joined group, do something
|
||||
// } else {
|
||||
// // unknown group, discard
|
||||
// continue
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// The application can also send both unicast and multicast packets.
|
||||
//
|
||||
// p.SetTOS(0x0)
|
||||
// p.SetTTL(16)
|
||||
// if _, err := p.WriteTo(data, nil, src); err != nil {
|
||||
// // error handling
|
||||
// }
|
||||
// dst := &net.UDPAddr{IP: group, Port: 1024}
|
||||
// for _, ifi := range []*net.Interface{en0, en1} {
|
||||
// if err := p.SetMulticastInterface(ifi); err != nil {
|
||||
// // error handling
|
||||
// }
|
||||
// p.SetMulticastTTL(2)
|
||||
// if _, err := p.WriteTo(data, nil, dst); err != nil {
|
||||
// // error handling
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
//
|
||||
// More multicasting
|
||||
//
|
||||
// An application that uses PacketConn or RawConn may join multiple
|
||||
// multicast groups. For example, a UDP listener with port 1024 might
|
||||
// join two different groups across over two different network
|
||||
// interfaces by using:
|
||||
//
|
||||
// c, err := net.ListenPacket("udp4", "0.0.0.0:1024")
|
||||
// if err != nil {
|
||||
// // error handling
|
||||
// }
|
||||
// defer c.Close()
|
||||
// p := ipv4.NewPacketConn(c)
|
||||
// if err := p.JoinGroup(en0, &net.UDPAddr{IP: net.IPv4(224, 0, 0, 248)}); err != nil {
|
||||
// // error handling
|
||||
// }
|
||||
// if err := p.JoinGroup(en0, &net.UDPAddr{IP: net.IPv4(224, 0, 0, 249)}); err != nil {
|
||||
// // error handling
|
||||
// }
|
||||
// if err := p.JoinGroup(en1, &net.UDPAddr{IP: net.IPv4(224, 0, 0, 249)}); err != nil {
|
||||
// // error handling
|
||||
// }
|
||||
//
|
||||
// It is possible for multiple UDP listeners that listen on the same
|
||||
// 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.
|
||||
//
|
||||
// c1, err := net.ListenPacket("udp4", "224.0.0.0:1024")
|
||||
// if err != nil {
|
||||
// // error handling
|
||||
// }
|
||||
// defer c1.Close()
|
||||
// c2, err := net.ListenPacket("udp4", "224.0.0.0:1024")
|
||||
// if err != nil {
|
||||
// // error handling
|
||||
// }
|
||||
// defer c2.Close()
|
||||
// p1 := ipv4.NewPacketConn(c1)
|
||||
// if err := p1.JoinGroup(en0, &net.UDPAddr{IP: net.IPv4(224, 0, 0, 248)}); err != nil {
|
||||
// // error handling
|
||||
// }
|
||||
// p2 := ipv4.NewPacketConn(c2)
|
||||
// if err := p2.JoinGroup(en0, &net.UDPAddr{IP: net.IPv4(224, 0, 0, 248)}); err != nil {
|
||||
// // error handling
|
||||
// }
|
||||
//
|
||||
// Also it is possible for the application to leave or rejoin a
|
||||
// multicast group on the network interface.
|
||||
//
|
||||
// if err := p.LeaveGroup(en0, &net.UDPAddr{IP: net.IPv4(224, 0, 0, 248)}); err != nil {
|
||||
// // error handling
|
||||
// }
|
||||
// if err := p.JoinGroup(en0, &net.UDPAddr{IP: net.IPv4(224, 0, 0, 250)}); err != nil {
|
||||
// // error handling
|
||||
// }
|
||||
//
|
||||
//
|
||||
// Source-specific multicasting
|
||||
//
|
||||
// An application that uses PacketConn or RawConn on IGMPv3 supported
|
||||
// platform is able to join source-specific multicast groups.
|
||||
// The application may use JoinSourceSpecificGroup and
|
||||
// LeaveSourceSpecificGroup for the operation known as "include" mode,
|
||||
//
|
||||
// ssmgroup := net.UDPAddr{IP: net.IPv4(232, 7, 8, 9)}
|
||||
// ssmsource := net.UDPAddr{IP: net.IPv4(192, 168, 0, 1)})
|
||||
// if err := p.JoinSourceSpecificGroup(en0, &ssmgroup, &ssmsource); err != nil {
|
||||
// // error handling
|
||||
// }
|
||||
// if err := p.LeaveSourceSpecificGroup(en0, &ssmgroup, &ssmsource); err != nil {
|
||||
// // error handling
|
||||
// }
|
||||
//
|
||||
// or JoinGroup, ExcludeSourceSpecificGroup,
|
||||
// IncludeSourceSpecificGroup and LeaveGroup for the operation known
|
||||
// as "exclude" mode.
|
||||
//
|
||||
// exclsource := net.UDPAddr{IP: net.IPv4(192, 168, 0, 254)}
|
||||
// if err := p.JoinGroup(en0, &ssmgroup); err != nil {
|
||||
// // error handling
|
||||
// }
|
||||
// if err := p.ExcludeSourceSpecificGroup(en0, &ssmgroup, &exclsource); err != nil {
|
||||
// // error handling
|
||||
// }
|
||||
// if err := p.LeaveGroup(en0, &ssmgroup); err != nil {
|
||||
// // error handling
|
||||
// }
|
||||
//
|
||||
// Note that it depends on each platform implementation what happens
|
||||
// when an application which runs on IGMPv3 unsupported platform uses
|
||||
// JoinSourceSpecificGroup and LeaveSourceSpecificGroup.
|
||||
// In general the platform tries to fall back to conversations using
|
||||
// IGMPv1 or IGMPv2 and starts to listen to multicast traffic.
|
||||
// In the fallback case, ExcludeSourceSpecificGroup and
|
||||
// IncludeSourceSpecificGroup may return an error.
|
||||
package ipv4
|
||||
187
vendor/golang.org/x/net/ipv4/endpoint.go
generated
vendored
Normal file
187
vendor/golang.org/x/net/ipv4/endpoint.go
generated
vendored
Normal file
@@ -0,0 +1,187 @@
|
||||
// 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"
|
||||
"syscall"
|
||||
"time"
|
||||
)
|
||||
|
||||
// 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.
|
||||
type Conn struct {
|
||||
genericOpt
|
||||
}
|
||||
|
||||
type genericOpt struct {
|
||||
net.Conn
|
||||
}
|
||||
|
||||
func (c *genericOpt) ok() bool { return c != nil && c.Conn != nil }
|
||||
|
||||
// NewConn returns a new Conn.
|
||||
func NewConn(c net.Conn) *Conn {
|
||||
return &Conn{
|
||||
genericOpt: genericOpt{Conn: c},
|
||||
}
|
||||
}
|
||||
|
||||
// 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
|
||||
// network I/O methods specific to the IPv4 and higher layer protocols
|
||||
// such as UDP.
|
||||
type PacketConn struct {
|
||||
genericOpt
|
||||
dgramOpt
|
||||
payloadHandler
|
||||
}
|
||||
|
||||
type dgramOpt struct {
|
||||
net.PacketConn
|
||||
}
|
||||
|
||||
func (c *dgramOpt) ok() bool { return c != nil && c.PacketConn != 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
|
||||
}
|
||||
fd, err := c.payloadHandler.sysfd()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return setControlMessage(fd, &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 c.payloadHandler.PacketConn.SetDeadline(t)
|
||||
}
|
||||
|
||||
// SetReadDeadline sets the read deadline associated with the
|
||||
// endpoint.
|
||||
func (c *PacketConn) SetReadDeadline(t time.Time) error {
|
||||
if !c.payloadHandler.ok() {
|
||||
return syscall.EINVAL
|
||||
}
|
||||
return c.payloadHandler.PacketConn.SetReadDeadline(t)
|
||||
}
|
||||
|
||||
// SetWriteDeadline sets the write deadline associated with the
|
||||
// endpoint.
|
||||
func (c *PacketConn) SetWriteDeadline(t time.Time) error {
|
||||
if !c.payloadHandler.ok() {
|
||||
return syscall.EINVAL
|
||||
}
|
||||
return c.payloadHandler.PacketConn.SetWriteDeadline(t)
|
||||
}
|
||||
|
||||
// Close closes the endpoint.
|
||||
func (c *PacketConn) Close() error {
|
||||
if !c.payloadHandler.ok() {
|
||||
return syscall.EINVAL
|
||||
}
|
||||
return c.payloadHandler.PacketConn.Close()
|
||||
}
|
||||
|
||||
// NewPacketConn returns a new PacketConn using c as its underlying
|
||||
// transport.
|
||||
func NewPacketConn(c net.PacketConn) *PacketConn {
|
||||
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))
|
||||
}
|
||||
}
|
||||
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
|
||||
// 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 {
|
||||
genericOpt
|
||||
dgramOpt
|
||||
packetHandler
|
||||
}
|
||||
|
||||
// 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
|
||||
}
|
||||
fd, err := c.packetHandler.sysfd()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return setControlMessage(fd, &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 c.packetHandler.c.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 c.packetHandler.c.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 c.packetHandler.c.SetWriteDeadline(t)
|
||||
}
|
||||
|
||||
// Close closes the endpoint.
|
||||
func (c *RawConn) Close() error {
|
||||
if !c.packetHandler.ok() {
|
||||
return syscall.EINVAL
|
||||
}
|
||||
return c.packetHandler.c.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()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err := setInt(fd, &sockOpts[ssoHeaderPrepend], boolint(true)); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return r, nil
|
||||
}
|
||||
208
vendor/golang.org/x/net/ipv4/gen.go
generated
vendored
Normal file
208
vendor/golang.org/x/net/ipv4/gen.go
generated
vendored
Normal file
@@ -0,0 +1,208 @@
|
||||
// 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.
|
||||
|
||||
// +build ignore
|
||||
|
||||
//go:generate go run gen.go
|
||||
|
||||
// This program generates system adaptation constants and types,
|
||||
// internet protocol constants and tables by reading template files
|
||||
// and IANA protocol registries.
|
||||
package main
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/xml"
|
||||
"fmt"
|
||||
"go/format"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"os"
|
||||
"os/exec"
|
||||
"runtime"
|
||||
"strconv"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func main() {
|
||||
if err := genzsys(); err != nil {
|
||||
fmt.Fprintln(os.Stderr, err)
|
||||
os.Exit(1)
|
||||
}
|
||||
if err := geniana(); err != nil {
|
||||
fmt.Fprintln(os.Stderr, err)
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
|
||||
func genzsys() error {
|
||||
defs := "defs_" + runtime.GOOS + ".go"
|
||||
f, err := os.Open(defs)
|
||||
if err != nil {
|
||||
if os.IsNotExist(err) {
|
||||
return nil
|
||||
}
|
||||
return err
|
||||
}
|
||||
f.Close()
|
||||
cmd := exec.Command("go", "tool", "cgo", "-godefs", defs)
|
||||
b, err := cmd.Output()
|
||||
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 == "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
|
||||
}
|
||||
zsys := "zsys_" + runtime.GOOS + ".go"
|
||||
switch runtime.GOOS {
|
||||
case "freebsd", "linux":
|
||||
zsys = "zsys_" + runtime.GOOS + "_" + runtime.GOARCH + ".go"
|
||||
}
|
||||
if err := ioutil.WriteFile(zsys, b, 0644); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
var registries = []struct {
|
||||
url string
|
||||
parse func(io.Writer, io.Reader) error
|
||||
}{
|
||||
{
|
||||
"http://www.iana.org/assignments/icmp-parameters/icmp-parameters.xml",
|
||||
parseICMPv4Parameters,
|
||||
},
|
||||
}
|
||||
|
||||
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, "package ipv4\n\n")
|
||||
for _, r := range registries {
|
||||
resp, err := http.Get(r.url)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
if resp.StatusCode != http.StatusOK {
|
||||
return fmt.Errorf("got HTTP status code %v for %v\n", resp.StatusCode, r.url)
|
||||
}
|
||||
if err := r.parse(&bb, resp.Body); err != nil {
|
||||
return err
|
||||
}
|
||||
fmt.Fprintf(&bb, "\n")
|
||||
}
|
||||
b, err := format.Source(bb.Bytes())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if err := ioutil.WriteFile("iana.go", b, 0644); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func parseICMPv4Parameters(w io.Writer, r io.Reader) error {
|
||||
dec := xml.NewDecoder(r)
|
||||
var icp icmpv4Parameters
|
||||
if err := dec.Decode(&icp); err != nil {
|
||||
return err
|
||||
}
|
||||
prs := icp.escape()
|
||||
fmt.Fprintf(w, "// %s, Updated: %s\n", icp.Title, icp.Updated)
|
||||
fmt.Fprintf(w, "const (\n")
|
||||
for _, pr := range prs {
|
||||
if pr.Descr == "" {
|
||||
continue
|
||||
}
|
||||
fmt.Fprintf(w, "ICMPType%s ICMPType = %d", pr.Descr, pr.Value)
|
||||
fmt.Fprintf(w, "// %s\n", pr.OrigDescr)
|
||||
}
|
||||
fmt.Fprintf(w, ")\n\n")
|
||||
fmt.Fprintf(w, "// %s, Updated: %s\n", icp.Title, icp.Updated)
|
||||
fmt.Fprintf(w, "var icmpTypes = map[ICMPType]string{\n")
|
||||
for _, pr := range prs {
|
||||
if pr.Descr == "" {
|
||||
continue
|
||||
}
|
||||
fmt.Fprintf(w, "%d: %q,\n", pr.Value, strings.ToLower(pr.OrigDescr))
|
||||
}
|
||||
fmt.Fprintf(w, "}\n")
|
||||
return nil
|
||||
}
|
||||
|
||||
type icmpv4Parameters struct {
|
||||
XMLName xml.Name `xml:"registry"`
|
||||
Title string `xml:"title"`
|
||||
Updated string `xml:"updated"`
|
||||
Registries []struct {
|
||||
Title string `xml:"title"`
|
||||
Records []struct {
|
||||
Value string `xml:"value"`
|
||||
Descr string `xml:"description"`
|
||||
} `xml:"record"`
|
||||
} `xml:"registry"`
|
||||
}
|
||||
|
||||
type canonICMPv4ParamRecord struct {
|
||||
OrigDescr string
|
||||
Descr string
|
||||
Value int
|
||||
}
|
||||
|
||||
func (icp *icmpv4Parameters) escape() []canonICMPv4ParamRecord {
|
||||
id := -1
|
||||
for i, r := range icp.Registries {
|
||||
if strings.Contains(r.Title, "Type") || strings.Contains(r.Title, "type") {
|
||||
id = i
|
||||
break
|
||||
}
|
||||
}
|
||||
if id < 0 {
|
||||
return nil
|
||||
}
|
||||
prs := make([]canonICMPv4ParamRecord, len(icp.Registries[id].Records))
|
||||
sr := strings.NewReplacer(
|
||||
"Messages", "",
|
||||
"Message", "",
|
||||
"ICMP", "",
|
||||
"+", "P",
|
||||
"-", "",
|
||||
"/", "",
|
||||
".", "",
|
||||
" ", "",
|
||||
)
|
||||
for i, pr := range icp.Registries[id].Records {
|
||||
if strings.Contains(pr.Descr, "Reserved") ||
|
||||
strings.Contains(pr.Descr, "Unassigned") ||
|
||||
strings.Contains(pr.Descr, "Deprecated") ||
|
||||
strings.Contains(pr.Descr, "Experiment") ||
|
||||
strings.Contains(pr.Descr, "experiment") {
|
||||
continue
|
||||
}
|
||||
ss := strings.Split(pr.Descr, "\n")
|
||||
if len(ss) > 1 {
|
||||
prs[i].Descr = strings.Join(ss, " ")
|
||||
} else {
|
||||
prs[i].Descr = ss[0]
|
||||
}
|
||||
s := strings.TrimSpace(prs[i].Descr)
|
||||
prs[i].OrigDescr = s
|
||||
prs[i].Descr = sr.Replace(s)
|
||||
prs[i].Value, _ = strconv.Atoi(pr.Value)
|
||||
}
|
||||
return prs
|
||||
}
|
||||
59
vendor/golang.org/x/net/ipv4/genericopt_posix.go
generated
vendored
Normal file
59
vendor/golang.org/x/net/ipv4/genericopt_posix.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 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
|
||||
}
|
||||
fd, err := c.sysfd()
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
return getInt(fd, &sockOpts[ssoTOS])
|
||||
}
|
||||
|
||||
// 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
|
||||
}
|
||||
fd, err := c.sysfd()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return setInt(fd, &sockOpts[ssoTOS], 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
|
||||
}
|
||||
fd, err := c.sysfd()
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
return getInt(fd, &sockOpts[ssoTTL])
|
||||
}
|
||||
|
||||
// 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
|
||||
}
|
||||
fd, err := c.sysfd()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return setInt(fd, &sockOpts[ssoTTL], ttl)
|
||||
}
|
||||
29
vendor/golang.org/x/net/ipv4/genericopt_stub.go
generated
vendored
Normal file
29
vendor/golang.org/x/net/ipv4/genericopt_stub.go
generated
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
// 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
|
||||
}
|
||||
132
vendor/golang.org/x/net/ipv4/header.go
generated
vendored
Normal file
132
vendor/golang.org/x/net/ipv4/header.go
generated
vendored
Normal file
@@ -0,0 +1,132 @@
|
||||
// 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"
|
||||
"fmt"
|
||||
"net"
|
||||
"runtime"
|
||||
"syscall"
|
||||
)
|
||||
|
||||
const (
|
||||
Version = 4 // protocol version
|
||||
HeaderLen = 20 // header length without extension headers
|
||||
maxHeaderLen = 60 // sensible default, revisit if later RFCs define new usage of version and header length fields
|
||||
)
|
||||
|
||||
type HeaderFlags int
|
||||
|
||||
const (
|
||||
MoreFragments HeaderFlags = 1 << iota // more fragments flag
|
||||
DontFragment // don't fragment flag
|
||||
)
|
||||
|
||||
// A Header represents an IPv4 header.
|
||||
type Header struct {
|
||||
Version int // protocol version
|
||||
Len int // header length
|
||||
TOS int // type-of-service
|
||||
TotalLen int // packet total length
|
||||
ID int // identification
|
||||
Flags HeaderFlags // flags
|
||||
FragOff int // fragment offset
|
||||
TTL int // time-to-live
|
||||
Protocol int // next protocol
|
||||
Checksum int // checksum
|
||||
Src net.IP // source address
|
||||
Dst net.IP // destination address
|
||||
Options []byte // options, extension headers
|
||||
}
|
||||
|
||||
func (h *Header) String() string {
|
||||
if h == nil {
|
||||
return "<nil>"
|
||||
}
|
||||
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.
|
||||
func (h *Header) Marshal() ([]byte, error) {
|
||||
if h == nil {
|
||||
return nil, syscall.EINVAL
|
||||
}
|
||||
if h.Len < HeaderLen {
|
||||
return nil, errHeaderTooShort
|
||||
}
|
||||
hdrlen := HeaderLen + len(h.Options)
|
||||
b := make([]byte, hdrlen)
|
||||
b[0] = byte(Version<<4 | (hdrlen >> 2 & 0x0f))
|
||||
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))
|
||||
default:
|
||||
binary.BigEndian.PutUint16(b[2:4], uint16(h.TotalLen))
|
||||
binary.BigEndian.PutUint16(b[6:8], uint16(flagsAndFragOff))
|
||||
}
|
||||
binary.BigEndian.PutUint16(b[4:6], uint16(h.ID))
|
||||
b[8] = byte(h.TTL)
|
||||
b[9] = byte(h.Protocol)
|
||||
binary.BigEndian.PutUint16(b[10:12], uint16(h.Checksum))
|
||||
if ip := h.Src.To4(); ip != nil {
|
||||
copy(b[12:16], ip[:net.IPv4len])
|
||||
}
|
||||
if ip := h.Dst.To4(); ip != nil {
|
||||
copy(b[16:20], ip[:net.IPv4len])
|
||||
} else {
|
||||
return nil, errMissingAddress
|
||||
}
|
||||
if len(h.Options) > 0 {
|
||||
copy(b[HeaderLen:], h.Options)
|
||||
}
|
||||
return b, nil
|
||||
}
|
||||
|
||||
// ParseHeader parses b as an IPv4 header.
|
||||
func ParseHeader(b []byte) (*Header, error) {
|
||||
if len(b) < HeaderLen {
|
||||
return nil, 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]),
|
||||
}
|
||||
switch runtime.GOOS {
|
||||
case "darwin", "dragonfly", "netbsd":
|
||||
h.TotalLen = int(nativeEndian.Uint16(b[2:4])) + hdrlen
|
||||
h.FragOff = int(nativeEndian.Uint16(b[6:8]))
|
||||
case "freebsd":
|
||||
h.TotalLen = int(nativeEndian.Uint16(b[2:4]))
|
||||
if freebsdVersion < 1000000 {
|
||||
h.TotalLen += hdrlen
|
||||
}
|
||||
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:])
|
||||
}
|
||||
return h, nil
|
||||
}
|
||||
59
vendor/golang.org/x/net/ipv4/helper.go
generated
vendored
Normal file
59
vendor/golang.org/x/net/ipv4/helper.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.
|
||||
|
||||
package ipv4
|
||||
|
||||
import (
|
||||
"encoding/binary"
|
||||
"errors"
|
||||
"net"
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
var (
|
||||
errMissingAddress = errors.New("missing address")
|
||||
errMissingHeader = errors.New("missing header")
|
||||
errHeaderTooShort = errors.New("header too short")
|
||||
errBufferTooShort = errors.New("buffer too short")
|
||||
errInvalidConnType = errors.New("invalid conn type")
|
||||
errOpNoSupport = errors.New("operation not supported")
|
||||
errNoSuchInterface = errors.New("no such interface")
|
||||
errNoSuchMulticastInterface = errors.New("no such multicast interface")
|
||||
|
||||
// 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
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func netAddrToIP4(a net.Addr) net.IP {
|
||||
switch v := a.(type) {
|
||||
case *net.UDPAddr:
|
||||
if ip := v.IP.To4(); ip != nil {
|
||||
return ip
|
||||
}
|
||||
case *net.IPAddr:
|
||||
if ip := v.IP.To4(); ip != nil {
|
||||
return ip
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
23
vendor/golang.org/x/net/ipv4/helper_stub.go
generated
vendored
Normal file
23
vendor/golang.org/x/net/ipv4/helper_stub.go
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
// 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
Normal file
50
vendor/golang.org/x/net/ipv4/helper_unix.go
generated
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
// 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
Normal file
49
vendor/golang.org/x/net/ipv4/helper_windows.go
generated
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
// 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
|
||||
}
|
||||
34
vendor/golang.org/x/net/ipv4/iana.go
generated
vendored
Normal file
34
vendor/golang.org/x/net/ipv4/iana.go
generated
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
// go generate gen.go
|
||||
// GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
|
||||
|
||||
package ipv4
|
||||
|
||||
// Internet Control Message Protocol (ICMP) Parameters, Updated: 2013-04-19
|
||||
const (
|
||||
ICMPTypeEchoReply ICMPType = 0 // Echo Reply
|
||||
ICMPTypeDestinationUnreachable ICMPType = 3 // Destination Unreachable
|
||||
ICMPTypeRedirect ICMPType = 5 // Redirect
|
||||
ICMPTypeEcho ICMPType = 8 // Echo
|
||||
ICMPTypeRouterAdvertisement ICMPType = 9 // Router Advertisement
|
||||
ICMPTypeRouterSolicitation ICMPType = 10 // Router Solicitation
|
||||
ICMPTypeTimeExceeded ICMPType = 11 // Time Exceeded
|
||||
ICMPTypeParameterProblem ICMPType = 12 // Parameter Problem
|
||||
ICMPTypeTimestamp ICMPType = 13 // Timestamp
|
||||
ICMPTypeTimestampReply ICMPType = 14 // Timestamp Reply
|
||||
ICMPTypePhoturis ICMPType = 40 // Photuris
|
||||
)
|
||||
|
||||
// Internet Control Message Protocol (ICMP) Parameters, Updated: 2013-04-19
|
||||
var icmpTypes = map[ICMPType]string{
|
||||
0: "echo reply",
|
||||
3: "destination unreachable",
|
||||
5: "redirect",
|
||||
8: "echo",
|
||||
9: "router advertisement",
|
||||
10: "router solicitation",
|
||||
11: "time exceeded",
|
||||
12: "parameter problem",
|
||||
13: "timestamp",
|
||||
14: "timestamp reply",
|
||||
40: "photuris",
|
||||
}
|
||||
57
vendor/golang.org/x/net/ipv4/icmp.go
generated
vendored
Normal file
57
vendor/golang.org/x/net/ipv4/icmp.go
generated
vendored
Normal file
@@ -0,0 +1,57 @@
|
||||
// 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.
|
||||
|
||||
package ipv4
|
||||
|
||||
import "golang.org/x/net/internal/iana"
|
||||
|
||||
// An ICMPType represents a type of ICMP message.
|
||||
type ICMPType int
|
||||
|
||||
func (typ ICMPType) String() string {
|
||||
s, ok := icmpTypes[typ]
|
||||
if !ok {
|
||||
return "<nil>"
|
||||
}
|
||||
return s
|
||||
}
|
||||
|
||||
// Protocol returns the ICMPv4 protocol number.
|
||||
func (typ ICMPType) Protocol() int {
|
||||
return iana.ProtocolICMP
|
||||
}
|
||||
|
||||
// An ICMPFilter represents an ICMP message filter for incoming
|
||||
// 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
|
||||
// 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
|
||||
}
|
||||
|
||||
// Accept accepts incoming ICMP packets including the type field value
|
||||
// typ.
|
||||
func (f *ICMPFilter) Accept(typ ICMPType) {
|
||||
f.accept(typ)
|
||||
}
|
||||
|
||||
// Block blocks incoming ICMP packets including the type field value
|
||||
// typ.
|
||||
func (f *ICMPFilter) Block(typ ICMPType) {
|
||||
f.block(typ)
|
||||
}
|
||||
|
||||
// SetAll sets the filter action to the filter.
|
||||
func (f *ICMPFilter) SetAll(block bool) {
|
||||
f.setAll(block)
|
||||
}
|
||||
|
||||
// WillBlock reports whether the ICMP type will be blocked.
|
||||
func (f *ICMPFilter) WillBlock(typ ICMPType) bool {
|
||||
return f.willBlock(typ)
|
||||
}
|
||||
25
vendor/golang.org/x/net/ipv4/icmp_linux.go
generated
vendored
Normal file
25
vendor/golang.org/x/net/ipv4/icmp_linux.go
generated
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
// 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
|
||||
|
||||
func (f *sysICMPFilter) accept(typ ICMPType) {
|
||||
f.Data &^= 1 << (uint32(typ) & 31)
|
||||
}
|
||||
|
||||
func (f *sysICMPFilter) block(typ ICMPType) {
|
||||
f.Data |= 1 << (uint32(typ) & 31)
|
||||
}
|
||||
|
||||
func (f *sysICMPFilter) setAll(block bool) {
|
||||
if block {
|
||||
f.Data = 1<<32 - 1
|
||||
} else {
|
||||
f.Data = 0
|
||||
}
|
||||
}
|
||||
|
||||
func (f *sysICMPFilter) willBlock(typ ICMPType) bool {
|
||||
return f.Data&(1<<(uint32(typ)&31)) != 0
|
||||
}
|
||||
25
vendor/golang.org/x/net/ipv4/icmp_stub.go
generated
vendored
Normal file
25
vendor/golang.org/x/net/ipv4/icmp_stub.go
generated
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
// 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 !linux
|
||||
|
||||
package ipv4
|
||||
|
||||
const sysSizeofICMPFilter = 0x0
|
||||
|
||||
type sysICMPFilter struct {
|
||||
}
|
||||
|
||||
func (f *sysICMPFilter) accept(typ ICMPType) {
|
||||
}
|
||||
|
||||
func (f *sysICMPFilter) block(typ ICMPType) {
|
||||
}
|
||||
|
||||
func (f *sysICMPFilter) setAll(block bool) {
|
||||
}
|
||||
|
||||
func (f *sysICMPFilter) willBlock(typ ICMPType) bool {
|
||||
return false
|
||||
}
|
||||
97
vendor/golang.org/x/net/ipv4/packet.go
generated
vendored
Normal file
97
vendor/golang.org/x/net/ipv4/packet.go
generated
vendored
Normal file
@@ -0,0 +1,97 @@
|
||||
// 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"
|
||||
"syscall"
|
||||
)
|
||||
|
||||
// A packetHandler represents the IPv4 datagram handler.
|
||||
type packetHandler struct {
|
||||
c *net.IPConn
|
||||
rawOpt
|
||||
}
|
||||
|
||||
func (c *packetHandler) ok() bool { return c != nil && c.c != nil }
|
||||
|
||||
// ReadFrom reads an IPv4 datagram from the endpoint c, copying the
|
||||
// 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
|
||||
}
|
||||
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
|
||||
}
|
||||
|
||||
func slicePacket(b []byte) (h, p []byte, err error) {
|
||||
if len(b) < HeaderLen {
|
||||
return nil, nil, errHeaderTooShort
|
||||
}
|
||||
hdrlen := int(b[0]&0x0f) << 2
|
||||
return b[:hdrlen], b[hdrlen:], nil
|
||||
}
|
||||
|
||||
// WriteTo writes an IPv4 datagram through the endpoint c, copying the
|
||||
// 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
|
||||
// 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
|
||||
// Len = <must be specified>
|
||||
// TOS = <must be specified>
|
||||
// TotalLen = <must be specified>
|
||||
// ID = platform sets an appropriate value if ID is zero
|
||||
// FragOff = <must be specified>
|
||||
// TTL = <must be specified>
|
||||
// Protocol = <must be specified>
|
||||
// Checksum = platform sets an appropriate value if Checksum is zero
|
||||
// Src = platform sets an appropriate value if Src is nil
|
||||
// Dst = <must be specified>
|
||||
// Options = optional
|
||||
func (c *packetHandler) WriteTo(h *Header, p []byte, cm *ControlMessage) error {
|
||||
if !c.ok() {
|
||||
return syscall.EINVAL
|
||||
}
|
||||
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
|
||||
}
|
||||
15
vendor/golang.org/x/net/ipv4/payload.go
generated
vendored
Normal file
15
vendor/golang.org/x/net/ipv4/payload.go
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
// 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"
|
||||
|
||||
// A payloadHandler represents the IPv4 datagram payload handler.
|
||||
type payloadHandler struct {
|
||||
net.PacketConn
|
||||
rawOpt
|
||||
}
|
||||
|
||||
func (c *payloadHandler) ok() bool { return c != nil && c.PacketConn != nil }
|
||||
81
vendor/golang.org/x/net/ipv4/payload_cmsg.go
generated
vendored
Normal file
81
vendor/golang.org/x/net/ipv4/payload_cmsg.go
generated
vendored
Normal file
@@ -0,0 +1,81 @@
|
||||
// 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
|
||||
|
||||
package ipv4
|
||||
|
||||
import (
|
||||
"net"
|
||||
"syscall"
|
||||
)
|
||||
|
||||
// ReadFrom reads a payload of the received IPv4 datagram, from the
|
||||
// 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
|
||||
}
|
||||
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
|
||||
}
|
||||
|
||||
// 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
|
||||
// the datagram path and the outgoing interface to be specified.
|
||||
// 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
|
||||
}
|
||||
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
|
||||
}
|
||||
42
vendor/golang.org/x/net/ipv4/payload_nocmsg.go
generated
vendored
Normal file
42
vendor/golang.org/x/net/ipv4/payload_nocmsg.go
generated
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
// 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
|
||||
|
||||
package ipv4
|
||||
|
||||
import (
|
||||
"net"
|
||||
"syscall"
|
||||
)
|
||||
|
||||
// ReadFrom reads a payload of the received IPv4 datagram, from the
|
||||
// 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
|
||||
}
|
||||
if n, src, err = c.PacketConn.ReadFrom(b); err != nil {
|
||||
return 0, nil, nil, err
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// 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
|
||||
// the datagram path and the outgoing interface to be specified.
|
||||
// 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
|
||||
}
|
||||
if dst == nil {
|
||||
return 0, errMissingAddress
|
||||
}
|
||||
return c.PacketConn.WriteTo(b, dst)
|
||||
}
|
||||
46
vendor/golang.org/x/net/ipv4/sockopt.go
generated
vendored
Normal file
46
vendor/golang.org/x/net/ipv4/sockopt.go
generated
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
// 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
|
||||
|
||||
// Sticky socket options
|
||||
const (
|
||||
ssoTOS = iota // header field for unicast packet
|
||||
ssoTTL // header field for unicast packet
|
||||
ssoMulticastTTL // header field for multicast packet
|
||||
ssoMulticastInterface // outbound interface for multicast packet
|
||||
ssoMulticastLoopback // loopback for multicast packet
|
||||
ssoReceiveTTL // header field on received packet
|
||||
ssoReceiveDst // header field on received packet
|
||||
ssoReceiveInterface // inbound interface on received packet
|
||||
ssoPacketInfo // incbound or outbound packet path
|
||||
ssoHeaderPrepend // ipv4 header prepend
|
||||
ssoStripHeader // strip ipv4 header
|
||||
ssoICMPFilter // icmp filter
|
||||
ssoJoinGroup // any-source multicast
|
||||
ssoLeaveGroup // any-source multicast
|
||||
ssoJoinSourceGroup // source-specific multicast
|
||||
ssoLeaveSourceGroup // source-specific multicast
|
||||
ssoBlockSourceGroup // any-source or source-specific multicast
|
||||
ssoUnblockSourceGroup // any-source or source-specific multicast
|
||||
ssoMax
|
||||
)
|
||||
|
||||
// Sticky socket option value types
|
||||
const (
|
||||
ssoTypeByte = iota + 1
|
||||
ssoTypeInt
|
||||
ssoTypeInterface
|
||||
ssoTypeICMPFilter
|
||||
ssoTypeIPMreq
|
||||
ssoTypeIPMreqn
|
||||
ssoTypeGroupReq
|
||||
ssoTypeGroupSourceReq
|
||||
)
|
||||
|
||||
// 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
|
||||
}
|
||||
83
vendor/golang.org/x/net/ipv4/sockopt_asmreq.go
generated
vendored
Normal file
83
vendor/golang.org/x/net/ipv4/sockopt_asmreq.go
generated
vendored
Normal file
@@ -0,0 +1,83 @@
|
||||
// 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 setIPMreqInterface(mreq *sysIPMreq, ifi *net.Interface) error {
|
||||
if ifi == nil {
|
||||
return nil
|
||||
}
|
||||
ifat, err := ifi.Addrs()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
for _, ifa := range ifat {
|
||||
switch ifa := ifa.(type) {
|
||||
case *net.IPAddr:
|
||||
if ip := ifa.IP.To4(); ip != nil {
|
||||
copy(mreq.Interface[:], ip)
|
||||
return nil
|
||||
}
|
||||
case *net.IPNet:
|
||||
if ip := ifa.IP.To4(); ip != nil {
|
||||
copy(mreq.Interface[:], ip)
|
||||
return nil
|
||||
}
|
||||
}
|
||||
}
|
||||
return errNoSuchInterface
|
||||
}
|
||||
|
||||
func netIP4ToInterface(ip net.IP) (*net.Interface, error) {
|
||||
ift, err := net.Interfaces()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
for _, ifi := range ift {
|
||||
ifat, err := ifi.Addrs()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
for _, ifa := range ifat {
|
||||
switch ifa := ifa.(type) {
|
||||
case *net.IPAddr:
|
||||
if ip.Equal(ifa.IP) {
|
||||
return &ifi, nil
|
||||
}
|
||||
case *net.IPNet:
|
||||
if ip.Equal(ifa.IP) {
|
||||
return &ifi, nil
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil, errNoSuchInterface
|
||||
}
|
||||
|
||||
func netInterfaceToIP4(ifi *net.Interface) (net.IP, error) {
|
||||
if ifi == nil {
|
||||
return net.IPv4zero.To4(), nil
|
||||
}
|
||||
ifat, err := ifi.Addrs()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
for _, ifa := range ifat {
|
||||
switch ifa := ifa.(type) {
|
||||
case *net.IPAddr:
|
||||
if ip := ifa.IP.To4(); ip != nil {
|
||||
return ip, nil
|
||||
}
|
||||
case *net.IPNet:
|
||||
if ip := ifa.IP.To4(); ip != nil {
|
||||
return ip, nil
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil, errNoSuchInterface
|
||||
}
|
||||
21
vendor/golang.org/x/net/ipv4/sockopt_asmreq_stub.go
generated
vendored
Normal file
21
vendor/golang.org/x/net/ipv4/sockopt_asmreq_stub.go
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
// 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
Normal file
46
vendor/golang.org/x/net/ipv4/sockopt_asmreq_unix.go
generated
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
// 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
Normal file
45
vendor/golang.org/x/net/ipv4/sockopt_asmreq_windows.go
generated
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
// 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
Normal file
17
vendor/golang.org/x/net/ipv4/sockopt_asmreqn_stub.go
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
// 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
|
||||
}
|
||||
42
vendor/golang.org/x/net/ipv4/sockopt_asmreqn_unix.go
generated
vendored
Normal file
42
vendor/golang.org/x/net/ipv4/sockopt_asmreqn_unix.go
generated
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
// 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"
|
||||
)
|
||||
|
||||
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)
|
||||
}
|
||||
if mreqn.Ifindex == 0 {
|
||||
return nil, nil
|
||||
}
|
||||
ifi, err := net.InterfaceByIndex(int(mreqn.Ifindex))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return ifi, nil
|
||||
}
|
||||
|
||||
func setsockoptIPMreqn(fd, name int, ifi *net.Interface, grp net.IP) error {
|
||||
var mreqn sysIPMreqn
|
||||
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))
|
||||
}
|
||||
17
vendor/golang.org/x/net/ipv4/sockopt_ssmreq_stub.go
generated
vendored
Normal file
17
vendor/golang.org/x/net/ipv4/sockopt_ssmreq_stub.go
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
// 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
Normal file
61
vendor/golang.org/x/net/ipv4/sockopt_ssmreq_unix.go
generated
vendored
Normal file
@@ -0,0 +1,61 @@
|
||||
// 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))
|
||||
}
|
||||
11
vendor/golang.org/x/net/ipv4/sockopt_stub.go
generated
vendored
Normal file
11
vendor/golang.org/x/net/ipv4/sockopt_stub.go
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
// 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 setInt(fd int, opt *sockOpt, v int) error {
|
||||
return errOpNoSupport
|
||||
}
|
||||
122
vendor/golang.org/x/net/ipv4/sockopt_unix.go
generated
vendored
Normal file
122
vendor/golang.org/x/net/ipv4/sockopt_unix.go
generated
vendored
Normal file
@@ -0,0 +1,122 @@
|
||||
// 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
Normal file
68
vendor/golang.org/x/net/ipv4/sockopt_windows.go
generated
vendored
Normal file
@@ -0,0 +1,68 @@
|
||||
// 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
|
||||
}
|
||||
34
vendor/golang.org/x/net/ipv4/sys_bsd.go
generated
vendored
Normal file
34
vendor/golang.org/x/net/ipv4/sys_bsd.go
generated
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
// 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 dragonfly netbsd
|
||||
|
||||
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, 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},
|
||||
}
|
||||
)
|
||||
96
vendor/golang.org/x/net/ipv4/sys_darwin.go
generated
vendored
Normal file
96
vendor/golang.org/x/net/ipv4/sys_darwin.go
generated
vendored
Normal file
@@ -0,0 +1,96 @@
|
||||
// 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"
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
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, 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},
|
||||
}
|
||||
)
|
||||
|
||||
func init() {
|
||||
// Seems like kern.osreldate is veiled on latest OS X. We use
|
||||
// kern.osrelease instead.
|
||||
osver, err := syscall.Sysctl("kern.osrelease")
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
var i int
|
||||
for i = range osver {
|
||||
if osver[i] == '.' {
|
||||
break
|
||||
}
|
||||
}
|
||||
// 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.
|
||||
// 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
|
||||
}
|
||||
}
|
||||
|
||||
func (pi *sysInetPktinfo) 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
|
||||
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
|
||||
sa.Family = syscall.AF_INET
|
||||
copy(sa.Addr[:], grp)
|
||||
sa = (*sysSockaddrInet)(unsafe.Pointer(&gsr.Pad_cgo_1[0]))
|
||||
sa.Len = sysSizeofSockaddrInet
|
||||
sa.Family = syscall.AF_INET
|
||||
copy(sa.Addr[:], src)
|
||||
}
|
||||
73
vendor/golang.org/x/net/ipv4/sys_freebsd.go
generated
vendored
Normal file
73
vendor/golang.org/x/net/ipv4/sys_freebsd.go
generated
vendored
Normal file
@@ -0,0 +1,73 @@
|
||||
// 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"
|
||||
"runtime"
|
||||
"strings"
|
||||
"syscall"
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
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, 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},
|
||||
}
|
||||
)
|
||||
|
||||
func init() {
|
||||
freebsdVersion, _ = syscall.SysctlUint32("kern.osreldate")
|
||||
if freebsdVersion >= 1000000 {
|
||||
sockOpts[ssoMulticastInterface].typ = ssoTypeIPMreqn
|
||||
}
|
||||
if runtime.GOOS == "freebsd" && runtime.GOARCH == "386" {
|
||||
archs, _ := syscall.Sysctl("kern.supported_archs")
|
||||
for _, s := range strings.Fields(archs) {
|
||||
if s == "amd64" {
|
||||
freebsd32o64 = true
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (gr *sysGroupReq) setGroup(grp net.IP) {
|
||||
sa := (*sysSockaddrInet)(unsafe.Pointer(&gr.Group))
|
||||
sa.Len = sysSizeofSockaddrInet
|
||||
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
|
||||
sa.Family = syscall.AF_INET
|
||||
copy(sa.Addr[:], grp)
|
||||
sa = (*sysSockaddrInet)(unsafe.Pointer(&gsr.Source))
|
||||
sa.Len = sysSizeofSockaddrInet
|
||||
sa.Family = syscall.AF_INET
|
||||
copy(sa.Addr[:], src)
|
||||
}
|
||||
55
vendor/golang.org/x/net/ipv4/sys_linux.go
generated
vendored
Normal file
55
vendor/golang.org/x/net/ipv4/sys_linux.go
generated
vendored
Normal file
@@ -0,0 +1,55 @@
|
||||
// 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"
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
var (
|
||||
ctlOpts = [ctlMax]ctlOpt{
|
||||
ctlTTL: {sysIP_TTL, 1, marshalTTL, parseTTL},
|
||||
ctlPacketInfo: {sysIP_PKTINFO, sysSizeofInetPktinfo, 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},
|
||||
}
|
||||
)
|
||||
|
||||
func (pi *sysInetPktinfo) setIfindex(i int) {
|
||||
pi.Ifindex = int32(i)
|
||||
}
|
||||
|
||||
func (gr *sysGroupReq) setGroup(grp net.IP) {
|
||||
sa := (*sysSockaddrInet)(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))
|
||||
sa.Family = syscall.AF_INET
|
||||
copy(sa.Addr[:], grp)
|
||||
sa = (*sysSockaddrInet)(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
Normal file
32
vendor/golang.org/x/net/ipv4/sys_openbsd.go
generated
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
// 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},
|
||||
}
|
||||
)
|
||||
13
vendor/golang.org/x/net/ipv4/sys_stub.go
generated
vendored
Normal file
13
vendor/golang.org/x/net/ipv4/sys_stub.go
generated
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
// 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 nacl plan9 solaris
|
||||
|
||||
package ipv4
|
||||
|
||||
var (
|
||||
ctlOpts = [ctlMax]ctlOpt{}
|
||||
|
||||
sockOpts = [ssoMax]sockOpt{}
|
||||
)
|
||||
61
vendor/golang.org/x/net/ipv4/sys_windows.go
generated
vendored
Normal file
61
vendor/golang.org/x/net/ipv4/sys_windows.go
generated
vendored
Normal file
@@ -0,0 +1,61 @@
|
||||
// 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
|
||||
|
||||
const (
|
||||
// See ws2tcpip.h.
|
||||
sysIP_OPTIONS = 0x1
|
||||
sysIP_HDRINCL = 0x2
|
||||
sysIP_TOS = 0x3
|
||||
sysIP_TTL = 0x4
|
||||
sysIP_MULTICAST_IF = 0x9
|
||||
sysIP_MULTICAST_TTL = 0xa
|
||||
sysIP_MULTICAST_LOOP = 0xb
|
||||
sysIP_ADD_MEMBERSHIP = 0xc
|
||||
sysIP_DROP_MEMBERSHIP = 0xd
|
||||
sysIP_DONTFRAGMENT = 0xe
|
||||
sysIP_ADD_SOURCE_MEMBERSHIP = 0xf
|
||||
sysIP_DROP_SOURCE_MEMBERSHIP = 0x10
|
||||
sysIP_PKTINFO = 0x13
|
||||
|
||||
sysSizeofInetPktinfo = 0x8
|
||||
sysSizeofIPMreq = 0x8
|
||||
sysSizeofIPMreqSource = 0xc
|
||||
)
|
||||
|
||||
type sysInetPktinfo struct {
|
||||
Addr [4]byte
|
||||
Ifindex int32
|
||||
}
|
||||
|
||||
type sysIPMreq struct {
|
||||
Multiaddr [4]byte
|
||||
Interface [4]byte
|
||||
}
|
||||
|
||||
type sysIPMreqSource struct {
|
||||
Multiaddr [4]byte
|
||||
Sourceaddr [4]byte
|
||||
Interface [4]byte
|
||||
}
|
||||
|
||||
// See http://msdn.microsoft.com/en-us/library/windows/desktop/ms738586(v=vs.85).aspx
|
||||
var (
|
||||
ctlOpts = [ctlMax]ctlOpt{}
|
||||
|
||||
sockOpts = [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},
|
||||
}
|
||||
)
|
||||
|
||||
func (pi *sysInetPktinfo) setIfindex(i int) {
|
||||
pi.Ifindex = int32(i)
|
||||
}
|
||||
31
vendor/golang.org/x/net/ipv4/syscall_linux_386.go
generated
vendored
Normal file
31
vendor/golang.org/x/net/ipv4/syscall_linux_386.go
generated
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
// 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
Normal file
26
vendor/golang.org/x/net/ipv4/syscall_unix.go
generated
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
// 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
Normal file
8
vendor/golang.org/x/net/ipv4/thunk_linux_386.s
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
// 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)
|
||||
99
vendor/golang.org/x/net/ipv4/zsys_darwin.go
generated
vendored
Normal file
99
vendor/golang.org/x/net/ipv4/zsys_darwin.go
generated
vendored
Normal file
@@ -0,0 +1,99 @@
|
||||
// Created by cgo -godefs - DO NOT EDIT
|
||||
// cgo -godefs defs_darwin.go
|
||||
|
||||
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 = 0x14
|
||||
sysIP_STRIPHDR = 0x17
|
||||
sysIP_RECVTTL = 0x18
|
||||
sysIP_BOUND_IF = 0x19
|
||||
sysIP_PKTINFO = 0x1a
|
||||
sysIP_RECVPKTINFO = 0x1a
|
||||
|
||||
sysIP_MULTICAST_IF = 0x9
|
||||
sysIP_MULTICAST_TTL = 0xa
|
||||
sysIP_MULTICAST_LOOP = 0xb
|
||||
sysIP_ADD_MEMBERSHIP = 0xc
|
||||
sysIP_DROP_MEMBERSHIP = 0xd
|
||||
sysIP_MULTICAST_VIF = 0xe
|
||||
sysIP_MULTICAST_IFINDEX = 0x42
|
||||
sysIP_ADD_SOURCE_MEMBERSHIP = 0x46
|
||||
sysIP_DROP_SOURCE_MEMBERSHIP = 0x47
|
||||
sysIP_BLOCK_SOURCE = 0x48
|
||||
sysIP_UNBLOCK_SOURCE = 0x49
|
||||
sysMCAST_JOIN_GROUP = 0x50
|
||||
sysMCAST_LEAVE_GROUP = 0x51
|
||||
sysMCAST_JOIN_SOURCE_GROUP = 0x52
|
||||
sysMCAST_LEAVE_SOURCE_GROUP = 0x53
|
||||
sysMCAST_BLOCK_SOURCE = 0x54
|
||||
sysMCAST_UNBLOCK_SOURCE = 0x55
|
||||
|
||||
sysSizeofSockaddrStorage = 0x80
|
||||
sysSizeofSockaddrInet = 0x10
|
||||
sysSizeofInetPktinfo = 0xc
|
||||
|
||||
sysSizeofIPMreq = 0x8
|
||||
sysSizeofIPMreqn = 0xc
|
||||
sysSizeofIPMreqSource = 0xc
|
||||
sysSizeofGroupReq = 0x84
|
||||
sysSizeofGroupSourceReq = 0x104
|
||||
)
|
||||
|
||||
type sysSockaddrStorage struct {
|
||||
Len uint8
|
||||
Family uint8
|
||||
X__ss_pad1 [6]int8
|
||||
X__ss_align int64
|
||||
X__ss_pad2 [112]int8
|
||||
}
|
||||
|
||||
type sysSockaddrInet struct {
|
||||
Len uint8
|
||||
Family uint8
|
||||
Port uint16
|
||||
Addr [4]byte /* in_addr */
|
||||
Zero [8]int8
|
||||
}
|
||||
|
||||
type sysInetPktinfo struct {
|
||||
Ifindex uint32
|
||||
Spec_dst [4]byte /* in_addr */
|
||||
Addr [4]byte /* in_addr */
|
||||
}
|
||||
|
||||
type sysIPMreq struct {
|
||||
Multiaddr [4]byte /* in_addr */
|
||||
Interface [4]byte /* in_addr */
|
||||
}
|
||||
|
||||
type sysIPMreqn struct {
|
||||
Multiaddr [4]byte /* in_addr */
|
||||
Address [4]byte /* in_addr */
|
||||
Ifindex int32
|
||||
}
|
||||
|
||||
type sysIPMreqSource struct {
|
||||
Multiaddr [4]byte /* in_addr */
|
||||
Sourceaddr [4]byte /* in_addr */
|
||||
Interface [4]byte /* in_addr */
|
||||
}
|
||||
|
||||
type sysGroupReq struct {
|
||||
Interface uint32
|
||||
Pad_cgo_0 [128]byte
|
||||
}
|
||||
|
||||
type sysGroupSourceReq struct {
|
||||
Interface uint32
|
||||
Pad_cgo_0 [128]byte
|
||||
Pad_cgo_1 [128]byte
|
||||
}
|
||||
33
vendor/golang.org/x/net/ipv4/zsys_dragonfly.go
generated
vendored
Normal file
33
vendor/golang.org/x/net/ipv4/zsys_dragonfly.go
generated
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
// Created by cgo -godefs - DO NOT EDIT
|
||||
// cgo -godefs defs_dragonfly.go
|
||||
|
||||
// +build dragonfly
|
||||
|
||||
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 = 0x14
|
||||
sysIP_RECVTTL = 0x41
|
||||
|
||||
sysIP_MULTICAST_IF = 0x9
|
||||
sysIP_MULTICAST_TTL = 0xa
|
||||
sysIP_MULTICAST_LOOP = 0xb
|
||||
sysIP_MULTICAST_VIF = 0xe
|
||||
sysIP_ADD_MEMBERSHIP = 0xc
|
||||
sysIP_DROP_MEMBERSHIP = 0xd
|
||||
|
||||
sysSizeofIPMreq = 0x8
|
||||
)
|
||||
|
||||
type sysIPMreq struct {
|
||||
Multiaddr [4]byte /* in_addr */
|
||||
Interface [4]byte /* in_addr */
|
||||
}
|
||||
93
vendor/golang.org/x/net/ipv4/zsys_freebsd_386.go
generated
vendored
Normal file
93
vendor/golang.org/x/net/ipv4/zsys_freebsd_386.go
generated
vendored
Normal file
@@ -0,0 +1,93 @@
|
||||
// Created by cgo -godefs - DO NOT EDIT
|
||||
// cgo -godefs defs_freebsd.go
|
||||
|
||||
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_SENDSRCADDR = 0x7
|
||||
sysIP_RETOPTS = 0x8
|
||||
sysIP_RECVIF = 0x14
|
||||
sysIP_ONESBCAST = 0x17
|
||||
sysIP_BINDANY = 0x18
|
||||
sysIP_RECVTTL = 0x41
|
||||
sysIP_MINTTL = 0x42
|
||||
sysIP_DONTFRAG = 0x43
|
||||
sysIP_RECVTOS = 0x44
|
||||
|
||||
sysIP_MULTICAST_IF = 0x9
|
||||
sysIP_MULTICAST_TTL = 0xa
|
||||
sysIP_MULTICAST_LOOP = 0xb
|
||||
sysIP_ADD_MEMBERSHIP = 0xc
|
||||
sysIP_DROP_MEMBERSHIP = 0xd
|
||||
sysIP_MULTICAST_VIF = 0xe
|
||||
sysIP_ADD_SOURCE_MEMBERSHIP = 0x46
|
||||
sysIP_DROP_SOURCE_MEMBERSHIP = 0x47
|
||||
sysIP_BLOCK_SOURCE = 0x48
|
||||
sysIP_UNBLOCK_SOURCE = 0x49
|
||||
sysMCAST_JOIN_GROUP = 0x50
|
||||
sysMCAST_LEAVE_GROUP = 0x51
|
||||
sysMCAST_JOIN_SOURCE_GROUP = 0x52
|
||||
sysMCAST_LEAVE_SOURCE_GROUP = 0x53
|
||||
sysMCAST_BLOCK_SOURCE = 0x54
|
||||
sysMCAST_UNBLOCK_SOURCE = 0x55
|
||||
|
||||
sysSizeofSockaddrStorage = 0x80
|
||||
sysSizeofSockaddrInet = 0x10
|
||||
|
||||
sysSizeofIPMreq = 0x8
|
||||
sysSizeofIPMreqn = 0xc
|
||||
sysSizeofIPMreqSource = 0xc
|
||||
sysSizeofGroupReq = 0x84
|
||||
sysSizeofGroupSourceReq = 0x104
|
||||
)
|
||||
|
||||
type sysSockaddrStorage struct {
|
||||
Len uint8
|
||||
Family uint8
|
||||
X__ss_pad1 [6]int8
|
||||
X__ss_align int64
|
||||
X__ss_pad2 [112]int8
|
||||
}
|
||||
|
||||
type sysSockaddrInet struct {
|
||||
Len uint8
|
||||
Family uint8
|
||||
Port uint16
|
||||
Addr [4]byte /* in_addr */
|
||||
Zero [8]int8
|
||||
}
|
||||
|
||||
type sysIPMreq struct {
|
||||
Multiaddr [4]byte /* in_addr */
|
||||
Interface [4]byte /* in_addr */
|
||||
}
|
||||
|
||||
type sysIPMreqn struct {
|
||||
Multiaddr [4]byte /* in_addr */
|
||||
Address [4]byte /* in_addr */
|
||||
Ifindex int32
|
||||
}
|
||||
|
||||
type sysIPMreqSource struct {
|
||||
Multiaddr [4]byte /* in_addr */
|
||||
Sourceaddr [4]byte /* in_addr */
|
||||
Interface [4]byte /* in_addr */
|
||||
}
|
||||
|
||||
type sysGroupReq struct {
|
||||
Interface uint32
|
||||
Group sysSockaddrStorage
|
||||
}
|
||||
|
||||
type sysGroupSourceReq struct {
|
||||
Interface uint32
|
||||
Group sysSockaddrStorage
|
||||
Source sysSockaddrStorage
|
||||
}
|
||||
95
vendor/golang.org/x/net/ipv4/zsys_freebsd_amd64.go
generated
vendored
Normal file
95
vendor/golang.org/x/net/ipv4/zsys_freebsd_amd64.go
generated
vendored
Normal file
@@ -0,0 +1,95 @@
|
||||
// Created by cgo -godefs - DO NOT EDIT
|
||||
// cgo -godefs defs_freebsd.go
|
||||
|
||||
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_SENDSRCADDR = 0x7
|
||||
sysIP_RETOPTS = 0x8
|
||||
sysIP_RECVIF = 0x14
|
||||
sysIP_ONESBCAST = 0x17
|
||||
sysIP_BINDANY = 0x18
|
||||
sysIP_RECVTTL = 0x41
|
||||
sysIP_MINTTL = 0x42
|
||||
sysIP_DONTFRAG = 0x43
|
||||
sysIP_RECVTOS = 0x44
|
||||
|
||||
sysIP_MULTICAST_IF = 0x9
|
||||
sysIP_MULTICAST_TTL = 0xa
|
||||
sysIP_MULTICAST_LOOP = 0xb
|
||||
sysIP_ADD_MEMBERSHIP = 0xc
|
||||
sysIP_DROP_MEMBERSHIP = 0xd
|
||||
sysIP_MULTICAST_VIF = 0xe
|
||||
sysIP_ADD_SOURCE_MEMBERSHIP = 0x46
|
||||
sysIP_DROP_SOURCE_MEMBERSHIP = 0x47
|
||||
sysIP_BLOCK_SOURCE = 0x48
|
||||
sysIP_UNBLOCK_SOURCE = 0x49
|
||||
sysMCAST_JOIN_GROUP = 0x50
|
||||
sysMCAST_LEAVE_GROUP = 0x51
|
||||
sysMCAST_JOIN_SOURCE_GROUP = 0x52
|
||||
sysMCAST_LEAVE_SOURCE_GROUP = 0x53
|
||||
sysMCAST_BLOCK_SOURCE = 0x54
|
||||
sysMCAST_UNBLOCK_SOURCE = 0x55
|
||||
|
||||
sysSizeofSockaddrStorage = 0x80
|
||||
sysSizeofSockaddrInet = 0x10
|
||||
|
||||
sysSizeofIPMreq = 0x8
|
||||
sysSizeofIPMreqn = 0xc
|
||||
sysSizeofIPMreqSource = 0xc
|
||||
sysSizeofGroupReq = 0x88
|
||||
sysSizeofGroupSourceReq = 0x108
|
||||
)
|
||||
|
||||
type sysSockaddrStorage struct {
|
||||
Len uint8
|
||||
Family uint8
|
||||
X__ss_pad1 [6]int8
|
||||
X__ss_align int64
|
||||
X__ss_pad2 [112]int8
|
||||
}
|
||||
|
||||
type sysSockaddrInet struct {
|
||||
Len uint8
|
||||
Family uint8
|
||||
Port uint16
|
||||
Addr [4]byte /* in_addr */
|
||||
Zero [8]int8
|
||||
}
|
||||
|
||||
type sysIPMreq struct {
|
||||
Multiaddr [4]byte /* in_addr */
|
||||
Interface [4]byte /* in_addr */
|
||||
}
|
||||
|
||||
type sysIPMreqn struct {
|
||||
Multiaddr [4]byte /* in_addr */
|
||||
Address [4]byte /* in_addr */
|
||||
Ifindex int32
|
||||
}
|
||||
|
||||
type sysIPMreqSource struct {
|
||||
Multiaddr [4]byte /* in_addr */
|
||||
Sourceaddr [4]byte /* in_addr */
|
||||
Interface [4]byte /* in_addr */
|
||||
}
|
||||
|
||||
type sysGroupReq struct {
|
||||
Interface uint32
|
||||
Pad_cgo_0 [4]byte
|
||||
Group sysSockaddrStorage
|
||||
}
|
||||
|
||||
type sysGroupSourceReq struct {
|
||||
Interface uint32
|
||||
Pad_cgo_0 [4]byte
|
||||
Group sysSockaddrStorage
|
||||
Source sysSockaddrStorage
|
||||
}
|
||||
95
vendor/golang.org/x/net/ipv4/zsys_freebsd_arm.go
generated
vendored
Normal file
95
vendor/golang.org/x/net/ipv4/zsys_freebsd_arm.go
generated
vendored
Normal file
@@ -0,0 +1,95 @@
|
||||
// Created by cgo -godefs - DO NOT EDIT
|
||||
// cgo -godefs defs_freebsd.go
|
||||
|
||||
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_SENDSRCADDR = 0x7
|
||||
sysIP_RETOPTS = 0x8
|
||||
sysIP_RECVIF = 0x14
|
||||
sysIP_ONESBCAST = 0x17
|
||||
sysIP_BINDANY = 0x18
|
||||
sysIP_RECVTTL = 0x41
|
||||
sysIP_MINTTL = 0x42
|
||||
sysIP_DONTFRAG = 0x43
|
||||
sysIP_RECVTOS = 0x44
|
||||
|
||||
sysIP_MULTICAST_IF = 0x9
|
||||
sysIP_MULTICAST_TTL = 0xa
|
||||
sysIP_MULTICAST_LOOP = 0xb
|
||||
sysIP_ADD_MEMBERSHIP = 0xc
|
||||
sysIP_DROP_MEMBERSHIP = 0xd
|
||||
sysIP_MULTICAST_VIF = 0xe
|
||||
sysIP_ADD_SOURCE_MEMBERSHIP = 0x46
|
||||
sysIP_DROP_SOURCE_MEMBERSHIP = 0x47
|
||||
sysIP_BLOCK_SOURCE = 0x48
|
||||
sysIP_UNBLOCK_SOURCE = 0x49
|
||||
sysMCAST_JOIN_GROUP = 0x50
|
||||
sysMCAST_LEAVE_GROUP = 0x51
|
||||
sysMCAST_JOIN_SOURCE_GROUP = 0x52
|
||||
sysMCAST_LEAVE_SOURCE_GROUP = 0x53
|
||||
sysMCAST_BLOCK_SOURCE = 0x54
|
||||
sysMCAST_UNBLOCK_SOURCE = 0x55
|
||||
|
||||
sysSizeofSockaddrStorage = 0x80
|
||||
sysSizeofSockaddrInet = 0x10
|
||||
|
||||
sysSizeofIPMreq = 0x8
|
||||
sysSizeofIPMreqn = 0xc
|
||||
sysSizeofIPMreqSource = 0xc
|
||||
sysSizeofGroupReq = 0x88
|
||||
sysSizeofGroupSourceReq = 0x108
|
||||
)
|
||||
|
||||
type sysSockaddrStorage struct {
|
||||
Len uint8
|
||||
Family uint8
|
||||
X__ss_pad1 [6]int8
|
||||
X__ss_align int64
|
||||
X__ss_pad2 [112]int8
|
||||
}
|
||||
|
||||
type sysSockaddrInet struct {
|
||||
Len uint8
|
||||
Family uint8
|
||||
Port uint16
|
||||
Addr [4]byte /* in_addr */
|
||||
Zero [8]int8
|
||||
}
|
||||
|
||||
type sysIPMreq struct {
|
||||
Multiaddr [4]byte /* in_addr */
|
||||
Interface [4]byte /* in_addr */
|
||||
}
|
||||
|
||||
type sysIPMreqn struct {
|
||||
Multiaddr [4]byte /* in_addr */
|
||||
Address [4]byte /* in_addr */
|
||||
Ifindex int32
|
||||
}
|
||||
|
||||
type sysIPMreqSource struct {
|
||||
Multiaddr [4]byte /* in_addr */
|
||||
Sourceaddr [4]byte /* in_addr */
|
||||
Interface [4]byte /* in_addr */
|
||||
}
|
||||
|
||||
type sysGroupReq struct {
|
||||
Interface uint32
|
||||
Pad_cgo_0 [4]byte
|
||||
Group sysSockaddrStorage
|
||||
}
|
||||
|
||||
type sysGroupSourceReq struct {
|
||||
Interface uint32
|
||||
Pad_cgo_0 [4]byte
|
||||
Group sysSockaddrStorage
|
||||
Source sysSockaddrStorage
|
||||
}
|
||||
146
vendor/golang.org/x/net/ipv4/zsys_linux_386.go
generated
vendored
Normal file
146
vendor/golang.org/x/net/ipv4/zsys_linux_386.go
generated
vendored
Normal file
@@ -0,0 +1,146 @@
|
||||
// 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
|
||||
|
||||
sysSizeofKernelSockaddrStorage = 0x80
|
||||
sysSizeofSockaddrInet = 0x10
|
||||
sysSizeofInetPktinfo = 0xc
|
||||
sysSizeofSockExtendedErr = 0x10
|
||||
|
||||
sysSizeofIPMreq = 0x8
|
||||
sysSizeofIPMreqn = 0xc
|
||||
sysSizeofIPMreqSource = 0xc
|
||||
sysSizeofGroupReq = 0x84
|
||||
sysSizeofGroupSourceReq = 0x104
|
||||
|
||||
sysSizeofICMPFilter = 0x4
|
||||
)
|
||||
|
||||
type sysKernelSockaddrStorage struct {
|
||||
Family uint16
|
||||
X__data [126]int8
|
||||
}
|
||||
|
||||
type sysSockaddrInet struct {
|
||||
Family uint16
|
||||
Port uint16
|
||||
Addr [4]byte /* in_addr */
|
||||
X__pad [8]uint8
|
||||
}
|
||||
|
||||
type sysInetPktinfo struct {
|
||||
Ifindex int32
|
||||
Spec_dst [4]byte /* in_addr */
|
||||
Addr [4]byte /* in_addr */
|
||||
}
|
||||
|
||||
type sysSockExtendedErr struct {
|
||||
Errno uint32
|
||||
Origin uint8
|
||||
Type uint8
|
||||
Code uint8
|
||||
Pad uint8
|
||||
Info uint32
|
||||
Data uint32
|
||||
}
|
||||
|
||||
type sysIPMreq struct {
|
||||
Multiaddr [4]byte /* in_addr */
|
||||
Interface [4]byte /* in_addr */
|
||||
}
|
||||
|
||||
type sysIPMreqn struct {
|
||||
Multiaddr [4]byte /* in_addr */
|
||||
Address [4]byte /* in_addr */
|
||||
Ifindex int32
|
||||
}
|
||||
|
||||
type sysIPMreqSource struct {
|
||||
Multiaddr uint32
|
||||
Interface uint32
|
||||
Sourceaddr uint32
|
||||
}
|
||||
|
||||
type sysGroupReq struct {
|
||||
Interface uint32
|
||||
Group sysKernelSockaddrStorage
|
||||
}
|
||||
|
||||
type sysGroupSourceReq struct {
|
||||
Interface uint32
|
||||
Group sysKernelSockaddrStorage
|
||||
Source sysKernelSockaddrStorage
|
||||
}
|
||||
|
||||
type sysICMPFilter struct {
|
||||
Data uint32
|
||||
}
|
||||
|
||||
type sysSockFProg struct {
|
||||
Len uint16
|
||||
Pad_cgo_0 [2]byte
|
||||
Filter *sysSockFilter
|
||||
}
|
||||
|
||||
type sysSockFilter struct {
|
||||
Code uint16
|
||||
Jt uint8
|
||||
Jf uint8
|
||||
K uint32
|
||||
}
|
||||
148
vendor/golang.org/x/net/ipv4/zsys_linux_amd64.go
generated
vendored
Normal file
148
vendor/golang.org/x/net/ipv4/zsys_linux_amd64.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
|
||||
|
||||
sysSizeofKernelSockaddrStorage = 0x80
|
||||
sysSizeofSockaddrInet = 0x10
|
||||
sysSizeofInetPktinfo = 0xc
|
||||
sysSizeofSockExtendedErr = 0x10
|
||||
|
||||
sysSizeofIPMreq = 0x8
|
||||
sysSizeofIPMreqn = 0xc
|
||||
sysSizeofIPMreqSource = 0xc
|
||||
sysSizeofGroupReq = 0x88
|
||||
sysSizeofGroupSourceReq = 0x108
|
||||
|
||||
sysSizeofICMPFilter = 0x4
|
||||
)
|
||||
|
||||
type sysKernelSockaddrStorage struct {
|
||||
Family uint16
|
||||
X__data [126]int8
|
||||
}
|
||||
|
||||
type sysSockaddrInet struct {
|
||||
Family uint16
|
||||
Port uint16
|
||||
Addr [4]byte /* in_addr */
|
||||
X__pad [8]uint8
|
||||
}
|
||||
|
||||
type sysInetPktinfo struct {
|
||||
Ifindex int32
|
||||
Spec_dst [4]byte /* in_addr */
|
||||
Addr [4]byte /* in_addr */
|
||||
}
|
||||
|
||||
type sysSockExtendedErr struct {
|
||||
Errno uint32
|
||||
Origin uint8
|
||||
Type uint8
|
||||
Code uint8
|
||||
Pad uint8
|
||||
Info uint32
|
||||
Data uint32
|
||||
}
|
||||
|
||||
type sysIPMreq struct {
|
||||
Multiaddr [4]byte /* in_addr */
|
||||
Interface [4]byte /* in_addr */
|
||||
}
|
||||
|
||||
type sysIPMreqn struct {
|
||||
Multiaddr [4]byte /* in_addr */
|
||||
Address [4]byte /* in_addr */
|
||||
Ifindex int32
|
||||
}
|
||||
|
||||
type sysIPMreqSource struct {
|
||||
Multiaddr uint32
|
||||
Interface uint32
|
||||
Sourceaddr uint32
|
||||
}
|
||||
|
||||
type sysGroupReq struct {
|
||||
Interface uint32
|
||||
Pad_cgo_0 [4]byte
|
||||
Group sysKernelSockaddrStorage
|
||||
}
|
||||
|
||||
type sysGroupSourceReq struct {
|
||||
Interface uint32
|
||||
Pad_cgo_0 [4]byte
|
||||
Group sysKernelSockaddrStorage
|
||||
Source sysKernelSockaddrStorage
|
||||
}
|
||||
|
||||
type sysICMPFilter struct {
|
||||
Data uint32
|
||||
}
|
||||
|
||||
type sysSockFProg struct {
|
||||
Len uint16
|
||||
Pad_cgo_0 [6]byte
|
||||
Filter *sysSockFilter
|
||||
}
|
||||
|
||||
type sysSockFilter struct {
|
||||
Code uint16
|
||||
Jt uint8
|
||||
Jf uint8
|
||||
K uint32
|
||||
}
|
||||
146
vendor/golang.org/x/net/ipv4/zsys_linux_arm.go
generated
vendored
Normal file
146
vendor/golang.org/x/net/ipv4/zsys_linux_arm.go
generated
vendored
Normal file
@@ -0,0 +1,146 @@
|
||||
// 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
|
||||
|
||||
sysSizeofKernelSockaddrStorage = 0x80
|
||||
sysSizeofSockaddrInet = 0x10
|
||||
sysSizeofInetPktinfo = 0xc
|
||||
sysSizeofSockExtendedErr = 0x10
|
||||
|
||||
sysSizeofIPMreq = 0x8
|
||||
sysSizeofIPMreqn = 0xc
|
||||
sysSizeofIPMreqSource = 0xc
|
||||
sysSizeofGroupReq = 0x84
|
||||
sysSizeofGroupSourceReq = 0x104
|
||||
|
||||
sysSizeofICMPFilter = 0x4
|
||||
)
|
||||
|
||||
type sysKernelSockaddrStorage struct {
|
||||
Family uint16
|
||||
X__data [126]int8
|
||||
}
|
||||
|
||||
type sysSockaddrInet struct {
|
||||
Family uint16
|
||||
Port uint16
|
||||
Addr [4]byte /* in_addr */
|
||||
X__pad [8]uint8
|
||||
}
|
||||
|
||||
type sysInetPktinfo struct {
|
||||
Ifindex int32
|
||||
Spec_dst [4]byte /* in_addr */
|
||||
Addr [4]byte /* in_addr */
|
||||
}
|
||||
|
||||
type sysSockExtendedErr struct {
|
||||
Errno uint32
|
||||
Origin uint8
|
||||
Type uint8
|
||||
Code uint8
|
||||
Pad uint8
|
||||
Info uint32
|
||||
Data uint32
|
||||
}
|
||||
|
||||
type sysIPMreq struct {
|
||||
Multiaddr [4]byte /* in_addr */
|
||||
Interface [4]byte /* in_addr */
|
||||
}
|
||||
|
||||
type sysIPMreqn struct {
|
||||
Multiaddr [4]byte /* in_addr */
|
||||
Address [4]byte /* in_addr */
|
||||
Ifindex int32
|
||||
}
|
||||
|
||||
type sysIPMreqSource struct {
|
||||
Multiaddr uint32
|
||||
Interface uint32
|
||||
Sourceaddr uint32
|
||||
}
|
||||
|
||||
type sysGroupReq struct {
|
||||
Interface uint32
|
||||
Group sysKernelSockaddrStorage
|
||||
}
|
||||
|
||||
type sysGroupSourceReq struct {
|
||||
Interface uint32
|
||||
Group sysKernelSockaddrStorage
|
||||
Source sysKernelSockaddrStorage
|
||||
}
|
||||
|
||||
type sysICMPFilter struct {
|
||||
Data uint32
|
||||
}
|
||||
|
||||
type sysSockFProg struct {
|
||||
Len uint16
|
||||
Pad_cgo_0 [2]byte
|
||||
Filter *sysSockFilter
|
||||
}
|
||||
|
||||
type sysSockFilter struct {
|
||||
Code uint16
|
||||
Jt uint8
|
||||
Jf uint8
|
||||
K uint32
|
||||
}
|
||||
150
vendor/golang.org/x/net/ipv4/zsys_linux_arm64.go
generated
vendored
Normal file
150
vendor/golang.org/x/net/ipv4/zsys_linux_arm64.go
generated
vendored
Normal file
@@ -0,0 +1,150 @@
|
||||
// Created by cgo -godefs - DO NOT EDIT
|
||||
// cgo -godefs defs_linux.go
|
||||
|
||||
// +build linux,arm64
|
||||
|
||||
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
|
||||
|
||||
sysSizeofKernelSockaddrStorage = 0x80
|
||||
sysSizeofSockaddrInet = 0x10
|
||||
sysSizeofInetPktinfo = 0xc
|
||||
sysSizeofSockExtendedErr = 0x10
|
||||
|
||||
sysSizeofIPMreq = 0x8
|
||||
sysSizeofIPMreqn = 0xc
|
||||
sysSizeofIPMreqSource = 0xc
|
||||
sysSizeofGroupReq = 0x88
|
||||
sysSizeofGroupSourceReq = 0x108
|
||||
|
||||
sysSizeofICMPFilter = 0x4
|
||||
)
|
||||
|
||||
type sysKernelSockaddrStorage struct {
|
||||
Family uint16
|
||||
X__data [126]int8
|
||||
}
|
||||
|
||||
type sysSockaddrInet struct {
|
||||
Family uint16
|
||||
Port uint16
|
||||
Addr [4]byte /* in_addr */
|
||||
X__pad [8]uint8
|
||||
}
|
||||
|
||||
type sysInetPktinfo struct {
|
||||
Ifindex int32
|
||||
Spec_dst [4]byte /* in_addr */
|
||||
Addr [4]byte /* in_addr */
|
||||
}
|
||||
|
||||
type sysSockExtendedErr struct {
|
||||
Errno uint32
|
||||
Origin uint8
|
||||
Type uint8
|
||||
Code uint8
|
||||
Pad uint8
|
||||
Info uint32
|
||||
Data uint32
|
||||
}
|
||||
|
||||
type sysIPMreq struct {
|
||||
Multiaddr [4]byte /* in_addr */
|
||||
Interface [4]byte /* in_addr */
|
||||
}
|
||||
|
||||
type sysIPMreqn struct {
|
||||
Multiaddr [4]byte /* in_addr */
|
||||
Address [4]byte /* in_addr */
|
||||
Ifindex int32
|
||||
}
|
||||
|
||||
type sysIPMreqSource struct {
|
||||
Multiaddr uint32
|
||||
Interface uint32
|
||||
Sourceaddr uint32
|
||||
}
|
||||
|
||||
type sysGroupReq struct {
|
||||
Interface uint32
|
||||
Pad_cgo_0 [4]byte
|
||||
Group sysKernelSockaddrStorage
|
||||
}
|
||||
|
||||
type sysGroupSourceReq struct {
|
||||
Interface uint32
|
||||
Pad_cgo_0 [4]byte
|
||||
Group sysKernelSockaddrStorage
|
||||
Source sysKernelSockaddrStorage
|
||||
}
|
||||
|
||||
type sysICMPFilter struct {
|
||||
Data uint32
|
||||
}
|
||||
|
||||
type sysSockFProg struct {
|
||||
Len uint16
|
||||
Pad_cgo_0 [6]byte
|
||||
Filter *sysSockFilter
|
||||
}
|
||||
|
||||
type sysSockFilter struct {
|
||||
Code uint16
|
||||
Jt uint8
|
||||
Jf uint8
|
||||
K uint32
|
||||
}
|
||||
150
vendor/golang.org/x/net/ipv4/zsys_linux_mips64.go
generated
vendored
Normal file
150
vendor/golang.org/x/net/ipv4/zsys_linux_mips64.go
generated
vendored
Normal file
@@ -0,0 +1,150 @@
|
||||
// Created by cgo -godefs - DO NOT EDIT
|
||||
// cgo -godefs defs_linux.go
|
||||
|
||||
// +build linux,mips64
|
||||
|
||||
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
|
||||
|
||||
sysSizeofKernelSockaddrStorage = 0x80
|
||||
sysSizeofSockaddrInet = 0x10
|
||||
sysSizeofInetPktinfo = 0xc
|
||||
sysSizeofSockExtendedErr = 0x10
|
||||
|
||||
sysSizeofIPMreq = 0x8
|
||||
sysSizeofIPMreqn = 0xc
|
||||
sysSizeofIPMreqSource = 0xc
|
||||
sysSizeofGroupReq = 0x88
|
||||
sysSizeofGroupSourceReq = 0x108
|
||||
|
||||
sysSizeofICMPFilter = 0x4
|
||||
)
|
||||
|
||||
type sysKernelSockaddrStorage struct {
|
||||
Family uint16
|
||||
X__data [126]int8
|
||||
}
|
||||
|
||||
type sysSockaddrInet struct {
|
||||
Family uint16
|
||||
Port uint16
|
||||
Addr [4]byte /* in_addr */
|
||||
X__pad [8]uint8
|
||||
}
|
||||
|
||||
type sysInetPktinfo struct {
|
||||
Ifindex int32
|
||||
Spec_dst [4]byte /* in_addr */
|
||||
Addr [4]byte /* in_addr */
|
||||
}
|
||||
|
||||
type sysSockExtendedErr struct {
|
||||
Errno uint32
|
||||
Origin uint8
|
||||
Type uint8
|
||||
Code uint8
|
||||
Pad uint8
|
||||
Info uint32
|
||||
Data uint32
|
||||
}
|
||||
|
||||
type sysIPMreq struct {
|
||||
Multiaddr [4]byte /* in_addr */
|
||||
Interface [4]byte /* in_addr */
|
||||
}
|
||||
|
||||
type sysIPMreqn struct {
|
||||
Multiaddr [4]byte /* in_addr */
|
||||
Address [4]byte /* in_addr */
|
||||
Ifindex int32
|
||||
}
|
||||
|
||||
type sysIPMreqSource struct {
|
||||
Multiaddr uint32
|
||||
Interface uint32
|
||||
Sourceaddr uint32
|
||||
}
|
||||
|
||||
type sysGroupReq struct {
|
||||
Interface uint32
|
||||
Pad_cgo_0 [4]byte
|
||||
Group sysKernelSockaddrStorage
|
||||
}
|
||||
|
||||
type sysGroupSourceReq struct {
|
||||
Interface uint32
|
||||
Pad_cgo_0 [4]byte
|
||||
Group sysKernelSockaddrStorage
|
||||
Source sysKernelSockaddrStorage
|
||||
}
|
||||
|
||||
type sysICMPFilter struct {
|
||||
Data uint32
|
||||
}
|
||||
|
||||
type sysSockFProg struct {
|
||||
Len uint16
|
||||
Pad_cgo_0 [6]byte
|
||||
Filter *sysSockFilter
|
||||
}
|
||||
|
||||
type sysSockFilter struct {
|
||||
Code uint16
|
||||
Jt uint8
|
||||
Jf uint8
|
||||
K uint32
|
||||
}
|
||||
150
vendor/golang.org/x/net/ipv4/zsys_linux_mips64le.go
generated
vendored
Normal file
150
vendor/golang.org/x/net/ipv4/zsys_linux_mips64le.go
generated
vendored
Normal file
@@ -0,0 +1,150 @@
|
||||
// Created by cgo -godefs - DO NOT EDIT
|
||||
// cgo -godefs defs_linux.go
|
||||
|
||||
// +build linux,mips64le
|
||||
|
||||
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
|
||||
|
||||
sysSizeofKernelSockaddrStorage = 0x80
|
||||
sysSizeofSockaddrInet = 0x10
|
||||
sysSizeofInetPktinfo = 0xc
|
||||
sysSizeofSockExtendedErr = 0x10
|
||||
|
||||
sysSizeofIPMreq = 0x8
|
||||
sysSizeofIPMreqn = 0xc
|
||||
sysSizeofIPMreqSource = 0xc
|
||||
sysSizeofGroupReq = 0x88
|
||||
sysSizeofGroupSourceReq = 0x108
|
||||
|
||||
sysSizeofICMPFilter = 0x4
|
||||
)
|
||||
|
||||
type sysKernelSockaddrStorage struct {
|
||||
Family uint16
|
||||
X__data [126]int8
|
||||
}
|
||||
|
||||
type sysSockaddrInet struct {
|
||||
Family uint16
|
||||
Port uint16
|
||||
Addr [4]byte /* in_addr */
|
||||
X__pad [8]uint8
|
||||
}
|
||||
|
||||
type sysInetPktinfo struct {
|
||||
Ifindex int32
|
||||
Spec_dst [4]byte /* in_addr */
|
||||
Addr [4]byte /* in_addr */
|
||||
}
|
||||
|
||||
type sysSockExtendedErr struct {
|
||||
Errno uint32
|
||||
Origin uint8
|
||||
Type uint8
|
||||
Code uint8
|
||||
Pad uint8
|
||||
Info uint32
|
||||
Data uint32
|
||||
}
|
||||
|
||||
type sysIPMreq struct {
|
||||
Multiaddr [4]byte /* in_addr */
|
||||
Interface [4]byte /* in_addr */
|
||||
}
|
||||
|
||||
type sysIPMreqn struct {
|
||||
Multiaddr [4]byte /* in_addr */
|
||||
Address [4]byte /* in_addr */
|
||||
Ifindex int32
|
||||
}
|
||||
|
||||
type sysIPMreqSource struct {
|
||||
Multiaddr uint32
|
||||
Interface uint32
|
||||
Sourceaddr uint32
|
||||
}
|
||||
|
||||
type sysGroupReq struct {
|
||||
Interface uint32
|
||||
Pad_cgo_0 [4]byte
|
||||
Group sysKernelSockaddrStorage
|
||||
}
|
||||
|
||||
type sysGroupSourceReq struct {
|
||||
Interface uint32
|
||||
Pad_cgo_0 [4]byte
|
||||
Group sysKernelSockaddrStorage
|
||||
Source sysKernelSockaddrStorage
|
||||
}
|
||||
|
||||
type sysICMPFilter struct {
|
||||
Data uint32
|
||||
}
|
||||
|
||||
type sysSockFProg struct {
|
||||
Len uint16
|
||||
Pad_cgo_0 [6]byte
|
||||
Filter *sysSockFilter
|
||||
}
|
||||
|
||||
type sysSockFilter struct {
|
||||
Code uint16
|
||||
Jt uint8
|
||||
Jf uint8
|
||||
K uint32
|
||||
}
|
||||
150
vendor/golang.org/x/net/ipv4/zsys_linux_ppc64.go
generated
vendored
Normal file
150
vendor/golang.org/x/net/ipv4/zsys_linux_ppc64.go
generated
vendored
Normal file
@@ -0,0 +1,150 @@
|
||||
// Created by cgo -godefs - DO NOT EDIT
|
||||
// cgo -godefs defs_linux.go
|
||||
|
||||
// +build linux,ppc64
|
||||
|
||||
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
|
||||
|
||||
sysSizeofKernelSockaddrStorage = 0x80
|
||||
sysSizeofSockaddrInet = 0x10
|
||||
sysSizeofInetPktinfo = 0xc
|
||||
sysSizeofSockExtendedErr = 0x10
|
||||
|
||||
sysSizeofIPMreq = 0x8
|
||||
sysSizeofIPMreqn = 0xc
|
||||
sysSizeofIPMreqSource = 0xc
|
||||
sysSizeofGroupReq = 0x88
|
||||
sysSizeofGroupSourceReq = 0x108
|
||||
|
||||
sysSizeofICMPFilter = 0x4
|
||||
)
|
||||
|
||||
type sysKernelSockaddrStorage struct {
|
||||
Family uint16
|
||||
X__data [126]int8
|
||||
}
|
||||
|
||||
type sysSockaddrInet struct {
|
||||
Family uint16
|
||||
Port uint16
|
||||
Addr [4]byte /* in_addr */
|
||||
X__pad [8]uint8
|
||||
}
|
||||
|
||||
type sysInetPktinfo struct {
|
||||
Ifindex int32
|
||||
Spec_dst [4]byte /* in_addr */
|
||||
Addr [4]byte /* in_addr */
|
||||
}
|
||||
|
||||
type sysSockExtendedErr struct {
|
||||
Errno uint32
|
||||
Origin uint8
|
||||
Type uint8
|
||||
Code uint8
|
||||
Pad uint8
|
||||
Info uint32
|
||||
Data uint32
|
||||
}
|
||||
|
||||
type sysIPMreq struct {
|
||||
Multiaddr [4]byte /* in_addr */
|
||||
Interface [4]byte /* in_addr */
|
||||
}
|
||||
|
||||
type sysIPMreqn struct {
|
||||
Multiaddr [4]byte /* in_addr */
|
||||
Address [4]byte /* in_addr */
|
||||
Ifindex int32
|
||||
}
|
||||
|
||||
type sysIPMreqSource struct {
|
||||
Multiaddr uint32
|
||||
Interface uint32
|
||||
Sourceaddr uint32
|
||||
}
|
||||
|
||||
type sysGroupReq struct {
|
||||
Interface uint32
|
||||
Pad_cgo_0 [4]byte
|
||||
Group sysKernelSockaddrStorage
|
||||
}
|
||||
|
||||
type sysGroupSourceReq struct {
|
||||
Interface uint32
|
||||
Pad_cgo_0 [4]byte
|
||||
Group sysKernelSockaddrStorage
|
||||
Source sysKernelSockaddrStorage
|
||||
}
|
||||
|
||||
type sysICMPFilter struct {
|
||||
Data uint32
|
||||
}
|
||||
|
||||
type sysSockFProg struct {
|
||||
Len uint16
|
||||
Pad_cgo_0 [6]byte
|
||||
Filter *sysSockFilter
|
||||
}
|
||||
|
||||
type sysSockFilter struct {
|
||||
Code uint16
|
||||
Jt uint8
|
||||
Jf uint8
|
||||
K uint32
|
||||
}
|
||||
150
vendor/golang.org/x/net/ipv4/zsys_linux_ppc64le.go
generated
vendored
Normal file
150
vendor/golang.org/x/net/ipv4/zsys_linux_ppc64le.go
generated
vendored
Normal file
@@ -0,0 +1,150 @@
|
||||
// Created by cgo -godefs - DO NOT EDIT
|
||||
// cgo -godefs defs_linux.go
|
||||
|
||||
// +build linux,ppc64le
|
||||
|
||||
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
|
||||
|
||||
sysSizeofKernelSockaddrStorage = 0x80
|
||||
sysSizeofSockaddrInet = 0x10
|
||||
sysSizeofInetPktinfo = 0xc
|
||||
sysSizeofSockExtendedErr = 0x10
|
||||
|
||||
sysSizeofIPMreq = 0x8
|
||||
sysSizeofIPMreqn = 0xc
|
||||
sysSizeofIPMreqSource = 0xc
|
||||
sysSizeofGroupReq = 0x88
|
||||
sysSizeofGroupSourceReq = 0x108
|
||||
|
||||
sysSizeofICMPFilter = 0x4
|
||||
)
|
||||
|
||||
type sysKernelSockaddrStorage struct {
|
||||
Family uint16
|
||||
X__data [126]int8
|
||||
}
|
||||
|
||||
type sysSockaddrInet struct {
|
||||
Family uint16
|
||||
Port uint16
|
||||
Addr [4]byte /* in_addr */
|
||||
X__pad [8]uint8
|
||||
}
|
||||
|
||||
type sysInetPktinfo struct {
|
||||
Ifindex int32
|
||||
Spec_dst [4]byte /* in_addr */
|
||||
Addr [4]byte /* in_addr */
|
||||
}
|
||||
|
||||
type sysSockExtendedErr struct {
|
||||
Errno uint32
|
||||
Origin uint8
|
||||
Type uint8
|
||||
Code uint8
|
||||
Pad uint8
|
||||
Info uint32
|
||||
Data uint32
|
||||
}
|
||||
|
||||
type sysIPMreq struct {
|
||||
Multiaddr [4]byte /* in_addr */
|
||||
Interface [4]byte /* in_addr */
|
||||
}
|
||||
|
||||
type sysIPMreqn struct {
|
||||
Multiaddr [4]byte /* in_addr */
|
||||
Address [4]byte /* in_addr */
|
||||
Ifindex int32
|
||||
}
|
||||
|
||||
type sysIPMreqSource struct {
|
||||
Multiaddr uint32
|
||||
Interface uint32
|
||||
Sourceaddr uint32
|
||||
}
|
||||
|
||||
type sysGroupReq struct {
|
||||
Interface uint32
|
||||
Pad_cgo_0 [4]byte
|
||||
Group sysKernelSockaddrStorage
|
||||
}
|
||||
|
||||
type sysGroupSourceReq struct {
|
||||
Interface uint32
|
||||
Pad_cgo_0 [4]byte
|
||||
Group sysKernelSockaddrStorage
|
||||
Source sysKernelSockaddrStorage
|
||||
}
|
||||
|
||||
type sysICMPFilter struct {
|
||||
Data uint32
|
||||
}
|
||||
|
||||
type sysSockFProg struct {
|
||||
Len uint16
|
||||
Pad_cgo_0 [6]byte
|
||||
Filter *sysSockFilter
|
||||
}
|
||||
|
||||
type sysSockFilter struct {
|
||||
Code uint16
|
||||
Jt uint8
|
||||
Jf uint8
|
||||
K uint32
|
||||
}
|
||||
150
vendor/golang.org/x/net/ipv4/zsys_linux_s390x.go
generated
vendored
Normal file
150
vendor/golang.org/x/net/ipv4/zsys_linux_s390x.go
generated
vendored
Normal file
@@ -0,0 +1,150 @@
|
||||
// Created by cgo -godefs - DO NOT EDIT
|
||||
// cgo -godefs defs_linux.go
|
||||
|
||||
// +build linux,s390x
|
||||
|
||||
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
|
||||
|
||||
sysSizeofKernelSockaddrStorage = 0x80
|
||||
sysSizeofSockaddrInet = 0x10
|
||||
sysSizeofInetPktinfo = 0xc
|
||||
sysSizeofSockExtendedErr = 0x10
|
||||
|
||||
sysSizeofIPMreq = 0x8
|
||||
sysSizeofIPMreqn = 0xc
|
||||
sysSizeofIPMreqSource = 0xc
|
||||
sysSizeofGroupReq = 0x88
|
||||
sysSizeofGroupSourceReq = 0x108
|
||||
|
||||
sysSizeofICMPFilter = 0x4
|
||||
)
|
||||
|
||||
type sysKernelSockaddrStorage struct {
|
||||
Family uint16
|
||||
X__data [126]int8
|
||||
}
|
||||
|
||||
type sysSockaddrInet struct {
|
||||
Family uint16
|
||||
Port uint16
|
||||
Addr [4]byte /* in_addr */
|
||||
X__pad [8]uint8
|
||||
}
|
||||
|
||||
type sysInetPktinfo struct {
|
||||
Ifindex int32
|
||||
Spec_dst [4]byte /* in_addr */
|
||||
Addr [4]byte /* in_addr */
|
||||
}
|
||||
|
||||
type sysSockExtendedErr struct {
|
||||
Errno uint32
|
||||
Origin uint8
|
||||
Type uint8
|
||||
Code uint8
|
||||
Pad uint8
|
||||
Info uint32
|
||||
Data uint32
|
||||
}
|
||||
|
||||
type sysIPMreq struct {
|
||||
Multiaddr [4]byte /* in_addr */
|
||||
Interface [4]byte /* in_addr */
|
||||
}
|
||||
|
||||
type sysIPMreqn struct {
|
||||
Multiaddr [4]byte /* in_addr */
|
||||
Address [4]byte /* in_addr */
|
||||
Ifindex int32
|
||||
}
|
||||
|
||||
type sysIPMreqSource struct {
|
||||
Multiaddr uint32
|
||||
Interface uint32
|
||||
Sourceaddr uint32
|
||||
}
|
||||
|
||||
type sysGroupReq struct {
|
||||
Interface uint32
|
||||
Pad_cgo_0 [4]byte
|
||||
Group sysKernelSockaddrStorage
|
||||
}
|
||||
|
||||
type sysGroupSourceReq struct {
|
||||
Interface uint32
|
||||
Pad_cgo_0 [4]byte
|
||||
Group sysKernelSockaddrStorage
|
||||
Source sysKernelSockaddrStorage
|
||||
}
|
||||
|
||||
type sysICMPFilter struct {
|
||||
Data uint32
|
||||
}
|
||||
|
||||
type sysSockFProg struct {
|
||||
Len uint16
|
||||
Pad_cgo_0 [6]byte
|
||||
Filter *sysSockFilter
|
||||
}
|
||||
|
||||
type sysSockFilter struct {
|
||||
Code uint16
|
||||
Jt uint8
|
||||
Jf uint8
|
||||
K uint32
|
||||
}
|
||||
30
vendor/golang.org/x/net/ipv4/zsys_netbsd.go
generated
vendored
Normal file
30
vendor/golang.org/x/net/ipv4/zsys_netbsd.go
generated
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
// Created by cgo -godefs - DO NOT EDIT
|
||||
// cgo -godefs defs_netbsd.go
|
||||
|
||||
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 = 0x14
|
||||
sysIP_RECVTTL = 0x17
|
||||
|
||||
sysIP_MULTICAST_IF = 0x9
|
||||
sysIP_MULTICAST_TTL = 0xa
|
||||
sysIP_MULTICAST_LOOP = 0xb
|
||||
sysIP_ADD_MEMBERSHIP = 0xc
|
||||
sysIP_DROP_MEMBERSHIP = 0xd
|
||||
|
||||
sysSizeofIPMreq = 0x8
|
||||
)
|
||||
|
||||
type sysIPMreq struct {
|
||||
Multiaddr [4]byte /* in_addr */
|
||||
Interface [4]byte /* in_addr */
|
||||
}
|
||||
30
vendor/golang.org/x/net/ipv4/zsys_openbsd.go
generated
vendored
Normal file
30
vendor/golang.org/x/net/ipv4/zsys_openbsd.go
generated
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
// Created by cgo -godefs - DO NOT EDIT
|
||||
// cgo -godefs defs_openbsd.go
|
||||
|
||||
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 = 0x1e
|
||||
sysIP_RECVTTL = 0x1f
|
||||
|
||||
sysIP_MULTICAST_IF = 0x9
|
||||
sysIP_MULTICAST_TTL = 0xa
|
||||
sysIP_MULTICAST_LOOP = 0xb
|
||||
sysIP_ADD_MEMBERSHIP = 0xc
|
||||
sysIP_DROP_MEMBERSHIP = 0xd
|
||||
|
||||
sysSizeofIPMreq = 0x8
|
||||
)
|
||||
|
||||
type sysIPMreq struct {
|
||||
Multiaddr [4]byte /* in_addr */
|
||||
Interface [4]byte /* in_addr */
|
||||
}
|
||||
60
vendor/golang.org/x/net/ipv4/zsys_solaris.go
generated
vendored
Normal file
60
vendor/golang.org/x/net/ipv4/zsys_solaris.go
generated
vendored
Normal file
@@ -0,0 +1,60 @@
|
||||
// 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_MULTICAST_IF = 0x10
|
||||
sysIP_MULTICAST_TTL = 0x11
|
||||
sysIP_MULTICAST_LOOP = 0x12
|
||||
sysIP_ADD_MEMBERSHIP = 0x13
|
||||
sysIP_DROP_MEMBERSHIP = 0x14
|
||||
sysIP_BLOCK_SOURCE = 0x15
|
||||
sysIP_UNBLOCK_SOURCE = 0x16
|
||||
sysIP_ADD_SOURCE_MEMBERSHIP = 0x17
|
||||
sysIP_DROP_SOURCE_MEMBERSHIP = 0x18
|
||||
|
||||
sysSizeofInetPktinfo = 0xc
|
||||
|
||||
sysSizeofIPMreq = 0x8
|
||||
sysSizeofIPMreqSource = 0xc
|
||||
)
|
||||
|
||||
type sysInetPktinfo struct {
|
||||
Ifindex uint32
|
||||
Spec_dst [4]byte /* in_addr */
|
||||
Addr [4]byte /* in_addr */
|
||||
}
|
||||
|
||||
type sysIPMreq struct {
|
||||
Multiaddr [4]byte /* in_addr */
|
||||
Interface [4]byte /* in_addr */
|
||||
}
|
||||
|
||||
type sysIPMreqSource struct {
|
||||
Multiaddr [4]byte /* in_addr */
|
||||
Sourceaddr [4]byte /* in_addr */
|
||||
Interface [4]byte /* in_addr */
|
||||
}
|
||||
Reference in New Issue
Block a user