├── vendor ├── golang.org │ └── x │ │ └── net │ │ ├── internal │ │ └── socket │ │ │ ├── sys_darwin.go │ │ │ ├── sys_dragonfly.go │ │ │ ├── empty.s │ │ │ ├── sys_linux_amd64.go │ │ │ ├── sys_linux_arm.go │ │ │ ├── sys_linux_arm64.go │ │ │ ├── sys_linux_mips.go │ │ │ ├── sys_linux_ppc64.go │ │ │ ├── sys_linux_mips64.go │ │ │ ├── sys_linux_mips64le.go │ │ │ ├── sys_linux_mipsle.go │ │ │ ├── sys_linux_ppc64le.go │ │ │ ├── iovec_stub.go │ │ │ ├── msghdr_openbsd.go │ │ │ ├── sys_linux_386.s │ │ │ ├── sys_linux_s390x.s │ │ │ ├── sys_solaris_amd64.s │ │ │ ├── cmsghdr_solaris_64bit.go │ │ │ ├── cmsghdr_bsd.go │ │ │ ├── cmsghdr_linux_32bit.go │ │ │ ├── msghdr_bsdvar.go │ │ │ ├── cmsghdr_linux_64bit.go │ │ │ ├── cmsghdr.go │ │ │ ├── iovec_solaris_64bit.go │ │ │ ├── rawconn_nommsg.go │ │ │ ├── sys_bsd.go │ │ │ ├── iovec_32bit.go │ │ │ ├── rawconn_nomsg.go │ │ │ ├── iovec_64bit.go │ │ │ ├── cmsghdr_stub.go │ │ │ ├── sys_bsdvar.go │ │ │ ├── msghdr_linux_32bit.go │ │ │ ├── msghdr_linux_64bit.go │ │ │ ├── mmsghdr_stub.go │ │ │ ├── msghdr_stub.go │ │ │ ├── error_windows.go │ │ │ ├── sys.go │ │ │ ├── sys_netbsd.go │ │ │ ├── error_unix.go │ │ │ ├── sys_linux.go │ │ │ ├── msghdr_linux.go │ │ │ ├── msghdr_solaris_64bit.go │ │ │ ├── msghdr_bsd.go │ │ │ ├── defs_darwin.go │ │ │ ├── defs_freebsd.go │ │ │ ├── defs_openbsd.go │ │ │ ├── defs_solaris.go │ │ │ ├── defs_dragonfly.go │ │ │ ├── zsys_darwin_386.go │ │ │ ├── zsys_darwin_arm.go │ │ │ ├── zsys_freebsd_386.go │ │ │ ├── zsys_freebsd_arm.go │ │ │ ├── zsys_openbsd_386.go │ │ │ ├── zsys_openbsd_arm.go │ │ │ ├── defs_aix.go │ │ │ ├── defs_netbsd.go │ │ │ ├── zsys_darwin_amd64.go │ │ │ ├── zsys_darwin_arm64.go │ │ │ ├── zsys_freebsd_amd64.go │ │ │ ├── zsys_openbsd_amd64.go │ │ │ ├── zsys_dragonfly_amd64.go │ │ │ ├── zsys_linux_386.go │ │ │ ├── zsys_linux_arm.go │ │ │ ├── zsys_linux_mips.go │ │ │ ├── zsys_linux_mipsle.go │ │ │ ├── mmsghdr_unix.go │ │ │ ├── zsys_solaris_amd64.go │ │ │ ├── zsys_netbsd_386.go │ │ │ ├── zsys_netbsd_arm.go │ │ │ ├── defs_linux.go │ │ │ ├── zsys_linux_amd64.go │ │ │ ├── zsys_linux_arm64.go │ │ │ ├── zsys_linux_mips64.go │ │ │ ├── zsys_linux_mips64le.go │ │ │ ├── zsys_linux_ppc64.go │ │ │ ├── zsys_linux_ppc64le.go │ │ │ ├── zsys_linux_s390x.go │ │ │ ├── sys_go1_11_darwin.go │ │ │ ├── zsys_netbsd_amd64.go │ │ │ ├── sys_unix.go │ │ │ ├── zsys_aix_ppc64.go │ │ │ ├── sys_linkname.go │ │ │ ├── sys_stub.go │ │ │ ├── rawconn.go │ │ │ ├── sys_windows.go │ │ │ ├── rawconn_msg.go │ │ │ ├── rawconn_mmsg.go │ │ │ ├── sys_linux_386.go │ │ │ └── sys_linux_s390x.go │ │ ├── icmp │ │ ├── sys_freebsd.go │ │ ├── ipv6.go │ │ ├── listen_stub.go │ │ ├── packettoobig.go │ │ ├── messagebody.go │ │ ├── timeexceeded.go │ │ ├── dstunreach.go │ │ ├── helper_posix.go │ │ ├── mpls.go │ │ ├── paramprob.go │ │ └── ipv4.go │ │ ├── bpf │ │ ├── setter.go │ │ └── asm.go │ │ ├── ipv4 │ │ ├── sys_stub.go │ │ ├── control_windows.go │ │ ├── sys_bpf_stub.go │ │ ├── control_stub.go │ │ ├── icmp_stub.go │ │ ├── sys_asmreqn_stub.go │ │ ├── sys_ssmreq_stub.go │ │ ├── icmp_linux.go │ │ ├── sys_bpf.go │ │ ├── payload.go │ │ ├── zsys_netbsd.go │ │ ├── zsys_openbsd.go │ │ ├── sys_asmreq_stub.go │ │ ├── zsys_dragonfly.go │ │ ├── zsys_aix_ppc64.go │ │ ├── defs_netbsd.go │ │ ├── defs_openbsd.go │ │ ├── control_pktinfo.go │ │ ├── defs_dragonfly.go │ │ ├── sys_asmreqn.go │ │ ├── defs_aix.go │ │ ├── control_bsd.go │ │ ├── sockopt_stub.go │ │ ├── genericopt.go │ │ ├── sys_ssmreq.go │ │ ├── payload_nocmsg.go │ │ ├── iana.go │ │ ├── icmp.go │ │ ├── sockopt.go │ │ ├── sys_dragonfly.go │ │ ├── sys_bsd.go │ │ ├── sys_aix.go │ │ ├── control_unix.go │ │ ├── sockopt_posix.go │ │ ├── helper.go │ │ ├── sys_windows.go │ │ ├── zsys_freebsd_386.go │ │ ├── zsys_freebsd_amd64.go │ │ └── zsys_freebsd_arm.go │ │ ├── ipv6 │ │ ├── sys_stub.go │ │ ├── control_windows.go │ │ ├── sys_bpf_stub.go │ │ ├── control_stub.go │ │ ├── sys_asmreq_stub.go │ │ ├── icmp_stub.go │ │ ├── icmp_windows.go │ │ ├── sys_ssmreq_stub.go │ │ ├── sys_bpf.go │ │ ├── payload.go │ │ ├── sys_asmreq.go │ │ ├── icmp_linux.go │ │ ├── icmp_solaris.go │ │ ├── icmp_bsd.go │ │ ├── helper.go │ │ ├── sockopt_stub.go │ │ ├── payload_nocmsg.go │ │ ├── sys_ssmreq.go │ │ ├── genericopt.go │ │ ├── control_rfc2292_unix.go │ │ ├── control_unix.go │ │ ├── header.go │ │ ├── icmp.go │ │ ├── zsys_netbsd.go │ │ ├── sockopt.go │ │ ├── zsys_dragonfly.go │ │ ├── zsys_openbsd.go │ │ ├── sys_windows.go │ │ ├── zsys_aix_ppc64.go │ │ ├── defs_netbsd.go │ │ └── defs_aix.go │ │ ├── PATENTS │ │ └── LICENSE └── vendor.json ├── common ├── type.go └── func.go ├── main.go ├── README.md ├── ping └── type.go └── mtr └── type.go /vendor/golang.org/x/net/internal/socket/sys_darwin.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package socket 6 | 7 | func probeProtocolStack() int { return 4 } 8 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/sys_dragonfly.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package socket 6 | 7 | func probeProtocolStack() int { return 4 } 8 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/empty.s: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build darwin,go1.12 6 | 7 | // This exists solely so we can linkname in symbols from syscall. 8 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/sys_linux_amd64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package socket 6 | 7 | const ( 8 | sysRECVMMSG = 0x12b 9 | sysSENDMMSG = 0x133 10 | ) 11 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/sys_linux_arm.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package socket 6 | 7 | const ( 8 | sysRECVMMSG = 0x16d 9 | sysSENDMMSG = 0x176 10 | ) 11 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/sys_linux_arm64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package socket 6 | 7 | const ( 8 | sysRECVMMSG = 0xf3 9 | sysSENDMMSG = 0x10d 10 | ) 11 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/sys_linux_mips.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package socket 6 | 7 | const ( 8 | sysRECVMMSG = 0x10ef 9 | sysSENDMMSG = 0x10f7 10 | ) 11 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/sys_linux_ppc64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package socket 6 | 7 | const ( 8 | sysRECVMMSG = 0x157 9 | sysSENDMMSG = 0x15d 10 | ) 11 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/sys_linux_mips64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package socket 6 | 7 | const ( 8 | sysRECVMMSG = 0x14ae 9 | sysSENDMMSG = 0x14b6 10 | ) 11 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/sys_linux_mips64le.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package socket 6 | 7 | const ( 8 | sysRECVMMSG = 0x14ae 9 | sysSENDMMSG = 0x14b6 10 | ) 11 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/sys_linux_mipsle.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package socket 6 | 7 | const ( 8 | sysRECVMMSG = 0x10ef 9 | sysSENDMMSG = 0x10f7 10 | ) 11 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/sys_linux_ppc64le.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package socket 6 | 7 | const ( 8 | sysRECVMMSG = 0x157 9 | sysSENDMMSG = 0x15d 10 | ) 11 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/icmp/sys_freebsd.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package icmp 6 | 7 | import "syscall" 8 | 9 | func init() { 10 | freebsdVersion, _ = syscall.SysctlUint32("kern.osreldate") 11 | } 12 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/bpf/setter.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package bpf 6 | 7 | // A Setter is a type which can attach a compiled BPF filter to itself. 8 | type Setter interface { 9 | SetBPF(filter []RawInstruction) error 10 | } 11 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/iovec_stub.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !aix,!darwin,!dragonfly,!freebsd,!linux,!netbsd,!openbsd,!solaris 6 | 7 | package socket 8 | 9 | type iovec struct{} 10 | 11 | func (v *iovec) set(b []byte) {} 12 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/msghdr_openbsd.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package socket 6 | 7 | func (h *msghdr) setIov(vs []iovec) { 8 | l := len(vs) 9 | if l == 0 { 10 | return 11 | } 12 | h.Iov = &vs[0] 13 | h.Iovlen = uint32(l) 14 | } 15 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/sys_linux_386.s: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | #include "textflag.h" 6 | 7 | TEXT ·socketcall(SB),NOSPLIT,$0-36 8 | JMP syscall·socketcall(SB) 9 | 10 | TEXT ·rawsocketcall(SB),NOSPLIT,$0-36 11 | JMP syscall·rawsocketcall(SB) 12 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/sys_linux_s390x.s: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | #include "textflag.h" 6 | 7 | TEXT ·socketcall(SB),NOSPLIT,$0-72 8 | JMP syscall·socketcall(SB) 9 | 10 | TEXT ·rawsocketcall(SB),NOSPLIT,$0-72 11 | JMP syscall·rawsocketcall(SB) 12 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/sys_solaris_amd64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | #include "textflag.h" 6 | 7 | TEXT ·sysvicall6(SB),NOSPLIT,$0-88 8 | JMP syscall·sysvicall6(SB) 9 | 10 | TEXT ·rawSysvicall6(SB),NOSPLIT,$0-88 11 | JMP syscall·rawSysvicall6(SB) 12 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/ipv4/sys_stub.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !aix,!darwin,!dragonfly,!freebsd,!linux,!netbsd,!openbsd,!solaris,!windows 6 | 7 | package ipv4 8 | 9 | var ( 10 | ctlOpts = [ctlMax]ctlOpt{} 11 | 12 | sockOpts = map[int]*sockOpt{} 13 | ) 14 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/ipv6/sys_stub.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !aix,!darwin,!dragonfly,!freebsd,!linux,!netbsd,!openbsd,!solaris,!windows 6 | 7 | package ipv6 8 | 9 | var ( 10 | ctlOpts = [ctlMax]ctlOpt{} 11 | 12 | sockOpts = map[int]*sockOpt{} 13 | ) 14 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/cmsghdr_solaris_64bit.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build amd64 6 | // +build solaris 7 | 8 | package socket 9 | 10 | func (h *cmsghdr) set(l, lvl, typ int) { 11 | h.Len = uint32(l) 12 | h.Level = int32(lvl) 13 | h.Type = int32(typ) 14 | } 15 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/cmsghdr_bsd.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build aix darwin dragonfly freebsd netbsd openbsd 6 | 7 | package socket 8 | 9 | func (h *cmsghdr) set(l, lvl, typ int) { 10 | h.Len = uint32(l) 11 | h.Level = int32(lvl) 12 | h.Type = int32(typ) 13 | } 14 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/cmsghdr_linux_32bit.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build arm mips mipsle 386 6 | // +build linux 7 | 8 | package socket 9 | 10 | func (h *cmsghdr) set(l, lvl, typ int) { 11 | h.Len = uint32(l) 12 | h.Level = int32(lvl) 13 | h.Type = int32(typ) 14 | } 15 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/ipv4/control_windows.go: -------------------------------------------------------------------------------- 1 | // Copyright 2012 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package ipv4 6 | 7 | import "golang.org/x/net/internal/socket" 8 | 9 | func setControlMessage(c *socket.Conn, opt *rawOpt, cf ControlFlags, on bool) error { 10 | // TODO(mikio): implement this 11 | return errNotImplemented 12 | } 13 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/ipv6/control_windows.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package ipv6 6 | 7 | import "golang.org/x/net/internal/socket" 8 | 9 | func setControlMessage(c *socket.Conn, opt *rawOpt, cf ControlFlags, on bool) error { 10 | // TODO(mikio): implement this 11 | return errNotImplemented 12 | } 13 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/msghdr_bsdvar.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build aix darwin dragonfly freebsd netbsd 6 | 7 | package socket 8 | 9 | func (h *msghdr) setIov(vs []iovec) { 10 | l := len(vs) 11 | if l == 0 { 12 | return 13 | } 14 | h.Iov = &vs[0] 15 | h.Iovlen = int32(l) 16 | } 17 | -------------------------------------------------------------------------------- /common/type.go: -------------------------------------------------------------------------------- 1 | package common 2 | 3 | import ( 4 | "time" 5 | ) 6 | 7 | type IcmpReturn struct { 8 | Success bool 9 | Addr string 10 | Elapsed time.Duration 11 | } 12 | 13 | type IcmpHop struct { 14 | Success bool 15 | Address string 16 | Host string 17 | N int 18 | TTL int 19 | Snt int 20 | LastTime time.Duration 21 | AvgTime time.Duration 22 | BestTime time.Duration 23 | WrstTime time.Duration 24 | Loss float32 25 | } 26 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/cmsghdr_linux_64bit.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build arm64 amd64 ppc64 ppc64le mips64 mips64le s390x 6 | // +build linux 7 | 8 | package socket 9 | 10 | func (h *cmsghdr) set(l, lvl, typ int) { 11 | h.Len = uint64(l) 12 | h.Level = int32(lvl) 13 | h.Type = int32(typ) 14 | } 15 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/ipv4/sys_bpf_stub.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !linux 6 | 7 | package ipv4 8 | 9 | import ( 10 | "golang.org/x/net/bpf" 11 | "golang.org/x/net/internal/socket" 12 | ) 13 | 14 | func (so *sockOpt) setAttachFilter(c *socket.Conn, f []bpf.RawInstruction) error { 15 | return errNotImplemented 16 | } 17 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/ipv6/sys_bpf_stub.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !linux 6 | 7 | package ipv6 8 | 9 | import ( 10 | "golang.org/x/net/bpf" 11 | "golang.org/x/net/internal/socket" 12 | ) 13 | 14 | func (so *sockOpt) setAttachFilter(c *socket.Conn, f []bpf.RawInstruction) error { 15 | return errNotImplemented 16 | } 17 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/cmsghdr.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build aix darwin dragonfly freebsd linux netbsd openbsd solaris 6 | 7 | package socket 8 | 9 | func (h *cmsghdr) len() int { return int(h.Len) } 10 | func (h *cmsghdr) lvl() int { return int(h.Level) } 11 | func (h *cmsghdr) typ() int { return int(h.Type) } 12 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/iovec_solaris_64bit.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build amd64 6 | // +build solaris 7 | 8 | package socket 9 | 10 | import "unsafe" 11 | 12 | func (v *iovec) set(b []byte) { 13 | l := len(b) 14 | if l == 0 { 15 | return 16 | } 17 | v.Base = (*int8)(unsafe.Pointer(&b[0])) 18 | v.Len = uint64(l) 19 | } 20 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/rawconn_nommsg.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !linux 6 | 7 | package socket 8 | 9 | func (c *Conn) recvMsgs(ms []Message, flags int) (int, error) { 10 | return 0, errNotImplemented 11 | } 12 | 13 | func (c *Conn) sendMsgs(ms []Message, flags int) (int, error) { 14 | return 0, errNotImplemented 15 | } 16 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/ipv4/control_stub.go: -------------------------------------------------------------------------------- 1 | // Copyright 2012 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !aix,!darwin,!dragonfly,!freebsd,!linux,!netbsd,!openbsd,!solaris,!windows 6 | 7 | package ipv4 8 | 9 | import "golang.org/x/net/internal/socket" 10 | 11 | func setControlMessage(c *socket.Conn, opt *rawOpt, cf ControlFlags, on bool) error { 12 | return errNotImplemented 13 | } 14 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/ipv6/control_stub.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !aix,!darwin,!dragonfly,!freebsd,!linux,!netbsd,!openbsd,!solaris,!windows 6 | 7 | package ipv6 8 | 9 | import "golang.org/x/net/internal/socket" 10 | 11 | func setControlMessage(c *socket.Conn, opt *rawOpt, cf ControlFlags, on bool) error { 12 | return errNotImplemented 13 | } 14 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/sys_bsd.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build aix darwin dragonfly freebsd openbsd 6 | 7 | package socket 8 | 9 | func recvmmsg(s uintptr, hs []mmsghdr, flags int) (int, error) { 10 | return 0, errNotImplemented 11 | } 12 | 13 | func sendmmsg(s uintptr, hs []mmsghdr, flags int) (int, error) { 14 | return 0, errNotImplemented 15 | } 16 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/iovec_32bit.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build arm mips mipsle 386 6 | // +build darwin dragonfly freebsd linux netbsd openbsd 7 | 8 | package socket 9 | 10 | import "unsafe" 11 | 12 | func (v *iovec) set(b []byte) { 13 | l := len(b) 14 | if l == 0 { 15 | return 16 | } 17 | v.Base = (*byte)(unsafe.Pointer(&b[0])) 18 | v.Len = uint32(l) 19 | } 20 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/rawconn_nomsg.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !aix,!darwin,!dragonfly,!freebsd,!linux,!netbsd,!openbsd,!solaris,!windows 6 | 7 | package socket 8 | 9 | func (c *Conn) recvMsg(m *Message, flags int) error { 10 | return errNotImplemented 11 | } 12 | 13 | func (c *Conn) sendMsg(m *Message, flags int) error { 14 | return errNotImplemented 15 | } 16 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/ipv6/sys_asmreq_stub.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !aix,!darwin,!dragonfly,!freebsd,!linux,!netbsd,!openbsd,!solaris,!windows 6 | 7 | package ipv6 8 | 9 | import ( 10 | "net" 11 | 12 | "golang.org/x/net/internal/socket" 13 | ) 14 | 15 | func (so *sockOpt) setIPMreq(c *socket.Conn, ifi *net.Interface, grp net.IP) error { 16 | return errNotImplemented 17 | } 18 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/iovec_64bit.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build arm64 amd64 ppc64 ppc64le mips64 mips64le s390x 6 | // +build aix darwin dragonfly freebsd linux netbsd openbsd 7 | 8 | package socket 9 | 10 | import "unsafe" 11 | 12 | func (v *iovec) set(b []byte) { 13 | l := len(b) 14 | if l == 0 { 15 | return 16 | } 17 | v.Base = (*byte)(unsafe.Pointer(&b[0])) 18 | v.Len = uint64(l) 19 | } 20 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/cmsghdr_stub.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !aix,!darwin,!dragonfly,!freebsd,!linux,!netbsd,!openbsd,!solaris 6 | 7 | package socket 8 | 9 | type cmsghdr struct{} 10 | 11 | const sizeofCmsghdr = 0 12 | 13 | func (h *cmsghdr) len() int { return 0 } 14 | func (h *cmsghdr) lvl() int { return 0 } 15 | func (h *cmsghdr) typ() int { return 0 } 16 | 17 | func (h *cmsghdr) set(l, lvl, typ int) {} 18 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/ipv4/icmp_stub.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !linux 6 | 7 | package ipv4 8 | 9 | const sizeofICMPFilter = 0x0 10 | 11 | type icmpFilter struct { 12 | } 13 | 14 | func (f *icmpFilter) accept(typ ICMPType) { 15 | } 16 | 17 | func (f *icmpFilter) block(typ ICMPType) { 18 | } 19 | 20 | func (f *icmpFilter) setAll(block bool) { 21 | } 22 | 23 | func (f *icmpFilter) willBlock(typ ICMPType) bool { 24 | return false 25 | } 26 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/sys_bsdvar.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build aix freebsd netbsd openbsd 6 | 7 | package socket 8 | 9 | import ( 10 | "runtime" 11 | "unsafe" 12 | ) 13 | 14 | func probeProtocolStack() int { 15 | if (runtime.GOOS == "netbsd" || runtime.GOOS == "openbsd") && runtime.GOARCH == "arm" { 16 | return 8 17 | } 18 | if runtime.GOOS == "aix" { 19 | return 1 20 | } 21 | var p uintptr 22 | return int(unsafe.Sizeof(p)) 23 | } 24 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/ipv4/sys_asmreqn_stub.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !darwin,!freebsd,!linux 6 | 7 | package ipv4 8 | 9 | import ( 10 | "net" 11 | 12 | "golang.org/x/net/internal/socket" 13 | ) 14 | 15 | func (so *sockOpt) getIPMreqn(c *socket.Conn) (*net.Interface, error) { 16 | return nil, errNotImplemented 17 | } 18 | 19 | func (so *sockOpt) setIPMreqn(c *socket.Conn, ifi *net.Interface, grp net.IP) error { 20 | return errNotImplemented 21 | } 22 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/msghdr_linux_32bit.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build arm mips mipsle 386 6 | // +build linux 7 | 8 | package socket 9 | 10 | import "unsafe" 11 | 12 | func (h *msghdr) setIov(vs []iovec) { 13 | l := len(vs) 14 | if l == 0 { 15 | return 16 | } 17 | h.Iov = &vs[0] 18 | h.Iovlen = uint32(l) 19 | } 20 | 21 | func (h *msghdr) setControl(b []byte) { 22 | h.Control = (*byte)(unsafe.Pointer(&b[0])) 23 | h.Controllen = uint32(len(b)) 24 | } 25 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/ipv6/icmp_stub.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !aix,!darwin,!dragonfly,!freebsd,!linux,!netbsd,!openbsd,!solaris,!windows 6 | 7 | package ipv6 8 | 9 | type icmpv6Filter struct { 10 | } 11 | 12 | func (f *icmpv6Filter) accept(typ ICMPType) { 13 | } 14 | 15 | func (f *icmpv6Filter) block(typ ICMPType) { 16 | } 17 | 18 | func (f *icmpv6Filter) setAll(block bool) { 19 | } 20 | 21 | func (f *icmpv6Filter) willBlock(typ ICMPType) bool { 22 | return false 23 | } 24 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/ipv4/sys_ssmreq_stub.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !darwin,!freebsd,!linux,!solaris 6 | 7 | package ipv4 8 | 9 | import ( 10 | "net" 11 | 12 | "golang.org/x/net/internal/socket" 13 | ) 14 | 15 | func (so *sockOpt) setGroupReq(c *socket.Conn, ifi *net.Interface, grp net.IP) error { 16 | return errNotImplemented 17 | } 18 | 19 | func (so *sockOpt) setGroupSourceReq(c *socket.Conn, ifi *net.Interface, grp, src net.IP) error { 20 | return errNotImplemented 21 | } 22 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/ipv6/icmp_windows.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package ipv6 6 | 7 | func (f *icmpv6Filter) accept(typ ICMPType) { 8 | // TODO(mikio): implement this 9 | } 10 | 11 | func (f *icmpv6Filter) block(typ ICMPType) { 12 | // TODO(mikio): implement this 13 | } 14 | 15 | func (f *icmpv6Filter) setAll(block bool) { 16 | // TODO(mikio): implement this 17 | } 18 | 19 | func (f *icmpv6Filter) willBlock(typ ICMPType) bool { 20 | // TODO(mikio): implement this 21 | return false 22 | } 23 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/ipv6/sys_ssmreq_stub.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !aix,!darwin,!freebsd,!linux,!solaris 6 | 7 | package ipv6 8 | 9 | import ( 10 | "net" 11 | 12 | "golang.org/x/net/internal/socket" 13 | ) 14 | 15 | func (so *sockOpt) setGroupReq(c *socket.Conn, ifi *net.Interface, grp net.IP) error { 16 | return errNotImplemented 17 | } 18 | 19 | func (so *sockOpt) setGroupSourceReq(c *socket.Conn, ifi *net.Interface, grp, src net.IP) error { 20 | return errNotImplemented 21 | } 22 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/msghdr_linux_64bit.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build arm64 amd64 ppc64 ppc64le mips64 mips64le s390x 6 | // +build linux 7 | 8 | package socket 9 | 10 | import "unsafe" 11 | 12 | func (h *msghdr) setIov(vs []iovec) { 13 | l := len(vs) 14 | if l == 0 { 15 | return 16 | } 17 | h.Iov = &vs[0] 18 | h.Iovlen = uint64(l) 19 | } 20 | 21 | func (h *msghdr) setControl(b []byte) { 22 | h.Control = (*byte)(unsafe.Pointer(&b[0])) 23 | h.Controllen = uint64(len(b)) 24 | } 25 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/mmsghdr_stub.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !aix,!linux,!netbsd 6 | 7 | package socket 8 | 9 | import "net" 10 | 11 | type mmsghdr struct{} 12 | 13 | type mmsghdrs []mmsghdr 14 | 15 | func (hs mmsghdrs) pack(ms []Message, parseFn func([]byte, string) (net.Addr, error), marshalFn func(net.Addr) []byte) error { 16 | return nil 17 | } 18 | 19 | func (hs mmsghdrs) unpack(ms []Message, parseFn func([]byte, string) (net.Addr, error), hint string) error { 20 | return nil 21 | } 22 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/icmp/ipv6.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package icmp 6 | 7 | import ( 8 | "net" 9 | 10 | "golang.org/x/net/internal/iana" 11 | ) 12 | 13 | const ipv6PseudoHeaderLen = 2*net.IPv6len + 8 14 | 15 | // IPv6PseudoHeader returns an IPv6 pseudo header for checksum 16 | // calculation. 17 | func IPv6PseudoHeader(src, dst net.IP) []byte { 18 | b := make([]byte, ipv6PseudoHeaderLen) 19 | copy(b, src.To16()) 20 | copy(b[net.IPv6len:], dst.To16()) 21 | b[len(b)-1] = byte(iana.ProtocolIPv6ICMP) 22 | return b 23 | } 24 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/ipv4/icmp_linux.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package ipv4 6 | 7 | func (f *icmpFilter) accept(typ ICMPType) { 8 | f.Data &^= 1 << (uint32(typ) & 31) 9 | } 10 | 11 | func (f *icmpFilter) block(typ ICMPType) { 12 | f.Data |= 1 << (uint32(typ) & 31) 13 | } 14 | 15 | func (f *icmpFilter) setAll(block bool) { 16 | if block { 17 | f.Data = 1<<32 - 1 18 | } else { 19 | f.Data = 0 20 | } 21 | } 22 | 23 | func (f *icmpFilter) willBlock(typ ICMPType) bool { 24 | return f.Data&(1<<(uint32(typ)&31)) != 0 25 | } 26 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/ipv4/sys_bpf.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build linux 6 | 7 | package ipv4 8 | 9 | import ( 10 | "unsafe" 11 | 12 | "golang.org/x/net/bpf" 13 | "golang.org/x/net/internal/socket" 14 | ) 15 | 16 | func (so *sockOpt) setAttachFilter(c *socket.Conn, f []bpf.RawInstruction) error { 17 | prog := sockFProg{ 18 | Len: uint16(len(f)), 19 | Filter: (*sockFilter)(unsafe.Pointer(&f[0])), 20 | } 21 | b := (*[sizeofSockFprog]byte)(unsafe.Pointer(&prog))[:sizeofSockFprog] 22 | return so.Set(c, b) 23 | } 24 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/ipv6/sys_bpf.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build linux 6 | 7 | package ipv6 8 | 9 | import ( 10 | "unsafe" 11 | 12 | "golang.org/x/net/bpf" 13 | "golang.org/x/net/internal/socket" 14 | ) 15 | 16 | func (so *sockOpt) setAttachFilter(c *socket.Conn, f []bpf.RawInstruction) error { 17 | prog := sockFProg{ 18 | Len: uint16(len(f)), 19 | Filter: (*sockFilter)(unsafe.Pointer(&f[0])), 20 | } 21 | b := (*[sizeofSockFprog]byte)(unsafe.Pointer(&prog))[:sizeofSockFprog] 22 | return so.Set(c, b) 23 | } 24 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/msghdr_stub.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !aix,!darwin,!dragonfly,!freebsd,!linux,!netbsd,!openbsd,!solaris 6 | 7 | package socket 8 | 9 | type msghdr struct{} 10 | 11 | func (h *msghdr) pack(vs []iovec, bs [][]byte, oob []byte, sa []byte) {} 12 | func (h *msghdr) name() []byte { return nil } 13 | func (h *msghdr) controllen() int { return 0 } 14 | func (h *msghdr) flags() int { return 0 } 15 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/ipv4/payload.go: -------------------------------------------------------------------------------- 1 | // Copyright 2012 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package ipv4 6 | 7 | import ( 8 | "net" 9 | 10 | "golang.org/x/net/internal/socket" 11 | ) 12 | 13 | // BUG(mikio): On Windows, the ControlMessage for ReadFrom and WriteTo 14 | // methods of PacketConn is not implemented. 15 | 16 | // A payloadHandler represents the IPv4 datagram payload handler. 17 | type payloadHandler struct { 18 | net.PacketConn 19 | *socket.Conn 20 | rawOpt 21 | } 22 | 23 | func (c *payloadHandler) ok() bool { return c != nil && c.PacketConn != nil && c.Conn != nil } 24 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/ipv6/payload.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package ipv6 6 | 7 | import ( 8 | "net" 9 | 10 | "golang.org/x/net/internal/socket" 11 | ) 12 | 13 | // BUG(mikio): On Windows, the ControlMessage for ReadFrom and WriteTo 14 | // methods of PacketConn is not implemented. 15 | 16 | // A payloadHandler represents the IPv6 datagram payload handler. 17 | type payloadHandler struct { 18 | net.PacketConn 19 | *socket.Conn 20 | rawOpt 21 | } 22 | 23 | func (c *payloadHandler) ok() bool { return c != nil && c.PacketConn != nil && c.Conn != nil } 24 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/ipv6/sys_asmreq.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build aix darwin dragonfly freebsd linux netbsd openbsd solaris windows 6 | 7 | package ipv6 8 | 9 | import ( 10 | "net" 11 | "unsafe" 12 | 13 | "golang.org/x/net/internal/socket" 14 | ) 15 | 16 | func (so *sockOpt) setIPMreq(c *socket.Conn, ifi *net.Interface, grp net.IP) error { 17 | var mreq ipv6Mreq 18 | copy(mreq.Multiaddr[:], grp) 19 | if ifi != nil { 20 | mreq.setIfindex(ifi.Index) 21 | } 22 | b := (*[sizeofIPv6Mreq]byte)(unsafe.Pointer(&mreq))[:sizeofIPv6Mreq] 23 | return so.Set(c, b) 24 | } 25 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/error_windows.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package socket 6 | 7 | import "syscall" 8 | 9 | var ( 10 | errERROR_IO_PENDING error = syscall.ERROR_IO_PENDING 11 | errEINVAL error = syscall.EINVAL 12 | ) 13 | 14 | // errnoErr returns common boxed Errno values, to prevent allocations 15 | // at runtime. 16 | func errnoErr(errno syscall.Errno) error { 17 | switch errno { 18 | case 0: 19 | return nil 20 | case syscall.ERROR_IO_PENDING: 21 | return errERROR_IO_PENDING 22 | case syscall.EINVAL: 23 | return errEINVAL 24 | } 25 | return errno 26 | } 27 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/ipv6/icmp_linux.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package ipv6 6 | 7 | func (f *icmpv6Filter) accept(typ ICMPType) { 8 | f.Data[typ>>5] &^= 1 << (uint32(typ) & 31) 9 | } 10 | 11 | func (f *icmpv6Filter) block(typ ICMPType) { 12 | f.Data[typ>>5] |= 1 << (uint32(typ) & 31) 13 | } 14 | 15 | func (f *icmpv6Filter) setAll(block bool) { 16 | for i := range f.Data { 17 | if block { 18 | f.Data[i] = 1<<32 - 1 19 | } else { 20 | f.Data[i] = 0 21 | } 22 | } 23 | } 24 | 25 | func (f *icmpv6Filter) willBlock(typ ICMPType) bool { 26 | return f.Data[typ>>5]&(1<<(uint32(typ)&31)) != 0 27 | } 28 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/ipv4/zsys_netbsd.go: -------------------------------------------------------------------------------- 1 | // Created by cgo -godefs - DO NOT EDIT 2 | // cgo -godefs defs_netbsd.go 3 | 4 | package ipv4 5 | 6 | const ( 7 | sysIP_OPTIONS = 0x1 8 | sysIP_HDRINCL = 0x2 9 | sysIP_TOS = 0x3 10 | sysIP_TTL = 0x4 11 | sysIP_RECVOPTS = 0x5 12 | sysIP_RECVRETOPTS = 0x6 13 | sysIP_RECVDSTADDR = 0x7 14 | sysIP_RETOPTS = 0x8 15 | sysIP_RECVIF = 0x14 16 | sysIP_RECVTTL = 0x17 17 | 18 | sysIP_MULTICAST_IF = 0x9 19 | sysIP_MULTICAST_TTL = 0xa 20 | sysIP_MULTICAST_LOOP = 0xb 21 | sysIP_ADD_MEMBERSHIP = 0xc 22 | sysIP_DROP_MEMBERSHIP = 0xd 23 | 24 | sizeofIPMreq = 0x8 25 | ) 26 | 27 | type ipMreq struct { 28 | Multiaddr [4]byte /* in_addr */ 29 | Interface [4]byte /* in_addr */ 30 | } 31 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/ipv4/zsys_openbsd.go: -------------------------------------------------------------------------------- 1 | // Created by cgo -godefs - DO NOT EDIT 2 | // cgo -godefs defs_openbsd.go 3 | 4 | package ipv4 5 | 6 | const ( 7 | sysIP_OPTIONS = 0x1 8 | sysIP_HDRINCL = 0x2 9 | sysIP_TOS = 0x3 10 | sysIP_TTL = 0x4 11 | sysIP_RECVOPTS = 0x5 12 | sysIP_RECVRETOPTS = 0x6 13 | sysIP_RECVDSTADDR = 0x7 14 | sysIP_RETOPTS = 0x8 15 | sysIP_RECVIF = 0x1e 16 | sysIP_RECVTTL = 0x1f 17 | 18 | sysIP_MULTICAST_IF = 0x9 19 | sysIP_MULTICAST_TTL = 0xa 20 | sysIP_MULTICAST_LOOP = 0xb 21 | sysIP_ADD_MEMBERSHIP = 0xc 22 | sysIP_DROP_MEMBERSHIP = 0xd 23 | 24 | sizeofIPMreq = 0x8 25 | ) 26 | 27 | type ipMreq struct { 28 | Multiaddr [4]byte /* in_addr */ 29 | Interface [4]byte /* in_addr */ 30 | } 31 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/ipv4/sys_asmreq_stub.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !aix,!darwin,!dragonfly,!freebsd,!netbsd,!openbsd,!solaris,!windows 6 | 7 | package ipv4 8 | 9 | import ( 10 | "net" 11 | 12 | "golang.org/x/net/internal/socket" 13 | ) 14 | 15 | func (so *sockOpt) setIPMreq(c *socket.Conn, ifi *net.Interface, grp net.IP) error { 16 | return errNotImplemented 17 | } 18 | 19 | func (so *sockOpt) getMulticastIf(c *socket.Conn) (*net.Interface, error) { 20 | return nil, errNotImplemented 21 | } 22 | 23 | func (so *sockOpt) setMulticastIf(c *socket.Conn, ifi *net.Interface) error { 24 | return errNotImplemented 25 | } 26 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/ipv4/zsys_dragonfly.go: -------------------------------------------------------------------------------- 1 | // Created by cgo -godefs - DO NOT EDIT 2 | // cgo -godefs defs_dragonfly.go 3 | 4 | package ipv4 5 | 6 | const ( 7 | sysIP_OPTIONS = 0x1 8 | sysIP_HDRINCL = 0x2 9 | sysIP_TOS = 0x3 10 | sysIP_TTL = 0x4 11 | sysIP_RECVOPTS = 0x5 12 | sysIP_RECVRETOPTS = 0x6 13 | sysIP_RECVDSTADDR = 0x7 14 | sysIP_RETOPTS = 0x8 15 | sysIP_RECVIF = 0x14 16 | sysIP_RECVTTL = 0x41 17 | 18 | sysIP_MULTICAST_IF = 0x9 19 | sysIP_MULTICAST_TTL = 0xa 20 | sysIP_MULTICAST_LOOP = 0xb 21 | sysIP_MULTICAST_VIF = 0xe 22 | sysIP_ADD_MEMBERSHIP = 0xc 23 | sysIP_DROP_MEMBERSHIP = 0xd 24 | 25 | sizeofIPMreq = 0x8 26 | ) 27 | 28 | type ipMreq struct { 29 | Multiaddr [4]byte /* in_addr */ 30 | Interface [4]byte /* in_addr */ 31 | } 32 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/ipv6/icmp_solaris.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package ipv6 6 | 7 | func (f *icmpv6Filter) accept(typ ICMPType) { 8 | f.X__icmp6_filt[typ>>5] |= 1 << (uint32(typ) & 31) 9 | } 10 | 11 | func (f *icmpv6Filter) block(typ ICMPType) { 12 | f.X__icmp6_filt[typ>>5] &^= 1 << (uint32(typ) & 31) 13 | } 14 | 15 | func (f *icmpv6Filter) setAll(block bool) { 16 | for i := range f.X__icmp6_filt { 17 | if block { 18 | f.X__icmp6_filt[i] = 0 19 | } else { 20 | f.X__icmp6_filt[i] = 1<<32 - 1 21 | } 22 | } 23 | } 24 | 25 | func (f *icmpv6Filter) willBlock(typ ICMPType) bool { 26 | return f.X__icmp6_filt[typ>>5]&(1<<(uint32(typ)&31)) == 0 27 | } 28 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/sys.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package socket 6 | 7 | import ( 8 | "encoding/binary" 9 | "unsafe" 10 | ) 11 | 12 | var ( 13 | // NativeEndian is the machine native endian implementation of 14 | // ByteOrder. 15 | NativeEndian binary.ByteOrder 16 | 17 | kernelAlign int 18 | ) 19 | 20 | func init() { 21 | i := uint32(1) 22 | b := (*[4]byte)(unsafe.Pointer(&i)) 23 | if b[0] == 1 { 24 | NativeEndian = binary.LittleEndian 25 | } else { 26 | NativeEndian = binary.BigEndian 27 | } 28 | kernelAlign = probeProtocolStack() 29 | } 30 | 31 | func roundup(l int) int { 32 | return (l + kernelAlign - 1) &^ (kernelAlign - 1) 33 | } 34 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/ipv6/icmp_bsd.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build aix darwin dragonfly freebsd netbsd openbsd 6 | 7 | package ipv6 8 | 9 | func (f *icmpv6Filter) accept(typ ICMPType) { 10 | f.Filt[typ>>5] |= 1 << (uint32(typ) & 31) 11 | } 12 | 13 | func (f *icmpv6Filter) block(typ ICMPType) { 14 | f.Filt[typ>>5] &^= 1 << (uint32(typ) & 31) 15 | } 16 | 17 | func (f *icmpv6Filter) setAll(block bool) { 18 | for i := range f.Filt { 19 | if block { 20 | f.Filt[i] = 0 21 | } else { 22 | f.Filt[i] = 1<<32 - 1 23 | } 24 | } 25 | } 26 | 27 | func (f *icmpv6Filter) willBlock(typ ICMPType) bool { 28 | return f.Filt[typ>>5]&(1<<(uint32(typ)&31)) == 0 29 | } 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/ipv4/zsys_aix_ppc64.go: -------------------------------------------------------------------------------- 1 | // Code generated by cmd/cgo -godefs; DO NOT EDIT. 2 | // cgo -godefs defs_aix.go 3 | 4 | // Added for go1.11 compatibility 5 | // +build aix 6 | 7 | package ipv4 8 | 9 | const ( 10 | sysIP_OPTIONS = 0x1 11 | sysIP_HDRINCL = 0x2 12 | sysIP_TOS = 0x3 13 | sysIP_TTL = 0x4 14 | sysIP_RECVOPTS = 0x5 15 | sysIP_RECVRETOPTS = 0x6 16 | sysIP_RECVDSTADDR = 0x7 17 | sysIP_RETOPTS = 0x8 18 | sysIP_RECVIF = 0x20 19 | sysIP_RECVTTL = 0x22 20 | 21 | sysIP_MULTICAST_IF = 0x9 22 | sysIP_MULTICAST_TTL = 0xa 23 | sysIP_MULTICAST_LOOP = 0xb 24 | sysIP_ADD_MEMBERSHIP = 0xc 25 | sysIP_DROP_MEMBERSHIP = 0xd 26 | 27 | sizeofIPMreq = 0x8 28 | ) 29 | 30 | type ipMreq struct { 31 | Multiaddr [4]byte /* in_addr */ 32 | Interface [4]byte /* in_addr */ 33 | } 34 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/sys_netbsd.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package socket 6 | 7 | import ( 8 | "syscall" 9 | "unsafe" 10 | ) 11 | 12 | const ( 13 | sysRECVMMSG = 0x1db 14 | sysSENDMMSG = 0x1dc 15 | ) 16 | 17 | func recvmmsg(s uintptr, hs []mmsghdr, flags int) (int, error) { 18 | n, _, errno := syscall.Syscall6(sysRECVMMSG, s, uintptr(unsafe.Pointer(&hs[0])), uintptr(len(hs)), uintptr(flags), 0, 0) 19 | return int(n), errnoErr(errno) 20 | } 21 | 22 | func sendmmsg(s uintptr, hs []mmsghdr, flags int) (int, error) { 23 | n, _, errno := syscall.Syscall6(sysSENDMMSG, s, uintptr(unsafe.Pointer(&hs[0])), uintptr(len(hs)), uintptr(flags), 0, 0) 24 | return int(n), errnoErr(errno) 25 | } 26 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/error_unix.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build aix darwin dragonfly freebsd linux netbsd openbsd solaris 6 | 7 | package socket 8 | 9 | import "syscall" 10 | 11 | var ( 12 | errEAGAIN error = syscall.EAGAIN 13 | errEINVAL error = syscall.EINVAL 14 | errENOENT error = syscall.ENOENT 15 | ) 16 | 17 | // errnoErr returns common boxed Errno values, to prevent allocations 18 | // at runtime. 19 | func errnoErr(errno syscall.Errno) error { 20 | switch errno { 21 | case 0: 22 | return nil 23 | case syscall.EAGAIN: 24 | return errEAGAIN 25 | case syscall.EINVAL: 26 | return errEINVAL 27 | case syscall.ENOENT: 28 | return errENOENT 29 | } 30 | return errno 31 | } 32 | -------------------------------------------------------------------------------- /main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "time" 6 | 7 | "github.com/ylwang1122/go-mtr/mtr" 8 | "github.com/ylwang1122/go-mtr/ping" 9 | ) 10 | 11 | var targets = []string{"216.58.200.78", "52.74.223.119", "123.125.114.144"} 12 | 13 | func main() { 14 | // 发起mtr操作 15 | for _, val := range targets { 16 | go func(target string) { 17 | for { 18 | mm, err := mtr.Mtr(target, 30, 10, 800) 19 | if err != nil { 20 | fmt.Println(err) 21 | } 22 | fmt.Println(mm) 23 | 24 | time.Sleep(60 * time.Second) 25 | } 26 | }(val) 27 | } 28 | 29 | // 发起ping操作 30 | for _, val := range targets { 31 | go func(target string) { 32 | for { 33 | mm, err := ping.Ping(target, 10, 800, 10) 34 | if err != nil { 35 | fmt.Println(err) 36 | } 37 | fmt.Println(mm) 38 | 39 | time.Sleep(60 * time.Second) 40 | } 41 | }(val) 42 | } 43 | 44 | select {} 45 | } 46 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/sys_linux.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build linux,!s390x,!386 6 | 7 | package socket 8 | 9 | import ( 10 | "syscall" 11 | "unsafe" 12 | ) 13 | 14 | func probeProtocolStack() int { 15 | var p uintptr 16 | return int(unsafe.Sizeof(p)) 17 | } 18 | 19 | func recvmmsg(s uintptr, hs []mmsghdr, flags int) (int, error) { 20 | n, _, errno := syscall.Syscall6(sysRECVMMSG, s, uintptr(unsafe.Pointer(&hs[0])), uintptr(len(hs)), uintptr(flags), 0, 0) 21 | return int(n), errnoErr(errno) 22 | } 23 | 24 | func sendmmsg(s uintptr, hs []mmsghdr, flags int) (int, error) { 25 | n, _, errno := syscall.Syscall6(sysSENDMMSG, s, uintptr(unsafe.Pointer(&hs[0])), uintptr(len(hs)), uintptr(flags), 0, 0) 26 | return int(n), errnoErr(errno) 27 | } 28 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/msghdr_linux.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package socket 6 | 7 | import "unsafe" 8 | 9 | func (h *msghdr) pack(vs []iovec, bs [][]byte, oob []byte, sa []byte) { 10 | for i := range vs { 11 | vs[i].set(bs[i]) 12 | } 13 | h.setIov(vs) 14 | if len(oob) > 0 { 15 | h.setControl(oob) 16 | } 17 | if sa != nil { 18 | h.Name = (*byte)(unsafe.Pointer(&sa[0])) 19 | h.Namelen = uint32(len(sa)) 20 | } 21 | } 22 | 23 | func (h *msghdr) name() []byte { 24 | if h.Name != nil && h.Namelen > 0 { 25 | return (*[sizeofSockaddrInet6]byte)(unsafe.Pointer(h.Name))[:h.Namelen] 26 | } 27 | return nil 28 | } 29 | 30 | func (h *msghdr) controllen() int { 31 | return int(h.Controllen) 32 | } 33 | 34 | func (h *msghdr) flags() int { 35 | return int(h.Flags) 36 | } 37 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/msghdr_solaris_64bit.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build amd64 6 | // +build solaris 7 | 8 | package socket 9 | 10 | import "unsafe" 11 | 12 | func (h *msghdr) pack(vs []iovec, bs [][]byte, oob []byte, sa []byte) { 13 | for i := range vs { 14 | vs[i].set(bs[i]) 15 | } 16 | if len(vs) > 0 { 17 | h.Iov = &vs[0] 18 | h.Iovlen = int32(len(vs)) 19 | } 20 | if len(oob) > 0 { 21 | h.Accrights = (*int8)(unsafe.Pointer(&oob[0])) 22 | h.Accrightslen = int32(len(oob)) 23 | } 24 | if sa != nil { 25 | h.Name = (*byte)(unsafe.Pointer(&sa[0])) 26 | h.Namelen = uint32(len(sa)) 27 | } 28 | } 29 | 30 | func (h *msghdr) controllen() int { 31 | return int(h.Accrightslen) 32 | } 33 | 34 | func (h *msghdr) flags() int { 35 | return int(NativeEndian.Uint32(h.Pad_cgo_2[:])) 36 | } 37 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/msghdr_bsd.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build aix darwin dragonfly freebsd netbsd openbsd 6 | 7 | package socket 8 | 9 | import "unsafe" 10 | 11 | func (h *msghdr) pack(vs []iovec, bs [][]byte, oob []byte, sa []byte) { 12 | for i := range vs { 13 | vs[i].set(bs[i]) 14 | } 15 | h.setIov(vs) 16 | if len(oob) > 0 { 17 | h.Control = (*byte)(unsafe.Pointer(&oob[0])) 18 | h.Controllen = uint32(len(oob)) 19 | } 20 | if sa != nil { 21 | h.Name = (*byte)(unsafe.Pointer(&sa[0])) 22 | h.Namelen = uint32(len(sa)) 23 | } 24 | } 25 | 26 | func (h *msghdr) name() []byte { 27 | if h.Name != nil && h.Namelen > 0 { 28 | return (*[sizeofSockaddrInet6]byte)(unsafe.Pointer(h.Name))[:h.Namelen] 29 | } 30 | return nil 31 | } 32 | 33 | func (h *msghdr) controllen() int { 34 | return int(h.Controllen) 35 | } 36 | 37 | func (h *msghdr) flags() int { 38 | return int(h.Flags) 39 | } 40 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/ipv4/defs_netbsd.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build ignore 6 | 7 | // +godefs map struct_in_addr [4]byte /* in_addr */ 8 | 9 | package ipv4 10 | 11 | /* 12 | #include 13 | */ 14 | import "C" 15 | 16 | const ( 17 | sysIP_OPTIONS = C.IP_OPTIONS 18 | sysIP_HDRINCL = C.IP_HDRINCL 19 | sysIP_TOS = C.IP_TOS 20 | sysIP_TTL = C.IP_TTL 21 | sysIP_RECVOPTS = C.IP_RECVOPTS 22 | sysIP_RECVRETOPTS = C.IP_RECVRETOPTS 23 | sysIP_RECVDSTADDR = C.IP_RECVDSTADDR 24 | sysIP_RETOPTS = C.IP_RETOPTS 25 | sysIP_RECVIF = C.IP_RECVIF 26 | sysIP_RECVTTL = C.IP_RECVTTL 27 | 28 | sysIP_MULTICAST_IF = C.IP_MULTICAST_IF 29 | sysIP_MULTICAST_TTL = C.IP_MULTICAST_TTL 30 | sysIP_MULTICAST_LOOP = C.IP_MULTICAST_LOOP 31 | sysIP_ADD_MEMBERSHIP = C.IP_ADD_MEMBERSHIP 32 | sysIP_DROP_MEMBERSHIP = C.IP_DROP_MEMBERSHIP 33 | 34 | sizeofIPMreq = C.sizeof_struct_ip_mreq 35 | ) 36 | 37 | type ipMreq C.struct_ip_mreq 38 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/ipv4/defs_openbsd.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build ignore 6 | 7 | // +godefs map struct_in_addr [4]byte /* in_addr */ 8 | 9 | package ipv4 10 | 11 | /* 12 | #include 13 | */ 14 | import "C" 15 | 16 | const ( 17 | sysIP_OPTIONS = C.IP_OPTIONS 18 | sysIP_HDRINCL = C.IP_HDRINCL 19 | sysIP_TOS = C.IP_TOS 20 | sysIP_TTL = C.IP_TTL 21 | sysIP_RECVOPTS = C.IP_RECVOPTS 22 | sysIP_RECVRETOPTS = C.IP_RECVRETOPTS 23 | sysIP_RECVDSTADDR = C.IP_RECVDSTADDR 24 | sysIP_RETOPTS = C.IP_RETOPTS 25 | sysIP_RECVIF = C.IP_RECVIF 26 | sysIP_RECVTTL = C.IP_RECVTTL 27 | 28 | sysIP_MULTICAST_IF = C.IP_MULTICAST_IF 29 | sysIP_MULTICAST_TTL = C.IP_MULTICAST_TTL 30 | sysIP_MULTICAST_LOOP = C.IP_MULTICAST_LOOP 31 | sysIP_ADD_MEMBERSHIP = C.IP_ADD_MEMBERSHIP 32 | sysIP_DROP_MEMBERSHIP = C.IP_DROP_MEMBERSHIP 33 | 34 | sizeofIPMreq = C.sizeof_struct_ip_mreq 35 | ) 36 | 37 | type ipMreq C.struct_ip_mreq 38 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/defs_darwin.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build ignore 6 | 7 | // +godefs map struct_in_addr [4]byte /* in_addr */ 8 | // +godefs map struct_in6_addr [16]byte /* in6_addr */ 9 | 10 | package socket 11 | 12 | /* 13 | #include 14 | 15 | #include 16 | */ 17 | import "C" 18 | 19 | const ( 20 | sysAF_UNSPEC = C.AF_UNSPEC 21 | sysAF_INET = C.AF_INET 22 | sysAF_INET6 = C.AF_INET6 23 | 24 | sysSOCK_RAW = C.SOCK_RAW 25 | ) 26 | 27 | type iovec C.struct_iovec 28 | 29 | type msghdr C.struct_msghdr 30 | 31 | type cmsghdr C.struct_cmsghdr 32 | 33 | type sockaddrInet C.struct_sockaddr_in 34 | 35 | type sockaddrInet6 C.struct_sockaddr_in6 36 | 37 | const ( 38 | sizeofIovec = C.sizeof_struct_iovec 39 | sizeofMsghdr = C.sizeof_struct_msghdr 40 | sizeofCmsghdr = C.sizeof_struct_cmsghdr 41 | 42 | sizeofSockaddrInet = C.sizeof_struct_sockaddr_in 43 | sizeofSockaddrInet6 = C.sizeof_struct_sockaddr_in6 44 | ) 45 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/defs_freebsd.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build ignore 6 | 7 | // +godefs map struct_in_addr [4]byte /* in_addr */ 8 | // +godefs map struct_in6_addr [16]byte /* in6_addr */ 9 | 10 | package socket 11 | 12 | /* 13 | #include 14 | 15 | #include 16 | */ 17 | import "C" 18 | 19 | const ( 20 | sysAF_UNSPEC = C.AF_UNSPEC 21 | sysAF_INET = C.AF_INET 22 | sysAF_INET6 = C.AF_INET6 23 | 24 | sysSOCK_RAW = C.SOCK_RAW 25 | ) 26 | 27 | type iovec C.struct_iovec 28 | 29 | type msghdr C.struct_msghdr 30 | 31 | type cmsghdr C.struct_cmsghdr 32 | 33 | type sockaddrInet C.struct_sockaddr_in 34 | 35 | type sockaddrInet6 C.struct_sockaddr_in6 36 | 37 | const ( 38 | sizeofIovec = C.sizeof_struct_iovec 39 | sizeofMsghdr = C.sizeof_struct_msghdr 40 | sizeofCmsghdr = C.sizeof_struct_cmsghdr 41 | 42 | sizeofSockaddrInet = C.sizeof_struct_sockaddr_in 43 | sizeofSockaddrInet6 = C.sizeof_struct_sockaddr_in6 44 | ) 45 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/defs_openbsd.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build ignore 6 | 7 | // +godefs map struct_in_addr [4]byte /* in_addr */ 8 | // +godefs map struct_in6_addr [16]byte /* in6_addr */ 9 | 10 | package socket 11 | 12 | /* 13 | #include 14 | 15 | #include 16 | */ 17 | import "C" 18 | 19 | const ( 20 | sysAF_UNSPEC = C.AF_UNSPEC 21 | sysAF_INET = C.AF_INET 22 | sysAF_INET6 = C.AF_INET6 23 | 24 | sysSOCK_RAW = C.SOCK_RAW 25 | ) 26 | 27 | type iovec C.struct_iovec 28 | 29 | type msghdr C.struct_msghdr 30 | 31 | type cmsghdr C.struct_cmsghdr 32 | 33 | type sockaddrInet C.struct_sockaddr_in 34 | 35 | type sockaddrInet6 C.struct_sockaddr_in6 36 | 37 | const ( 38 | sizeofIovec = C.sizeof_struct_iovec 39 | sizeofMsghdr = C.sizeof_struct_msghdr 40 | sizeofCmsghdr = C.sizeof_struct_cmsghdr 41 | 42 | sizeofSockaddrInet = C.sizeof_struct_sockaddr_in 43 | sizeofSockaddrInet6 = C.sizeof_struct_sockaddr_in6 44 | ) 45 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/defs_solaris.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build ignore 6 | 7 | // +godefs map struct_in_addr [4]byte /* in_addr */ 8 | // +godefs map struct_in6_addr [16]byte /* in6_addr */ 9 | 10 | package socket 11 | 12 | /* 13 | #include 14 | 15 | #include 16 | */ 17 | import "C" 18 | 19 | const ( 20 | sysAF_UNSPEC = C.AF_UNSPEC 21 | sysAF_INET = C.AF_INET 22 | sysAF_INET6 = C.AF_INET6 23 | 24 | sysSOCK_RAW = C.SOCK_RAW 25 | ) 26 | 27 | type iovec C.struct_iovec 28 | 29 | type msghdr C.struct_msghdr 30 | 31 | type cmsghdr C.struct_cmsghdr 32 | 33 | type sockaddrInet C.struct_sockaddr_in 34 | 35 | type sockaddrInet6 C.struct_sockaddr_in6 36 | 37 | const ( 38 | sizeofIovec = C.sizeof_struct_iovec 39 | sizeofMsghdr = C.sizeof_struct_msghdr 40 | sizeofCmsghdr = C.sizeof_struct_cmsghdr 41 | 42 | sizeofSockaddrInet = C.sizeof_struct_sockaddr_in 43 | sizeofSockaddrInet6 = C.sizeof_struct_sockaddr_in6 44 | ) 45 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/defs_dragonfly.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build ignore 6 | 7 | // +godefs map struct_in_addr [4]byte /* in_addr */ 8 | // +godefs map struct_in6_addr [16]byte /* in6_addr */ 9 | 10 | package socket 11 | 12 | /* 13 | #include 14 | 15 | #include 16 | */ 17 | import "C" 18 | 19 | const ( 20 | sysAF_UNSPEC = C.AF_UNSPEC 21 | sysAF_INET = C.AF_INET 22 | sysAF_INET6 = C.AF_INET6 23 | 24 | sysSOCK_RAW = C.SOCK_RAW 25 | ) 26 | 27 | type iovec C.struct_iovec 28 | 29 | type msghdr C.struct_msghdr 30 | 31 | type cmsghdr C.struct_cmsghdr 32 | 33 | type sockaddrInet C.struct_sockaddr_in 34 | 35 | type sockaddrInet6 C.struct_sockaddr_in6 36 | 37 | const ( 38 | sizeofIovec = C.sizeof_struct_iovec 39 | sizeofMsghdr = C.sizeof_struct_msghdr 40 | sizeofCmsghdr = C.sizeof_struct_cmsghdr 41 | 42 | sizeofSockaddrInet = C.sizeof_struct_sockaddr_in 43 | sizeofSockaddrInet6 = C.sizeof_struct_sockaddr_in6 44 | ) 45 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/ipv4/control_pktinfo.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build darwin linux solaris 6 | 7 | package ipv4 8 | 9 | import ( 10 | "net" 11 | "unsafe" 12 | 13 | "golang.org/x/net/internal/iana" 14 | "golang.org/x/net/internal/socket" 15 | ) 16 | 17 | func marshalPacketInfo(b []byte, cm *ControlMessage) []byte { 18 | m := socket.ControlMessage(b) 19 | m.MarshalHeader(iana.ProtocolIP, sysIP_PKTINFO, sizeofInetPktinfo) 20 | if cm != nil { 21 | pi := (*inetPktinfo)(unsafe.Pointer(&m.Data(sizeofInetPktinfo)[0])) 22 | if ip := cm.Src.To4(); ip != nil { 23 | copy(pi.Spec_dst[:], ip) 24 | } 25 | if cm.IfIndex > 0 { 26 | pi.setIfindex(cm.IfIndex) 27 | } 28 | } 29 | return m.Next(sizeofInetPktinfo) 30 | } 31 | 32 | func parsePacketInfo(cm *ControlMessage, b []byte) { 33 | pi := (*inetPktinfo)(unsafe.Pointer(&b[0])) 34 | cm.IfIndex = int(pi.Ifindex) 35 | if len(cm.Dst) < net.IPv4len { 36 | cm.Dst = make(net.IP, net.IPv4len) 37 | } 38 | copy(cm.Dst, pi.Addr[:]) 39 | } 40 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/zsys_darwin_386.go: -------------------------------------------------------------------------------- 1 | // Created by cgo -godefs - DO NOT EDIT 2 | // cgo -godefs defs_darwin.go 3 | 4 | package socket 5 | 6 | const ( 7 | sysAF_UNSPEC = 0x0 8 | sysAF_INET = 0x2 9 | sysAF_INET6 = 0x1e 10 | 11 | sysSOCK_RAW = 0x3 12 | ) 13 | 14 | type iovec struct { 15 | Base *byte 16 | Len uint32 17 | } 18 | 19 | type msghdr struct { 20 | Name *byte 21 | Namelen uint32 22 | Iov *iovec 23 | Iovlen int32 24 | Control *byte 25 | Controllen uint32 26 | Flags int32 27 | } 28 | 29 | type cmsghdr struct { 30 | Len uint32 31 | Level int32 32 | Type int32 33 | } 34 | 35 | type sockaddrInet struct { 36 | Len uint8 37 | Family uint8 38 | Port uint16 39 | Addr [4]byte /* in_addr */ 40 | Zero [8]int8 41 | } 42 | 43 | type sockaddrInet6 struct { 44 | Len uint8 45 | Family uint8 46 | Port uint16 47 | Flowinfo uint32 48 | Addr [16]byte /* in6_addr */ 49 | Scope_id uint32 50 | } 51 | 52 | const ( 53 | sizeofIovec = 0x8 54 | sizeofMsghdr = 0x1c 55 | sizeofCmsghdr = 0xc 56 | 57 | sizeofSockaddrInet = 0x10 58 | sizeofSockaddrInet6 = 0x1c 59 | ) 60 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/zsys_darwin_arm.go: -------------------------------------------------------------------------------- 1 | // Created by cgo -godefs - DO NOT EDIT 2 | // cgo -godefs defs_darwin.go 3 | 4 | package socket 5 | 6 | const ( 7 | sysAF_UNSPEC = 0x0 8 | sysAF_INET = 0x2 9 | sysAF_INET6 = 0x1e 10 | 11 | sysSOCK_RAW = 0x3 12 | ) 13 | 14 | type iovec struct { 15 | Base *byte 16 | Len uint32 17 | } 18 | 19 | type msghdr struct { 20 | Name *byte 21 | Namelen uint32 22 | Iov *iovec 23 | Iovlen int32 24 | Control *byte 25 | Controllen uint32 26 | Flags int32 27 | } 28 | 29 | type cmsghdr struct { 30 | Len uint32 31 | Level int32 32 | Type int32 33 | } 34 | 35 | type sockaddrInet struct { 36 | Len uint8 37 | Family uint8 38 | Port uint16 39 | Addr [4]byte /* in_addr */ 40 | Zero [8]int8 41 | } 42 | 43 | type sockaddrInet6 struct { 44 | Len uint8 45 | Family uint8 46 | Port uint16 47 | Flowinfo uint32 48 | Addr [16]byte /* in6_addr */ 49 | Scope_id uint32 50 | } 51 | 52 | const ( 53 | sizeofIovec = 0x8 54 | sizeofMsghdr = 0x1c 55 | sizeofCmsghdr = 0xc 56 | 57 | sizeofSockaddrInet = 0x10 58 | sizeofSockaddrInet6 = 0x1c 59 | ) 60 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/zsys_freebsd_386.go: -------------------------------------------------------------------------------- 1 | // Created by cgo -godefs - DO NOT EDIT 2 | // cgo -godefs defs_freebsd.go 3 | 4 | package socket 5 | 6 | const ( 7 | sysAF_UNSPEC = 0x0 8 | sysAF_INET = 0x2 9 | sysAF_INET6 = 0x1c 10 | 11 | sysSOCK_RAW = 0x3 12 | ) 13 | 14 | type iovec struct { 15 | Base *byte 16 | Len uint32 17 | } 18 | 19 | type msghdr struct { 20 | Name *byte 21 | Namelen uint32 22 | Iov *iovec 23 | Iovlen int32 24 | Control *byte 25 | Controllen uint32 26 | Flags int32 27 | } 28 | 29 | type cmsghdr struct { 30 | Len uint32 31 | Level int32 32 | Type int32 33 | } 34 | 35 | type sockaddrInet struct { 36 | Len uint8 37 | Family uint8 38 | Port uint16 39 | Addr [4]byte /* in_addr */ 40 | Zero [8]int8 41 | } 42 | 43 | type sockaddrInet6 struct { 44 | Len uint8 45 | Family uint8 46 | Port uint16 47 | Flowinfo uint32 48 | Addr [16]byte /* in6_addr */ 49 | Scope_id uint32 50 | } 51 | 52 | const ( 53 | sizeofIovec = 0x8 54 | sizeofMsghdr = 0x1c 55 | sizeofCmsghdr = 0xc 56 | 57 | sizeofSockaddrInet = 0x10 58 | sizeofSockaddrInet6 = 0x1c 59 | ) 60 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/zsys_freebsd_arm.go: -------------------------------------------------------------------------------- 1 | // Created by cgo -godefs - DO NOT EDIT 2 | // cgo -godefs defs_freebsd.go 3 | 4 | package socket 5 | 6 | const ( 7 | sysAF_UNSPEC = 0x0 8 | sysAF_INET = 0x2 9 | sysAF_INET6 = 0x1c 10 | 11 | sysSOCK_RAW = 0x3 12 | ) 13 | 14 | type iovec struct { 15 | Base *byte 16 | Len uint32 17 | } 18 | 19 | type msghdr struct { 20 | Name *byte 21 | Namelen uint32 22 | Iov *iovec 23 | Iovlen int32 24 | Control *byte 25 | Controllen uint32 26 | Flags int32 27 | } 28 | 29 | type cmsghdr struct { 30 | Len uint32 31 | Level int32 32 | Type int32 33 | } 34 | 35 | type sockaddrInet struct { 36 | Len uint8 37 | Family uint8 38 | Port uint16 39 | Addr [4]byte /* in_addr */ 40 | Zero [8]int8 41 | } 42 | 43 | type sockaddrInet6 struct { 44 | Len uint8 45 | Family uint8 46 | Port uint16 47 | Flowinfo uint32 48 | Addr [16]byte /* in6_addr */ 49 | Scope_id uint32 50 | } 51 | 52 | const ( 53 | sizeofIovec = 0x8 54 | sizeofMsghdr = 0x1c 55 | sizeofCmsghdr = 0xc 56 | 57 | sizeofSockaddrInet = 0x10 58 | sizeofSockaddrInet6 = 0x1c 59 | ) 60 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/zsys_openbsd_386.go: -------------------------------------------------------------------------------- 1 | // Created by cgo -godefs - DO NOT EDIT 2 | // cgo -godefs defs_openbsd.go 3 | 4 | package socket 5 | 6 | const ( 7 | sysAF_UNSPEC = 0x0 8 | sysAF_INET = 0x2 9 | sysAF_INET6 = 0x18 10 | 11 | sysSOCK_RAW = 0x3 12 | ) 13 | 14 | type iovec struct { 15 | Base *byte 16 | Len uint32 17 | } 18 | 19 | type msghdr struct { 20 | Name *byte 21 | Namelen uint32 22 | Iov *iovec 23 | Iovlen uint32 24 | Control *byte 25 | Controllen uint32 26 | Flags int32 27 | } 28 | 29 | type cmsghdr struct { 30 | Len uint32 31 | Level int32 32 | Type int32 33 | } 34 | 35 | type sockaddrInet struct { 36 | Len uint8 37 | Family uint8 38 | Port uint16 39 | Addr [4]byte /* in_addr */ 40 | Zero [8]int8 41 | } 42 | 43 | type sockaddrInet6 struct { 44 | Len uint8 45 | Family uint8 46 | Port uint16 47 | Flowinfo uint32 48 | Addr [16]byte /* in6_addr */ 49 | Scope_id uint32 50 | } 51 | 52 | const ( 53 | sizeofIovec = 0x8 54 | sizeofMsghdr = 0x1c 55 | sizeofCmsghdr = 0xc 56 | 57 | sizeofSockaddrInet = 0x10 58 | sizeofSockaddrInet6 = 0x1c 59 | ) 60 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/zsys_openbsd_arm.go: -------------------------------------------------------------------------------- 1 | // Created by cgo -godefs - DO NOT EDIT 2 | // cgo -godefs defs_openbsd.go 3 | 4 | package socket 5 | 6 | const ( 7 | sysAF_UNSPEC = 0x0 8 | sysAF_INET = 0x2 9 | sysAF_INET6 = 0x18 10 | 11 | sysSOCK_RAW = 0x3 12 | ) 13 | 14 | type iovec struct { 15 | Base *byte 16 | Len uint32 17 | } 18 | 19 | type msghdr struct { 20 | Name *byte 21 | Namelen uint32 22 | Iov *iovec 23 | Iovlen uint32 24 | Control *byte 25 | Controllen uint32 26 | Flags int32 27 | } 28 | 29 | type cmsghdr struct { 30 | Len uint32 31 | Level int32 32 | Type int32 33 | } 34 | 35 | type sockaddrInet struct { 36 | Len uint8 37 | Family uint8 38 | Port uint16 39 | Addr [4]byte /* in_addr */ 40 | Zero [8]int8 41 | } 42 | 43 | type sockaddrInet6 struct { 44 | Len uint8 45 | Family uint8 46 | Port uint16 47 | Flowinfo uint32 48 | Addr [16]byte /* in6_addr */ 49 | Scope_id uint32 50 | } 51 | 52 | const ( 53 | sizeofIovec = 0x8 54 | sizeofMsghdr = 0x1c 55 | sizeofCmsghdr = 0xc 56 | 57 | sizeofSockaddrInet = 0x10 58 | sizeofSockaddrInet6 = 0x1c 59 | ) 60 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/ipv4/defs_dragonfly.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build ignore 6 | 7 | // +godefs map struct_in_addr [4]byte /* in_addr */ 8 | 9 | package ipv4 10 | 11 | /* 12 | #include 13 | */ 14 | import "C" 15 | 16 | const ( 17 | sysIP_OPTIONS = C.IP_OPTIONS 18 | sysIP_HDRINCL = C.IP_HDRINCL 19 | sysIP_TOS = C.IP_TOS 20 | sysIP_TTL = C.IP_TTL 21 | sysIP_RECVOPTS = C.IP_RECVOPTS 22 | sysIP_RECVRETOPTS = C.IP_RECVRETOPTS 23 | sysIP_RECVDSTADDR = C.IP_RECVDSTADDR 24 | sysIP_RETOPTS = C.IP_RETOPTS 25 | sysIP_RECVIF = C.IP_RECVIF 26 | sysIP_RECVTTL = C.IP_RECVTTL 27 | 28 | sysIP_MULTICAST_IF = C.IP_MULTICAST_IF 29 | sysIP_MULTICAST_TTL = C.IP_MULTICAST_TTL 30 | sysIP_MULTICAST_LOOP = C.IP_MULTICAST_LOOP 31 | sysIP_MULTICAST_VIF = C.IP_MULTICAST_VIF 32 | sysIP_ADD_MEMBERSHIP = C.IP_ADD_MEMBERSHIP 33 | sysIP_DROP_MEMBERSHIP = C.IP_DROP_MEMBERSHIP 34 | 35 | sizeofIPMreq = C.sizeof_struct_ip_mreq 36 | ) 37 | 38 | type ipMreq C.struct_ip_mreq 39 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/ipv4/sys_asmreqn.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build darwin freebsd linux 6 | 7 | package ipv4 8 | 9 | import ( 10 | "net" 11 | "unsafe" 12 | 13 | "golang.org/x/net/internal/socket" 14 | ) 15 | 16 | func (so *sockOpt) getIPMreqn(c *socket.Conn) (*net.Interface, error) { 17 | b := make([]byte, so.Len) 18 | if _, err := so.Get(c, b); err != nil { 19 | return nil, err 20 | } 21 | mreqn := (*ipMreqn)(unsafe.Pointer(&b[0])) 22 | if mreqn.Ifindex == 0 { 23 | return nil, nil 24 | } 25 | ifi, err := net.InterfaceByIndex(int(mreqn.Ifindex)) 26 | if err != nil { 27 | return nil, err 28 | } 29 | return ifi, nil 30 | } 31 | 32 | func (so *sockOpt) setIPMreqn(c *socket.Conn, ifi *net.Interface, grp net.IP) error { 33 | var mreqn ipMreqn 34 | if ifi != nil { 35 | mreqn.Ifindex = int32(ifi.Index) 36 | } 37 | if grp != nil { 38 | mreqn.Multiaddr = [4]byte{grp[0], grp[1], grp[2], grp[3]} 39 | } 40 | b := (*[sizeofIPMreqn]byte)(unsafe.Pointer(&mreqn))[:sizeofIPMreqn] 41 | return so.Set(c, b) 42 | } 43 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/defs_aix.go: -------------------------------------------------------------------------------- 1 | // Copyright 2019 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build ignore 6 | 7 | // +godefs map struct_in_addr [4]byte /* in_addr */ 8 | // +godefs map struct_in6_addr [16]byte /* in6_addr */ 9 | 10 | package socket 11 | 12 | /* 13 | #include 14 | 15 | #include 16 | */ 17 | import "C" 18 | 19 | const ( 20 | sysAF_UNSPEC = C.AF_UNSPEC 21 | sysAF_INET = C.AF_INET 22 | sysAF_INET6 = C.AF_INET6 23 | 24 | sysSOCK_RAW = C.SOCK_RAW 25 | ) 26 | 27 | type iovec C.struct_iovec 28 | 29 | type msghdr C.struct_msghdr 30 | 31 | type mmsghdr C.struct_mmsghdr 32 | 33 | type cmsghdr C.struct_cmsghdr 34 | 35 | type sockaddrInet C.struct_sockaddr_in 36 | 37 | type sockaddrInet6 C.struct_sockaddr_in6 38 | 39 | const ( 40 | sizeofIovec = C.sizeof_struct_iovec 41 | sizeofMsghdr = C.sizeof_struct_msghdr 42 | sizeofMmsghdr = C.sizeof_struct_mmsghdr 43 | sizeofCmsghdr = C.sizeof_struct_cmsghdr 44 | 45 | sizeofSockaddrInet = C.sizeof_struct_sockaddr_in 46 | sizeofSockaddrInet6 = C.sizeof_struct_sockaddr_in6 47 | ) 48 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/defs_netbsd.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build ignore 6 | 7 | // +godefs map struct_in_addr [4]byte /* in_addr */ 8 | // +godefs map struct_in6_addr [16]byte /* in6_addr */ 9 | 10 | package socket 11 | 12 | /* 13 | #include 14 | 15 | #include 16 | */ 17 | import "C" 18 | 19 | const ( 20 | sysAF_UNSPEC = C.AF_UNSPEC 21 | sysAF_INET = C.AF_INET 22 | sysAF_INET6 = C.AF_INET6 23 | 24 | sysSOCK_RAW = C.SOCK_RAW 25 | ) 26 | 27 | type iovec C.struct_iovec 28 | 29 | type msghdr C.struct_msghdr 30 | 31 | type mmsghdr C.struct_mmsghdr 32 | 33 | type cmsghdr C.struct_cmsghdr 34 | 35 | type sockaddrInet C.struct_sockaddr_in 36 | 37 | type sockaddrInet6 C.struct_sockaddr_in6 38 | 39 | const ( 40 | sizeofIovec = C.sizeof_struct_iovec 41 | sizeofMsghdr = C.sizeof_struct_msghdr 42 | sizeofMmsghdr = C.sizeof_struct_mmsghdr 43 | sizeofCmsghdr = C.sizeof_struct_cmsghdr 44 | 45 | sizeofSockaddrInet = C.sizeof_struct_sockaddr_in 46 | sizeofSockaddrInet6 = C.sizeof_struct_sockaddr_in6 47 | ) 48 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/zsys_darwin_amd64.go: -------------------------------------------------------------------------------- 1 | // Created by cgo -godefs - DO NOT EDIT 2 | // cgo -godefs defs_darwin.go 3 | 4 | package socket 5 | 6 | const ( 7 | sysAF_UNSPEC = 0x0 8 | sysAF_INET = 0x2 9 | sysAF_INET6 = 0x1e 10 | 11 | sysSOCK_RAW = 0x3 12 | ) 13 | 14 | type iovec struct { 15 | Base *byte 16 | Len uint64 17 | } 18 | 19 | type msghdr struct { 20 | Name *byte 21 | Namelen uint32 22 | Pad_cgo_0 [4]byte 23 | Iov *iovec 24 | Iovlen int32 25 | Pad_cgo_1 [4]byte 26 | Control *byte 27 | Controllen uint32 28 | Flags int32 29 | } 30 | 31 | type cmsghdr struct { 32 | Len uint32 33 | Level int32 34 | Type int32 35 | } 36 | 37 | type sockaddrInet struct { 38 | Len uint8 39 | Family uint8 40 | Port uint16 41 | Addr [4]byte /* in_addr */ 42 | Zero [8]int8 43 | } 44 | 45 | type sockaddrInet6 struct { 46 | Len uint8 47 | Family uint8 48 | Port uint16 49 | Flowinfo uint32 50 | Addr [16]byte /* in6_addr */ 51 | Scope_id uint32 52 | } 53 | 54 | const ( 55 | sizeofIovec = 0x10 56 | sizeofMsghdr = 0x30 57 | sizeofCmsghdr = 0xc 58 | 59 | sizeofSockaddrInet = 0x10 60 | sizeofSockaddrInet6 = 0x1c 61 | ) 62 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/zsys_darwin_arm64.go: -------------------------------------------------------------------------------- 1 | // Created by cgo -godefs - DO NOT EDIT 2 | // cgo -godefs defs_darwin.go 3 | 4 | package socket 5 | 6 | const ( 7 | sysAF_UNSPEC = 0x0 8 | sysAF_INET = 0x2 9 | sysAF_INET6 = 0x1e 10 | 11 | sysSOCK_RAW = 0x3 12 | ) 13 | 14 | type iovec struct { 15 | Base *byte 16 | Len uint64 17 | } 18 | 19 | type msghdr struct { 20 | Name *byte 21 | Namelen uint32 22 | Pad_cgo_0 [4]byte 23 | Iov *iovec 24 | Iovlen int32 25 | Pad_cgo_1 [4]byte 26 | Control *byte 27 | Controllen uint32 28 | Flags int32 29 | } 30 | 31 | type cmsghdr struct { 32 | Len uint32 33 | Level int32 34 | Type int32 35 | } 36 | 37 | type sockaddrInet struct { 38 | Len uint8 39 | Family uint8 40 | Port uint16 41 | Addr [4]byte /* in_addr */ 42 | Zero [8]int8 43 | } 44 | 45 | type sockaddrInet6 struct { 46 | Len uint8 47 | Family uint8 48 | Port uint16 49 | Flowinfo uint32 50 | Addr [16]byte /* in6_addr */ 51 | Scope_id uint32 52 | } 53 | 54 | const ( 55 | sizeofIovec = 0x10 56 | sizeofMsghdr = 0x30 57 | sizeofCmsghdr = 0xc 58 | 59 | sizeofSockaddrInet = 0x10 60 | sizeofSockaddrInet6 = 0x1c 61 | ) 62 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/zsys_freebsd_amd64.go: -------------------------------------------------------------------------------- 1 | // Created by cgo -godefs - DO NOT EDIT 2 | // cgo -godefs defs_freebsd.go 3 | 4 | package socket 5 | 6 | const ( 7 | sysAF_UNSPEC = 0x0 8 | sysAF_INET = 0x2 9 | sysAF_INET6 = 0x1c 10 | 11 | sysSOCK_RAW = 0x3 12 | ) 13 | 14 | type iovec struct { 15 | Base *byte 16 | Len uint64 17 | } 18 | 19 | type msghdr struct { 20 | Name *byte 21 | Namelen uint32 22 | Pad_cgo_0 [4]byte 23 | Iov *iovec 24 | Iovlen int32 25 | Pad_cgo_1 [4]byte 26 | Control *byte 27 | Controllen uint32 28 | Flags int32 29 | } 30 | 31 | type cmsghdr struct { 32 | Len uint32 33 | Level int32 34 | Type int32 35 | } 36 | 37 | type sockaddrInet struct { 38 | Len uint8 39 | Family uint8 40 | Port uint16 41 | Addr [4]byte /* in_addr */ 42 | Zero [8]int8 43 | } 44 | 45 | type sockaddrInet6 struct { 46 | Len uint8 47 | Family uint8 48 | Port uint16 49 | Flowinfo uint32 50 | Addr [16]byte /* in6_addr */ 51 | Scope_id uint32 52 | } 53 | 54 | const ( 55 | sizeofIovec = 0x10 56 | sizeofMsghdr = 0x30 57 | sizeofCmsghdr = 0xc 58 | 59 | sizeofSockaddrInet = 0x10 60 | sizeofSockaddrInet6 = 0x1c 61 | ) 62 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/zsys_openbsd_amd64.go: -------------------------------------------------------------------------------- 1 | // Created by cgo -godefs - DO NOT EDIT 2 | // cgo -godefs defs_openbsd.go 3 | 4 | package socket 5 | 6 | const ( 7 | sysAF_UNSPEC = 0x0 8 | sysAF_INET = 0x2 9 | sysAF_INET6 = 0x18 10 | 11 | sysSOCK_RAW = 0x3 12 | ) 13 | 14 | type iovec struct { 15 | Base *byte 16 | Len uint64 17 | } 18 | 19 | type msghdr struct { 20 | Name *byte 21 | Namelen uint32 22 | Pad_cgo_0 [4]byte 23 | Iov *iovec 24 | Iovlen uint32 25 | Pad_cgo_1 [4]byte 26 | Control *byte 27 | Controllen uint32 28 | Flags int32 29 | } 30 | 31 | type cmsghdr struct { 32 | Len uint32 33 | Level int32 34 | Type int32 35 | } 36 | 37 | type sockaddrInet struct { 38 | Len uint8 39 | Family uint8 40 | Port uint16 41 | Addr [4]byte /* in_addr */ 42 | Zero [8]int8 43 | } 44 | 45 | type sockaddrInet6 struct { 46 | Len uint8 47 | Family uint8 48 | Port uint16 49 | Flowinfo uint32 50 | Addr [16]byte /* in6_addr */ 51 | Scope_id uint32 52 | } 53 | 54 | const ( 55 | sizeofIovec = 0x10 56 | sizeofMsghdr = 0x30 57 | sizeofCmsghdr = 0xc 58 | 59 | sizeofSockaddrInet = 0x10 60 | sizeofSockaddrInet6 = 0x1c 61 | ) 62 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/zsys_dragonfly_amd64.go: -------------------------------------------------------------------------------- 1 | // Created by cgo -godefs - DO NOT EDIT 2 | // cgo -godefs defs_dragonfly.go 3 | 4 | package socket 5 | 6 | const ( 7 | sysAF_UNSPEC = 0x0 8 | sysAF_INET = 0x2 9 | sysAF_INET6 = 0x1c 10 | 11 | sysSOCK_RAW = 0x3 12 | ) 13 | 14 | type iovec struct { 15 | Base *byte 16 | Len uint64 17 | } 18 | 19 | type msghdr struct { 20 | Name *byte 21 | Namelen uint32 22 | Pad_cgo_0 [4]byte 23 | Iov *iovec 24 | Iovlen int32 25 | Pad_cgo_1 [4]byte 26 | Control *byte 27 | Controllen uint32 28 | Flags int32 29 | } 30 | 31 | type cmsghdr struct { 32 | Len uint32 33 | Level int32 34 | Type int32 35 | } 36 | 37 | type sockaddrInet struct { 38 | Len uint8 39 | Family uint8 40 | Port uint16 41 | Addr [4]byte /* in_addr */ 42 | Zero [8]int8 43 | } 44 | 45 | type sockaddrInet6 struct { 46 | Len uint8 47 | Family uint8 48 | Port uint16 49 | Flowinfo uint32 50 | Addr [16]byte /* in6_addr */ 51 | Scope_id uint32 52 | } 53 | 54 | const ( 55 | sizeofIovec = 0x10 56 | sizeofMsghdr = 0x30 57 | sizeofCmsghdr = 0xc 58 | 59 | sizeofSockaddrInet = 0x10 60 | sizeofSockaddrInet6 = 0x1c 61 | ) 62 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/zsys_linux_386.go: -------------------------------------------------------------------------------- 1 | // Created by cgo -godefs - DO NOT EDIT 2 | // cgo -godefs defs_linux.go 3 | 4 | package socket 5 | 6 | const ( 7 | sysAF_UNSPEC = 0x0 8 | sysAF_INET = 0x2 9 | sysAF_INET6 = 0xa 10 | 11 | sysSOCK_RAW = 0x3 12 | ) 13 | 14 | type iovec struct { 15 | Base *byte 16 | Len uint32 17 | } 18 | 19 | type msghdr struct { 20 | Name *byte 21 | Namelen uint32 22 | Iov *iovec 23 | Iovlen uint32 24 | Control *byte 25 | Controllen uint32 26 | Flags int32 27 | } 28 | 29 | type mmsghdr struct { 30 | Hdr msghdr 31 | Len uint32 32 | } 33 | 34 | type cmsghdr struct { 35 | Len uint32 36 | Level int32 37 | Type int32 38 | } 39 | 40 | type sockaddrInet struct { 41 | Family uint16 42 | Port uint16 43 | Addr [4]byte /* in_addr */ 44 | X__pad [8]uint8 45 | } 46 | 47 | type sockaddrInet6 struct { 48 | Family uint16 49 | Port uint16 50 | Flowinfo uint32 51 | Addr [16]byte /* in6_addr */ 52 | Scope_id uint32 53 | } 54 | 55 | const ( 56 | sizeofIovec = 0x8 57 | sizeofMsghdr = 0x1c 58 | sizeofMmsghdr = 0x20 59 | sizeofCmsghdr = 0xc 60 | 61 | sizeofSockaddrInet = 0x10 62 | sizeofSockaddrInet6 = 0x1c 63 | ) 64 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/zsys_linux_arm.go: -------------------------------------------------------------------------------- 1 | // Created by cgo -godefs - DO NOT EDIT 2 | // cgo -godefs defs_linux.go 3 | 4 | package socket 5 | 6 | const ( 7 | sysAF_UNSPEC = 0x0 8 | sysAF_INET = 0x2 9 | sysAF_INET6 = 0xa 10 | 11 | sysSOCK_RAW = 0x3 12 | ) 13 | 14 | type iovec struct { 15 | Base *byte 16 | Len uint32 17 | } 18 | 19 | type msghdr struct { 20 | Name *byte 21 | Namelen uint32 22 | Iov *iovec 23 | Iovlen uint32 24 | Control *byte 25 | Controllen uint32 26 | Flags int32 27 | } 28 | 29 | type mmsghdr struct { 30 | Hdr msghdr 31 | Len uint32 32 | } 33 | 34 | type cmsghdr struct { 35 | Len uint32 36 | Level int32 37 | Type int32 38 | } 39 | 40 | type sockaddrInet struct { 41 | Family uint16 42 | Port uint16 43 | Addr [4]byte /* in_addr */ 44 | X__pad [8]uint8 45 | } 46 | 47 | type sockaddrInet6 struct { 48 | Family uint16 49 | Port uint16 50 | Flowinfo uint32 51 | Addr [16]byte /* in6_addr */ 52 | Scope_id uint32 53 | } 54 | 55 | const ( 56 | sizeofIovec = 0x8 57 | sizeofMsghdr = 0x1c 58 | sizeofMmsghdr = 0x20 59 | sizeofCmsghdr = 0xc 60 | 61 | sizeofSockaddrInet = 0x10 62 | sizeofSockaddrInet6 = 0x1c 63 | ) 64 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/zsys_linux_mips.go: -------------------------------------------------------------------------------- 1 | // Created by cgo -godefs - DO NOT EDIT 2 | // cgo -godefs defs_linux.go 3 | 4 | package socket 5 | 6 | const ( 7 | sysAF_UNSPEC = 0x0 8 | sysAF_INET = 0x2 9 | sysAF_INET6 = 0xa 10 | 11 | sysSOCK_RAW = 0x3 12 | ) 13 | 14 | type iovec struct { 15 | Base *byte 16 | Len uint32 17 | } 18 | 19 | type msghdr struct { 20 | Name *byte 21 | Namelen uint32 22 | Iov *iovec 23 | Iovlen uint32 24 | Control *byte 25 | Controllen uint32 26 | Flags int32 27 | } 28 | 29 | type mmsghdr struct { 30 | Hdr msghdr 31 | Len uint32 32 | } 33 | 34 | type cmsghdr struct { 35 | Len uint32 36 | Level int32 37 | Type int32 38 | } 39 | 40 | type sockaddrInet struct { 41 | Family uint16 42 | Port uint16 43 | Addr [4]byte /* in_addr */ 44 | X__pad [8]uint8 45 | } 46 | 47 | type sockaddrInet6 struct { 48 | Family uint16 49 | Port uint16 50 | Flowinfo uint32 51 | Addr [16]byte /* in6_addr */ 52 | Scope_id uint32 53 | } 54 | 55 | const ( 56 | sizeofIovec = 0x8 57 | sizeofMsghdr = 0x1c 58 | sizeofMmsghdr = 0x20 59 | sizeofCmsghdr = 0xc 60 | 61 | sizeofSockaddrInet = 0x10 62 | sizeofSockaddrInet6 = 0x1c 63 | ) 64 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/zsys_linux_mipsle.go: -------------------------------------------------------------------------------- 1 | // Created by cgo -godefs - DO NOT EDIT 2 | // cgo -godefs defs_linux.go 3 | 4 | package socket 5 | 6 | const ( 7 | sysAF_UNSPEC = 0x0 8 | sysAF_INET = 0x2 9 | sysAF_INET6 = 0xa 10 | 11 | sysSOCK_RAW = 0x3 12 | ) 13 | 14 | type iovec struct { 15 | Base *byte 16 | Len uint32 17 | } 18 | 19 | type msghdr struct { 20 | Name *byte 21 | Namelen uint32 22 | Iov *iovec 23 | Iovlen uint32 24 | Control *byte 25 | Controllen uint32 26 | Flags int32 27 | } 28 | 29 | type mmsghdr struct { 30 | Hdr msghdr 31 | Len uint32 32 | } 33 | 34 | type cmsghdr struct { 35 | Len uint32 36 | Level int32 37 | Type int32 38 | } 39 | 40 | type sockaddrInet struct { 41 | Family uint16 42 | Port uint16 43 | Addr [4]byte /* in_addr */ 44 | X__pad [8]uint8 45 | } 46 | 47 | type sockaddrInet6 struct { 48 | Family uint16 49 | Port uint16 50 | Flowinfo uint32 51 | Addr [16]byte /* in6_addr */ 52 | Scope_id uint32 53 | } 54 | 55 | const ( 56 | sizeofIovec = 0x8 57 | sizeofMsghdr = 0x1c 58 | sizeofMmsghdr = 0x20 59 | sizeofCmsghdr = 0xc 60 | 61 | sizeofSockaddrInet = 0x10 62 | sizeofSockaddrInet6 = 0x1c 63 | ) 64 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/ipv4/defs_aix.go: -------------------------------------------------------------------------------- 1 | // Copyright 2019 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build ignore 6 | 7 | // +godefs map struct_in_addr [4]byte /* in_addr */ 8 | 9 | package ipv4 10 | 11 | /* 12 | #include 13 | */ 14 | import "C" 15 | 16 | const ( 17 | sysIP_OPTIONS = C.IP_OPTIONS 18 | sysIP_HDRINCL = C.IP_HDRINCL 19 | sysIP_TOS = C.IP_TOS 20 | sysIP_TTL = C.IP_TTL 21 | sysIP_RECVOPTS = C.IP_RECVOPTS 22 | sysIP_RECVRETOPTS = C.IP_RECVRETOPTS 23 | sysIP_RECVDSTADDR = C.IP_RECVDSTADDR 24 | sysIP_RETOPTS = C.IP_RETOPTS 25 | // IP_RECVIF is defined on AIX but doesn't work. 26 | // IP_RECVINTERFACE must be used instead. 27 | sysIP_RECVIF = C.IP_RECVINTERFACE 28 | sysIP_RECVTTL = C.IP_RECVTTL 29 | 30 | sysIP_MULTICAST_IF = C.IP_MULTICAST_IF 31 | sysIP_MULTICAST_TTL = C.IP_MULTICAST_TTL 32 | sysIP_MULTICAST_LOOP = C.IP_MULTICAST_LOOP 33 | sysIP_ADD_MEMBERSHIP = C.IP_ADD_MEMBERSHIP 34 | sysIP_DROP_MEMBERSHIP = C.IP_DROP_MEMBERSHIP 35 | 36 | sizeofIPMreq = C.sizeof_struct_ip_mreq 37 | ) 38 | 39 | type ipMreq C.struct_ip_mreq 40 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/ipv4/control_bsd.go: -------------------------------------------------------------------------------- 1 | // Copyright 2012 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build aix darwin dragonfly freebsd netbsd openbsd 6 | 7 | package ipv4 8 | 9 | import ( 10 | "net" 11 | "syscall" 12 | "unsafe" 13 | 14 | "golang.org/x/net/internal/iana" 15 | "golang.org/x/net/internal/socket" 16 | ) 17 | 18 | func marshalDst(b []byte, cm *ControlMessage) []byte { 19 | m := socket.ControlMessage(b) 20 | m.MarshalHeader(iana.ProtocolIP, sysIP_RECVDSTADDR, net.IPv4len) 21 | return m.Next(net.IPv4len) 22 | } 23 | 24 | func parseDst(cm *ControlMessage, b []byte) { 25 | if len(cm.Dst) < net.IPv4len { 26 | cm.Dst = make(net.IP, net.IPv4len) 27 | } 28 | copy(cm.Dst, b[:net.IPv4len]) 29 | } 30 | 31 | func marshalInterface(b []byte, cm *ControlMessage) []byte { 32 | m := socket.ControlMessage(b) 33 | m.MarshalHeader(iana.ProtocolIP, sysIP_RECVIF, syscall.SizeofSockaddrDatalink) 34 | return m.Next(syscall.SizeofSockaddrDatalink) 35 | } 36 | 37 | func parseInterface(cm *ControlMessage, b []byte) { 38 | sadl := (*syscall.SockaddrDatalink)(unsafe.Pointer(&b[0])) 39 | cm.IfIndex = int(sadl.Index) 40 | } 41 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/mmsghdr_unix.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build aix linux netbsd 6 | 7 | package socket 8 | 9 | import "net" 10 | 11 | type mmsghdrs []mmsghdr 12 | 13 | func (hs mmsghdrs) pack(ms []Message, parseFn func([]byte, string) (net.Addr, error), marshalFn func(net.Addr) []byte) error { 14 | for i := range hs { 15 | vs := make([]iovec, len(ms[i].Buffers)) 16 | var sa []byte 17 | if parseFn != nil { 18 | sa = make([]byte, sizeofSockaddrInet6) 19 | } 20 | if marshalFn != nil { 21 | sa = marshalFn(ms[i].Addr) 22 | } 23 | hs[i].Hdr.pack(vs, ms[i].Buffers, ms[i].OOB, sa) 24 | } 25 | return nil 26 | } 27 | 28 | func (hs mmsghdrs) unpack(ms []Message, parseFn func([]byte, string) (net.Addr, error), hint string) error { 29 | for i := range hs { 30 | ms[i].N = int(hs[i].Len) 31 | ms[i].NN = hs[i].Hdr.controllen() 32 | ms[i].Flags = hs[i].Hdr.flags() 33 | if parseFn != nil { 34 | var err error 35 | ms[i].Addr, err = parseFn(hs[i].Hdr.name(), hint) 36 | if err != nil { 37 | return err 38 | } 39 | } 40 | } 41 | return nil 42 | } 43 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/zsys_solaris_amd64.go: -------------------------------------------------------------------------------- 1 | // Created by cgo -godefs - DO NOT EDIT 2 | // cgo -godefs defs_solaris.go 3 | 4 | package socket 5 | 6 | const ( 7 | sysAF_UNSPEC = 0x0 8 | sysAF_INET = 0x2 9 | sysAF_INET6 = 0x1a 10 | 11 | sysSOCK_RAW = 0x4 12 | ) 13 | 14 | type iovec struct { 15 | Base *int8 16 | Len uint64 17 | } 18 | 19 | type msghdr struct { 20 | Name *byte 21 | Namelen uint32 22 | Pad_cgo_0 [4]byte 23 | Iov *iovec 24 | Iovlen int32 25 | Pad_cgo_1 [4]byte 26 | Accrights *int8 27 | Accrightslen int32 28 | Pad_cgo_2 [4]byte 29 | } 30 | 31 | type cmsghdr struct { 32 | Len uint32 33 | Level int32 34 | Type int32 35 | } 36 | 37 | type sockaddrInet struct { 38 | Family uint16 39 | Port uint16 40 | Addr [4]byte /* in_addr */ 41 | Zero [8]int8 42 | } 43 | 44 | type sockaddrInet6 struct { 45 | Family uint16 46 | Port uint16 47 | Flowinfo uint32 48 | Addr [16]byte /* in6_addr */ 49 | Scope_id uint32 50 | X__sin6_src_id uint32 51 | } 52 | 53 | const ( 54 | sizeofIovec = 0x10 55 | sizeofMsghdr = 0x30 56 | sizeofCmsghdr = 0xc 57 | 58 | sizeofSockaddrInet = 0x10 59 | sizeofSockaddrInet6 = 0x20 60 | ) 61 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/zsys_netbsd_386.go: -------------------------------------------------------------------------------- 1 | // Created by cgo -godefs - DO NOT EDIT 2 | // cgo -godefs defs_netbsd.go 3 | 4 | package socket 5 | 6 | const ( 7 | sysAF_UNSPEC = 0x0 8 | sysAF_INET = 0x2 9 | sysAF_INET6 = 0x18 10 | 11 | sysSOCK_RAW = 0x3 12 | ) 13 | 14 | type iovec struct { 15 | Base *byte 16 | Len uint32 17 | } 18 | 19 | type msghdr struct { 20 | Name *byte 21 | Namelen uint32 22 | Iov *iovec 23 | Iovlen int32 24 | Control *byte 25 | Controllen uint32 26 | Flags int32 27 | } 28 | 29 | type mmsghdr struct { 30 | Hdr msghdr 31 | Len uint32 32 | } 33 | 34 | type cmsghdr struct { 35 | Len uint32 36 | Level int32 37 | Type int32 38 | } 39 | 40 | type sockaddrInet struct { 41 | Len uint8 42 | Family uint8 43 | Port uint16 44 | Addr [4]byte /* in_addr */ 45 | Zero [8]int8 46 | } 47 | 48 | type sockaddrInet6 struct { 49 | Len uint8 50 | Family uint8 51 | Port uint16 52 | Flowinfo uint32 53 | Addr [16]byte /* in6_addr */ 54 | Scope_id uint32 55 | } 56 | 57 | const ( 58 | sizeofIovec = 0x8 59 | sizeofMsghdr = 0x1c 60 | sizeofMmsghdr = 0x20 61 | sizeofCmsghdr = 0xc 62 | 63 | sizeofSockaddrInet = 0x10 64 | sizeofSockaddrInet6 = 0x1c 65 | ) 66 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/zsys_netbsd_arm.go: -------------------------------------------------------------------------------- 1 | // Created by cgo -godefs - DO NOT EDIT 2 | // cgo -godefs defs_netbsd.go 3 | 4 | package socket 5 | 6 | const ( 7 | sysAF_UNSPEC = 0x0 8 | sysAF_INET = 0x2 9 | sysAF_INET6 = 0x18 10 | 11 | sysSOCK_RAW = 0x3 12 | ) 13 | 14 | type iovec struct { 15 | Base *byte 16 | Len uint32 17 | } 18 | 19 | type msghdr struct { 20 | Name *byte 21 | Namelen uint32 22 | Iov *iovec 23 | Iovlen int32 24 | Control *byte 25 | Controllen uint32 26 | Flags int32 27 | } 28 | 29 | type mmsghdr struct { 30 | Hdr msghdr 31 | Len uint32 32 | } 33 | 34 | type cmsghdr struct { 35 | Len uint32 36 | Level int32 37 | Type int32 38 | } 39 | 40 | type sockaddrInet struct { 41 | Len uint8 42 | Family uint8 43 | Port uint16 44 | Addr [4]byte /* in_addr */ 45 | Zero [8]int8 46 | } 47 | 48 | type sockaddrInet6 struct { 49 | Len uint8 50 | Family uint8 51 | Port uint16 52 | Flowinfo uint32 53 | Addr [16]byte /* in6_addr */ 54 | Scope_id uint32 55 | } 56 | 57 | const ( 58 | sizeofIovec = 0x8 59 | sizeofMsghdr = 0x1c 60 | sizeofMmsghdr = 0x20 61 | sizeofCmsghdr = 0xc 62 | 63 | sizeofSockaddrInet = 0x10 64 | sizeofSockaddrInet6 = 0x1c 65 | ) 66 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/defs_linux.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build ignore 6 | 7 | // +godefs map struct_in_addr [4]byte /* in_addr */ 8 | // +godefs map struct_in6_addr [16]byte /* in6_addr */ 9 | 10 | package socket 11 | 12 | /* 13 | #include 14 | #include 15 | 16 | #define _GNU_SOURCE 17 | #include 18 | */ 19 | import "C" 20 | 21 | const ( 22 | sysAF_UNSPEC = C.AF_UNSPEC 23 | sysAF_INET = C.AF_INET 24 | sysAF_INET6 = C.AF_INET6 25 | 26 | sysSOCK_RAW = C.SOCK_RAW 27 | ) 28 | 29 | type iovec C.struct_iovec 30 | 31 | type msghdr C.struct_msghdr 32 | 33 | type mmsghdr C.struct_mmsghdr 34 | 35 | type cmsghdr C.struct_cmsghdr 36 | 37 | type sockaddrInet C.struct_sockaddr_in 38 | 39 | type sockaddrInet6 C.struct_sockaddr_in6 40 | 41 | const ( 42 | sizeofIovec = C.sizeof_struct_iovec 43 | sizeofMsghdr = C.sizeof_struct_msghdr 44 | sizeofMmsghdr = C.sizeof_struct_mmsghdr 45 | sizeofCmsghdr = C.sizeof_struct_cmsghdr 46 | 47 | sizeofSockaddrInet = C.sizeof_struct_sockaddr_in 48 | sizeofSockaddrInet6 = C.sizeof_struct_sockaddr_in6 49 | ) 50 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/zsys_linux_amd64.go: -------------------------------------------------------------------------------- 1 | // Created by cgo -godefs - DO NOT EDIT 2 | // cgo -godefs defs_linux.go 3 | 4 | package socket 5 | 6 | const ( 7 | sysAF_UNSPEC = 0x0 8 | sysAF_INET = 0x2 9 | sysAF_INET6 = 0xa 10 | 11 | sysSOCK_RAW = 0x3 12 | ) 13 | 14 | type iovec struct { 15 | Base *byte 16 | Len uint64 17 | } 18 | 19 | type msghdr struct { 20 | Name *byte 21 | Namelen uint32 22 | Pad_cgo_0 [4]byte 23 | Iov *iovec 24 | Iovlen uint64 25 | Control *byte 26 | Controllen uint64 27 | Flags int32 28 | Pad_cgo_1 [4]byte 29 | } 30 | 31 | type mmsghdr struct { 32 | Hdr msghdr 33 | Len uint32 34 | Pad_cgo_0 [4]byte 35 | } 36 | 37 | type cmsghdr struct { 38 | Len uint64 39 | Level int32 40 | Type int32 41 | } 42 | 43 | type sockaddrInet struct { 44 | Family uint16 45 | Port uint16 46 | Addr [4]byte /* in_addr */ 47 | X__pad [8]uint8 48 | } 49 | 50 | type sockaddrInet6 struct { 51 | Family uint16 52 | Port uint16 53 | Flowinfo uint32 54 | Addr [16]byte /* in6_addr */ 55 | Scope_id uint32 56 | } 57 | 58 | const ( 59 | sizeofIovec = 0x10 60 | sizeofMsghdr = 0x38 61 | sizeofMmsghdr = 0x40 62 | sizeofCmsghdr = 0x10 63 | 64 | sizeofSockaddrInet = 0x10 65 | sizeofSockaddrInet6 = 0x1c 66 | ) 67 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/zsys_linux_arm64.go: -------------------------------------------------------------------------------- 1 | // Created by cgo -godefs - DO NOT EDIT 2 | // cgo -godefs defs_linux.go 3 | 4 | package socket 5 | 6 | const ( 7 | sysAF_UNSPEC = 0x0 8 | sysAF_INET = 0x2 9 | sysAF_INET6 = 0xa 10 | 11 | sysSOCK_RAW = 0x3 12 | ) 13 | 14 | type iovec struct { 15 | Base *byte 16 | Len uint64 17 | } 18 | 19 | type msghdr struct { 20 | Name *byte 21 | Namelen uint32 22 | Pad_cgo_0 [4]byte 23 | Iov *iovec 24 | Iovlen uint64 25 | Control *byte 26 | Controllen uint64 27 | Flags int32 28 | Pad_cgo_1 [4]byte 29 | } 30 | 31 | type mmsghdr struct { 32 | Hdr msghdr 33 | Len uint32 34 | Pad_cgo_0 [4]byte 35 | } 36 | 37 | type cmsghdr struct { 38 | Len uint64 39 | Level int32 40 | Type int32 41 | } 42 | 43 | type sockaddrInet struct { 44 | Family uint16 45 | Port uint16 46 | Addr [4]byte /* in_addr */ 47 | X__pad [8]uint8 48 | } 49 | 50 | type sockaddrInet6 struct { 51 | Family uint16 52 | Port uint16 53 | Flowinfo uint32 54 | Addr [16]byte /* in6_addr */ 55 | Scope_id uint32 56 | } 57 | 58 | const ( 59 | sizeofIovec = 0x10 60 | sizeofMsghdr = 0x38 61 | sizeofMmsghdr = 0x40 62 | sizeofCmsghdr = 0x10 63 | 64 | sizeofSockaddrInet = 0x10 65 | sizeofSockaddrInet6 = 0x1c 66 | ) 67 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/zsys_linux_mips64.go: -------------------------------------------------------------------------------- 1 | // Created by cgo -godefs - DO NOT EDIT 2 | // cgo -godefs defs_linux.go 3 | 4 | package socket 5 | 6 | const ( 7 | sysAF_UNSPEC = 0x0 8 | sysAF_INET = 0x2 9 | sysAF_INET6 = 0xa 10 | 11 | sysSOCK_RAW = 0x3 12 | ) 13 | 14 | type iovec struct { 15 | Base *byte 16 | Len uint64 17 | } 18 | 19 | type msghdr struct { 20 | Name *byte 21 | Namelen uint32 22 | Pad_cgo_0 [4]byte 23 | Iov *iovec 24 | Iovlen uint64 25 | Control *byte 26 | Controllen uint64 27 | Flags int32 28 | Pad_cgo_1 [4]byte 29 | } 30 | 31 | type mmsghdr struct { 32 | Hdr msghdr 33 | Len uint32 34 | Pad_cgo_0 [4]byte 35 | } 36 | 37 | type cmsghdr struct { 38 | Len uint64 39 | Level int32 40 | Type int32 41 | } 42 | 43 | type sockaddrInet struct { 44 | Family uint16 45 | Port uint16 46 | Addr [4]byte /* in_addr */ 47 | X__pad [8]uint8 48 | } 49 | 50 | type sockaddrInet6 struct { 51 | Family uint16 52 | Port uint16 53 | Flowinfo uint32 54 | Addr [16]byte /* in6_addr */ 55 | Scope_id uint32 56 | } 57 | 58 | const ( 59 | sizeofIovec = 0x10 60 | sizeofMsghdr = 0x38 61 | sizeofMmsghdr = 0x40 62 | sizeofCmsghdr = 0x10 63 | 64 | sizeofSockaddrInet = 0x10 65 | sizeofSockaddrInet6 = 0x1c 66 | ) 67 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/zsys_linux_mips64le.go: -------------------------------------------------------------------------------- 1 | // Created by cgo -godefs - DO NOT EDIT 2 | // cgo -godefs defs_linux.go 3 | 4 | package socket 5 | 6 | const ( 7 | sysAF_UNSPEC = 0x0 8 | sysAF_INET = 0x2 9 | sysAF_INET6 = 0xa 10 | 11 | sysSOCK_RAW = 0x3 12 | ) 13 | 14 | type iovec struct { 15 | Base *byte 16 | Len uint64 17 | } 18 | 19 | type msghdr struct { 20 | Name *byte 21 | Namelen uint32 22 | Pad_cgo_0 [4]byte 23 | Iov *iovec 24 | Iovlen uint64 25 | Control *byte 26 | Controllen uint64 27 | Flags int32 28 | Pad_cgo_1 [4]byte 29 | } 30 | 31 | type mmsghdr struct { 32 | Hdr msghdr 33 | Len uint32 34 | Pad_cgo_0 [4]byte 35 | } 36 | 37 | type cmsghdr struct { 38 | Len uint64 39 | Level int32 40 | Type int32 41 | } 42 | 43 | type sockaddrInet struct { 44 | Family uint16 45 | Port uint16 46 | Addr [4]byte /* in_addr */ 47 | X__pad [8]uint8 48 | } 49 | 50 | type sockaddrInet6 struct { 51 | Family uint16 52 | Port uint16 53 | Flowinfo uint32 54 | Addr [16]byte /* in6_addr */ 55 | Scope_id uint32 56 | } 57 | 58 | const ( 59 | sizeofIovec = 0x10 60 | sizeofMsghdr = 0x38 61 | sizeofMmsghdr = 0x40 62 | sizeofCmsghdr = 0x10 63 | 64 | sizeofSockaddrInet = 0x10 65 | sizeofSockaddrInet6 = 0x1c 66 | ) 67 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/zsys_linux_ppc64.go: -------------------------------------------------------------------------------- 1 | // Created by cgo -godefs - DO NOT EDIT 2 | // cgo -godefs defs_linux.go 3 | 4 | package socket 5 | 6 | const ( 7 | sysAF_UNSPEC = 0x0 8 | sysAF_INET = 0x2 9 | sysAF_INET6 = 0xa 10 | 11 | sysSOCK_RAW = 0x3 12 | ) 13 | 14 | type iovec struct { 15 | Base *byte 16 | Len uint64 17 | } 18 | 19 | type msghdr struct { 20 | Name *byte 21 | Namelen uint32 22 | Pad_cgo_0 [4]byte 23 | Iov *iovec 24 | Iovlen uint64 25 | Control *byte 26 | Controllen uint64 27 | Flags int32 28 | Pad_cgo_1 [4]byte 29 | } 30 | 31 | type mmsghdr struct { 32 | Hdr msghdr 33 | Len uint32 34 | Pad_cgo_0 [4]byte 35 | } 36 | 37 | type cmsghdr struct { 38 | Len uint64 39 | Level int32 40 | Type int32 41 | } 42 | 43 | type sockaddrInet struct { 44 | Family uint16 45 | Port uint16 46 | Addr [4]byte /* in_addr */ 47 | X__pad [8]uint8 48 | } 49 | 50 | type sockaddrInet6 struct { 51 | Family uint16 52 | Port uint16 53 | Flowinfo uint32 54 | Addr [16]byte /* in6_addr */ 55 | Scope_id uint32 56 | } 57 | 58 | const ( 59 | sizeofIovec = 0x10 60 | sizeofMsghdr = 0x38 61 | sizeofMmsghdr = 0x40 62 | sizeofCmsghdr = 0x10 63 | 64 | sizeofSockaddrInet = 0x10 65 | sizeofSockaddrInet6 = 0x1c 66 | ) 67 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/zsys_linux_ppc64le.go: -------------------------------------------------------------------------------- 1 | // Created by cgo -godefs - DO NOT EDIT 2 | // cgo -godefs defs_linux.go 3 | 4 | package socket 5 | 6 | const ( 7 | sysAF_UNSPEC = 0x0 8 | sysAF_INET = 0x2 9 | sysAF_INET6 = 0xa 10 | 11 | sysSOCK_RAW = 0x3 12 | ) 13 | 14 | type iovec struct { 15 | Base *byte 16 | Len uint64 17 | } 18 | 19 | type msghdr struct { 20 | Name *byte 21 | Namelen uint32 22 | Pad_cgo_0 [4]byte 23 | Iov *iovec 24 | Iovlen uint64 25 | Control *byte 26 | Controllen uint64 27 | Flags int32 28 | Pad_cgo_1 [4]byte 29 | } 30 | 31 | type mmsghdr struct { 32 | Hdr msghdr 33 | Len uint32 34 | Pad_cgo_0 [4]byte 35 | } 36 | 37 | type cmsghdr struct { 38 | Len uint64 39 | Level int32 40 | Type int32 41 | } 42 | 43 | type sockaddrInet struct { 44 | Family uint16 45 | Port uint16 46 | Addr [4]byte /* in_addr */ 47 | X__pad [8]uint8 48 | } 49 | 50 | type sockaddrInet6 struct { 51 | Family uint16 52 | Port uint16 53 | Flowinfo uint32 54 | Addr [16]byte /* in6_addr */ 55 | Scope_id uint32 56 | } 57 | 58 | const ( 59 | sizeofIovec = 0x10 60 | sizeofMsghdr = 0x38 61 | sizeofMmsghdr = 0x40 62 | sizeofCmsghdr = 0x10 63 | 64 | sizeofSockaddrInet = 0x10 65 | sizeofSockaddrInet6 = 0x1c 66 | ) 67 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/zsys_linux_s390x.go: -------------------------------------------------------------------------------- 1 | // Created by cgo -godefs - DO NOT EDIT 2 | // cgo -godefs defs_linux.go 3 | 4 | package socket 5 | 6 | const ( 7 | sysAF_UNSPEC = 0x0 8 | sysAF_INET = 0x2 9 | sysAF_INET6 = 0xa 10 | 11 | sysSOCK_RAW = 0x3 12 | ) 13 | 14 | type iovec struct { 15 | Base *byte 16 | Len uint64 17 | } 18 | 19 | type msghdr struct { 20 | Name *byte 21 | Namelen uint32 22 | Pad_cgo_0 [4]byte 23 | Iov *iovec 24 | Iovlen uint64 25 | Control *byte 26 | Controllen uint64 27 | Flags int32 28 | Pad_cgo_1 [4]byte 29 | } 30 | 31 | type mmsghdr struct { 32 | Hdr msghdr 33 | Len uint32 34 | Pad_cgo_0 [4]byte 35 | } 36 | 37 | type cmsghdr struct { 38 | Len uint64 39 | Level int32 40 | Type int32 41 | } 42 | 43 | type sockaddrInet struct { 44 | Family uint16 45 | Port uint16 46 | Addr [4]byte /* in_addr */ 47 | X__pad [8]uint8 48 | } 49 | 50 | type sockaddrInet6 struct { 51 | Family uint16 52 | Port uint16 53 | Flowinfo uint32 54 | Addr [16]byte /* in6_addr */ 55 | Scope_id uint32 56 | } 57 | 58 | const ( 59 | sizeofIovec = 0x10 60 | sizeofMsghdr = 0x38 61 | sizeofMmsghdr = 0x40 62 | sizeofCmsghdr = 0x10 63 | 64 | sizeofSockaddrInet = 0x10 65 | sizeofSockaddrInet6 = 0x1c 66 | ) 67 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/sys_go1_11_darwin.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !go1.12 6 | 7 | package socket 8 | 9 | import ( 10 | "syscall" 11 | "unsafe" 12 | ) 13 | 14 | func getsockopt(s uintptr, level, name int, b []byte) (int, error) { 15 | l := uint32(len(b)) 16 | _, _, errno := syscall.Syscall6(syscall.SYS_GETSOCKOPT, s, uintptr(level), uintptr(name), uintptr(unsafe.Pointer(&b[0])), uintptr(unsafe.Pointer(&l)), 0) 17 | return int(l), errnoErr(errno) 18 | } 19 | 20 | func setsockopt(s uintptr, level, name int, b []byte) error { 21 | _, _, errno := syscall.Syscall6(syscall.SYS_SETSOCKOPT, s, uintptr(level), uintptr(name), uintptr(unsafe.Pointer(&b[0])), uintptr(len(b)), 0) 22 | return errnoErr(errno) 23 | } 24 | 25 | func recvmsg(s uintptr, h *msghdr, flags int) (int, error) { 26 | n, _, errno := syscall.Syscall(syscall.SYS_RECVMSG, s, uintptr(unsafe.Pointer(h)), uintptr(flags)) 27 | return int(n), errnoErr(errno) 28 | } 29 | 30 | func sendmsg(s uintptr, h *msghdr, flags int) (int, error) { 31 | n, _, errno := syscall.Syscall(syscall.SYS_SENDMSG, s, uintptr(unsafe.Pointer(h)), uintptr(flags)) 32 | return int(n), errnoErr(errno) 33 | } 34 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/ipv4/sockopt_stub.go: -------------------------------------------------------------------------------- 1 | // Copyright 2012 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !aix,!darwin,!dragonfly,!freebsd,!linux,!netbsd,!openbsd,!solaris,!windows 6 | 7 | package ipv4 8 | 9 | import ( 10 | "net" 11 | 12 | "golang.org/x/net/bpf" 13 | "golang.org/x/net/internal/socket" 14 | ) 15 | 16 | func (so *sockOpt) getMulticastInterface(c *socket.Conn) (*net.Interface, error) { 17 | return nil, errNotImplemented 18 | } 19 | 20 | func (so *sockOpt) setMulticastInterface(c *socket.Conn, ifi *net.Interface) error { 21 | return errNotImplemented 22 | } 23 | 24 | func (so *sockOpt) getICMPFilter(c *socket.Conn) (*ICMPFilter, error) { 25 | return nil, errNotImplemented 26 | } 27 | 28 | func (so *sockOpt) setICMPFilter(c *socket.Conn, f *ICMPFilter) error { 29 | return errNotImplemented 30 | } 31 | 32 | func (so *sockOpt) setGroup(c *socket.Conn, ifi *net.Interface, grp net.IP) error { 33 | return errNotImplemented 34 | } 35 | 36 | func (so *sockOpt) setSourceGroup(c *socket.Conn, ifi *net.Interface, grp, src net.IP) error { 37 | return errNotImplemented 38 | } 39 | 40 | func (so *sockOpt) setBPF(c *socket.Conn, f []bpf.RawInstruction) error { 41 | return errNotImplemented 42 | } 43 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/zsys_netbsd_amd64.go: -------------------------------------------------------------------------------- 1 | // Created by cgo -godefs - DO NOT EDIT 2 | // cgo -godefs defs_netbsd.go 3 | 4 | package socket 5 | 6 | const ( 7 | sysAF_UNSPEC = 0x0 8 | sysAF_INET = 0x2 9 | sysAF_INET6 = 0x18 10 | 11 | sysSOCK_RAW = 0x3 12 | ) 13 | 14 | type iovec struct { 15 | Base *byte 16 | Len uint64 17 | } 18 | 19 | type msghdr struct { 20 | Name *byte 21 | Namelen uint32 22 | Pad_cgo_0 [4]byte 23 | Iov *iovec 24 | Iovlen int32 25 | Pad_cgo_1 [4]byte 26 | Control *byte 27 | Controllen uint32 28 | Flags int32 29 | } 30 | 31 | type mmsghdr struct { 32 | Hdr msghdr 33 | Len uint32 34 | Pad_cgo_0 [4]byte 35 | } 36 | 37 | type cmsghdr struct { 38 | Len uint32 39 | Level int32 40 | Type int32 41 | } 42 | 43 | type sockaddrInet struct { 44 | Len uint8 45 | Family uint8 46 | Port uint16 47 | Addr [4]byte /* in_addr */ 48 | Zero [8]int8 49 | } 50 | 51 | type sockaddrInet6 struct { 52 | Len uint8 53 | Family uint8 54 | Port uint16 55 | Flowinfo uint32 56 | Addr [16]byte /* in6_addr */ 57 | Scope_id uint32 58 | } 59 | 60 | const ( 61 | sizeofIovec = 0x10 62 | sizeofMsghdr = 0x30 63 | sizeofMmsghdr = 0x40 64 | sizeofCmsghdr = 0xc 65 | 66 | sizeofSockaddrInet = 0x10 67 | sizeofSockaddrInet6 = 0x1c 68 | ) 69 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/sys_unix.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build dragonfly freebsd linux,!s390x,!386 netbsd openbsd 6 | 7 | package socket 8 | 9 | import ( 10 | "syscall" 11 | "unsafe" 12 | ) 13 | 14 | func getsockopt(s uintptr, level, name int, b []byte) (int, error) { 15 | l := uint32(len(b)) 16 | _, _, errno := syscall.Syscall6(syscall.SYS_GETSOCKOPT, s, uintptr(level), uintptr(name), uintptr(unsafe.Pointer(&b[0])), uintptr(unsafe.Pointer(&l)), 0) 17 | return int(l), errnoErr(errno) 18 | } 19 | 20 | func setsockopt(s uintptr, level, name int, b []byte) error { 21 | _, _, errno := syscall.Syscall6(syscall.SYS_SETSOCKOPT, s, uintptr(level), uintptr(name), uintptr(unsafe.Pointer(&b[0])), uintptr(len(b)), 0) 22 | return errnoErr(errno) 23 | } 24 | 25 | func recvmsg(s uintptr, h *msghdr, flags int) (int, error) { 26 | n, _, errno := syscall.Syscall(syscall.SYS_RECVMSG, s, uintptr(unsafe.Pointer(h)), uintptr(flags)) 27 | return int(n), errnoErr(errno) 28 | } 29 | 30 | func sendmsg(s uintptr, h *msghdr, flags int) (int, error) { 31 | n, _, errno := syscall.Syscall(syscall.SYS_SENDMSG, s, uintptr(unsafe.Pointer(h)), uintptr(flags)) 32 | return int(n), errnoErr(errno) 33 | } 34 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/icmp/listen_stub.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !aix,!darwin,!dragonfly,!freebsd,!linux,!netbsd,!openbsd,!solaris,!windows 6 | 7 | package icmp 8 | 9 | // ListenPacket listens for incoming ICMP packets addressed to 10 | // address. See net.Dial for the syntax of address. 11 | // 12 | // For non-privileged datagram-oriented ICMP endpoints, network must 13 | // be "udp4" or "udp6". The endpoint allows to read, write a few 14 | // limited ICMP messages such as echo request and echo reply. 15 | // Currently only Darwin and Linux support this. 16 | // 17 | // Examples: 18 | // ListenPacket("udp4", "192.168.0.1") 19 | // ListenPacket("udp4", "0.0.0.0") 20 | // ListenPacket("udp6", "fe80::1%en0") 21 | // ListenPacket("udp6", "::") 22 | // 23 | // For privileged raw ICMP endpoints, network must be "ip4" or "ip6" 24 | // followed by a colon and an ICMP protocol number or name. 25 | // 26 | // Examples: 27 | // ListenPacket("ip4:icmp", "192.168.0.1") 28 | // ListenPacket("ip4:1", "0.0.0.0") 29 | // ListenPacket("ip6:ipv6-icmp", "fe80::1%en0") 30 | // ListenPacket("ip6:58", "::") 31 | func ListenPacket(network, address string) (*PacketConn, error) { 32 | return nil, errNotImplemented 33 | } 34 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Go-MTR 2 | ------ 3 | ## 简介 4 | ### MTR 5 | > 程序基于: 6 | > https://github.com/tonobo/mtr 7 | > https://github.com/liuxinglanyue/mtr 8 | > 进行了一定的bug修复和优化开发。支持单机多协程并发mtr探测,同时支持ipv4和ipv6。 9 | 10 | ### PING 11 | > 支持单机多协程发起ping探测,同时支持ipv4和ipv6 12 | 13 | ## 案例 14 | ``` 15 | var targets = []string{"216.58.200.78", "52.74.223.119", "123.125.114.144"} 16 | 17 | func main() { 18 | // 发起mtr操作 19 | for _, val := range targets { 20 | go func(target string) { 21 | for { 22 | mm, err := mtr.Mtr(target, 30, 10, 800) 23 | if err != nil { 24 | fmt.Println(err) 25 | } 26 | fmt.Println(mm) 27 | 28 | time.Sleep(60 * time.Second) 29 | } 30 | }(val) 31 | } 32 | 33 | // 发起ping操作 34 | for _, val := range targets { 35 | go func(target string) { 36 | for { 37 | mm, err := ping.Ping(target, 10, 800, 10) 38 | if err != nil { 39 | fmt.Println(err) 40 | } 41 | fmt.Println(mm) 42 | 43 | time.Sleep(60 * time.Second) 44 | } 45 | }(val) 46 | } 47 | 48 | select {} 49 | } 50 | 51 | ``` 52 | 53 | *注:针对mtr可设定的参数包括maxHops(最大跳数)、sntSize(发送数据包数量)、timeoutMs(icmp包超时时间)。针对ping探测可设定的参数包括count(数据包数量)、timeoutMs(超时时间)、intervalMs(发包间隔)* 54 | 55 | ## 原理 56 | > mtr发送icmp数据报,先发送TTL为1的,到第一个路由器TTL减1,并返回一个超时的ICMP报文,这样就得到了第一个路由器的地址; 接下来发送TTL值为2的报文,得到第二个路由器的报文; 直到找到目的IP地址,mtr一次探测结束。然后根据发送数据包的数量,重新发起mtr探测,记录结果。 57 | 58 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/zsys_aix_ppc64.go: -------------------------------------------------------------------------------- 1 | // Code generated by cmd/cgo -godefs; DO NOT EDIT. 2 | // cgo -godefs defs_aix.go 3 | 4 | // Added for go1.11 compatibility 5 | // +build aix 6 | 7 | package socket 8 | 9 | const ( 10 | sysAF_UNSPEC = 0x0 11 | sysAF_INET = 0x2 12 | sysAF_INET6 = 0x18 13 | 14 | sysSOCK_RAW = 0x3 15 | ) 16 | 17 | type iovec struct { 18 | Base *byte 19 | Len uint64 20 | } 21 | 22 | type msghdr struct { 23 | Name *byte 24 | Namelen uint32 25 | Iov *iovec 26 | Iovlen int32 27 | Control *byte 28 | Controllen uint32 29 | Flags int32 30 | } 31 | 32 | type mmsghdr struct { 33 | Hdr msghdr 34 | Len uint32 35 | Pad_cgo_0 [4]byte 36 | } 37 | 38 | type cmsghdr struct { 39 | Len uint32 40 | Level int32 41 | Type int32 42 | } 43 | 44 | type sockaddrInet struct { 45 | Len uint8 46 | Family uint8 47 | Port uint16 48 | Addr [4]byte /* in_addr */ 49 | Zero [8]uint8 50 | } 51 | 52 | type sockaddrInet6 struct { 53 | Len uint8 54 | Family uint8 55 | Port uint16 56 | Flowinfo uint32 57 | Addr [16]byte /* in6_addr */ 58 | Scope_id uint32 59 | } 60 | 61 | const ( 62 | sizeofIovec = 0x10 63 | sizeofMsghdr = 0x30 64 | sizeofMmsghdr = 0x38 65 | sizeofCmsghdr = 0xc 66 | 67 | sizeofSockaddrInet = 0x10 68 | sizeofSockaddrInet6 = 0x1c 69 | ) 70 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/PATENTS: -------------------------------------------------------------------------------- 1 | Additional IP Rights Grant (Patents) 2 | 3 | "This implementation" means the copyrightable works distributed by 4 | Google as part of the Go project. 5 | 6 | Google hereby grants to You a perpetual, worldwide, non-exclusive, 7 | no-charge, royalty-free, irrevocable (except as stated in this section) 8 | patent license to make, have made, use, offer to sell, sell, import, 9 | transfer and otherwise run, modify and propagate the contents of this 10 | implementation of Go, where such license applies only to those patent 11 | claims, both currently owned or controlled by Google and acquired in 12 | the future, licensable by Google that are necessarily infringed by this 13 | implementation of Go. This grant does not include claims that would be 14 | infringed only as a consequence of further modification of this 15 | implementation. If you or your agent or exclusive licensee institute or 16 | order or agree to the institution of patent litigation against any 17 | entity (including a cross-claim or counterclaim in a lawsuit) alleging 18 | that this implementation of Go or any code incorporated within this 19 | implementation of Go constitutes direct or contributory patent 20 | infringement, or inducement of patent infringement, then any patent 21 | rights granted to you under this License for this implementation of Go 22 | shall terminate as of the date such litigation is filed. 23 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/icmp/packettoobig.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package icmp 6 | 7 | import "encoding/binary" 8 | 9 | // A PacketTooBig represents an ICMP packet too big message body. 10 | type PacketTooBig struct { 11 | MTU int // maximum transmission unit of the nexthop link 12 | Data []byte // data, known as original datagram field 13 | } 14 | 15 | // Len implements the Len method of MessageBody interface. 16 | func (p *PacketTooBig) Len(proto int) int { 17 | if p == nil { 18 | return 0 19 | } 20 | return 4 + len(p.Data) 21 | } 22 | 23 | // Marshal implements the Marshal method of MessageBody interface. 24 | func (p *PacketTooBig) Marshal(proto int) ([]byte, error) { 25 | b := make([]byte, 4+len(p.Data)) 26 | binary.BigEndian.PutUint32(b[:4], uint32(p.MTU)) 27 | copy(b[4:], p.Data) 28 | return b, nil 29 | } 30 | 31 | // parsePacketTooBig parses b as an ICMP packet too big message body. 32 | func parsePacketTooBig(proto int, _ Type, b []byte) (MessageBody, error) { 33 | bodyLen := len(b) 34 | if bodyLen < 4 { 35 | return nil, errMessageTooShort 36 | } 37 | p := &PacketTooBig{MTU: int(binary.BigEndian.Uint32(b[:4]))} 38 | if bodyLen > 4 { 39 | p.Data = make([]byte, bodyLen-4) 40 | copy(p.Data, b[4:]) 41 | } 42 | return p, nil 43 | } 44 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/ipv6/helper.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package ipv6 6 | 7 | import ( 8 | "errors" 9 | "net" 10 | "runtime" 11 | ) 12 | 13 | var ( 14 | errInvalidConn = errors.New("invalid connection") 15 | errMissingAddress = errors.New("missing address") 16 | errHeaderTooShort = errors.New("header too short") 17 | errInvalidConnType = errors.New("invalid conn type") 18 | errNoSuchInterface = errors.New("no such interface") 19 | errNotImplemented = errors.New("not implemented on " + runtime.GOOS + "/" + runtime.GOARCH) 20 | ) 21 | 22 | func boolint(b bool) int { 23 | if b { 24 | return 1 25 | } 26 | return 0 27 | } 28 | 29 | func netAddrToIP16(a net.Addr) net.IP { 30 | switch v := a.(type) { 31 | case *net.UDPAddr: 32 | if ip := v.IP.To16(); ip != nil && ip.To4() == nil { 33 | return ip 34 | } 35 | case *net.IPAddr: 36 | if ip := v.IP.To16(); ip != nil && ip.To4() == nil { 37 | return ip 38 | } 39 | } 40 | return nil 41 | } 42 | 43 | func opAddr(a net.Addr) net.Addr { 44 | switch a.(type) { 45 | case *net.TCPAddr: 46 | if a == nil { 47 | return nil 48 | } 49 | case *net.UDPAddr: 50 | if a == nil { 51 | return nil 52 | } 53 | case *net.IPAddr: 54 | if a == nil { 55 | return nil 56 | } 57 | } 58 | return a 59 | } 60 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/bpf/asm.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package bpf 6 | 7 | import "fmt" 8 | 9 | // Assemble converts insts into raw instructions suitable for loading 10 | // into a BPF virtual machine. 11 | // 12 | // Currently, no optimization is attempted, the assembled program flow 13 | // is exactly as provided. 14 | func Assemble(insts []Instruction) ([]RawInstruction, error) { 15 | ret := make([]RawInstruction, len(insts)) 16 | var err error 17 | for i, inst := range insts { 18 | ret[i], err = inst.Assemble() 19 | if err != nil { 20 | return nil, fmt.Errorf("assembling instruction %d: %s", i+1, err) 21 | } 22 | } 23 | return ret, nil 24 | } 25 | 26 | // Disassemble attempts to parse raw back into 27 | // Instructions. Unrecognized RawInstructions are assumed to be an 28 | // extension not implemented by this package, and are passed through 29 | // unchanged to the output. The allDecoded value reports whether insts 30 | // contains no RawInstructions. 31 | func Disassemble(raw []RawInstruction) (insts []Instruction, allDecoded bool) { 32 | insts = make([]Instruction, len(raw)) 33 | allDecoded = true 34 | for i, r := range raw { 35 | insts[i] = r.Disassemble() 36 | if _, ok := insts[i].(RawInstruction); ok { 37 | allDecoded = false 38 | } 39 | } 40 | return insts, allDecoded 41 | } 42 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/ipv6/sockopt_stub.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !aix,!darwin,!dragonfly,!freebsd,!linux,!netbsd,!openbsd,!solaris,!windows 6 | 7 | package ipv6 8 | 9 | import ( 10 | "net" 11 | 12 | "golang.org/x/net/bpf" 13 | "golang.org/x/net/internal/socket" 14 | ) 15 | 16 | func (so *sockOpt) getMulticastInterface(c *socket.Conn) (*net.Interface, error) { 17 | return nil, errNotImplemented 18 | } 19 | 20 | func (so *sockOpt) setMulticastInterface(c *socket.Conn, ifi *net.Interface) error { 21 | return errNotImplemented 22 | } 23 | 24 | func (so *sockOpt) getICMPFilter(c *socket.Conn) (*ICMPFilter, error) { 25 | return nil, errNotImplemented 26 | } 27 | 28 | func (so *sockOpt) setICMPFilter(c *socket.Conn, f *ICMPFilter) error { 29 | return errNotImplemented 30 | } 31 | 32 | func (so *sockOpt) getMTUInfo(c *socket.Conn) (*net.Interface, int, error) { 33 | return nil, 0, errNotImplemented 34 | } 35 | 36 | func (so *sockOpt) setGroup(c *socket.Conn, ifi *net.Interface, grp net.IP) error { 37 | return errNotImplemented 38 | } 39 | 40 | func (so *sockOpt) setSourceGroup(c *socket.Conn, ifi *net.Interface, grp, src net.IP) error { 41 | return errNotImplemented 42 | } 43 | 44 | func (so *sockOpt) setBPF(c *socket.Conn, f []bpf.RawInstruction) error { 45 | return errNotImplemented 46 | } 47 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/ipv4/genericopt.go: -------------------------------------------------------------------------------- 1 | // Copyright 2012 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package ipv4 6 | 7 | // TOS returns the type-of-service field value for outgoing packets. 8 | func (c *genericOpt) TOS() (int, error) { 9 | if !c.ok() { 10 | return 0, errInvalidConn 11 | } 12 | so, ok := sockOpts[ssoTOS] 13 | if !ok { 14 | return 0, errNotImplemented 15 | } 16 | return so.GetInt(c.Conn) 17 | } 18 | 19 | // SetTOS sets the type-of-service field value for future outgoing 20 | // packets. 21 | func (c *genericOpt) SetTOS(tos int) error { 22 | if !c.ok() { 23 | return errInvalidConn 24 | } 25 | so, ok := sockOpts[ssoTOS] 26 | if !ok { 27 | return errNotImplemented 28 | } 29 | return so.SetInt(c.Conn, tos) 30 | } 31 | 32 | // TTL returns the time-to-live field value for outgoing packets. 33 | func (c *genericOpt) TTL() (int, error) { 34 | if !c.ok() { 35 | return 0, errInvalidConn 36 | } 37 | so, ok := sockOpts[ssoTTL] 38 | if !ok { 39 | return 0, errNotImplemented 40 | } 41 | return so.GetInt(c.Conn) 42 | } 43 | 44 | // SetTTL sets the time-to-live field value for future outgoing 45 | // packets. 46 | func (c *genericOpt) SetTTL(ttl int) error { 47 | if !c.ok() { 48 | return errInvalidConn 49 | } 50 | so, ok := sockOpts[ssoTTL] 51 | if !ok { 52 | return errNotImplemented 53 | } 54 | return so.SetInt(c.Conn, ttl) 55 | } 56 | -------------------------------------------------------------------------------- /vendor/vendor.json: -------------------------------------------------------------------------------- 1 | { 2 | "comment": "", 3 | "ignore": "test", 4 | "package": [ 5 | { 6 | "checksumSHA1": "Pa6ivEz5fid3ECb1hptNbC+USfA=", 7 | "path": "golang.org/x/net/bpf", 8 | "revision": "3ec19112720433827bbce8be9342797f5a6aaaf9", 9 | "revisionTime": "2019-05-12T12:16:34Z" 10 | }, 11 | { 12 | "checksumSHA1": "j5FGJYl3LlrNQ3745UWjjAeyHy0=", 13 | "path": "golang.org/x/net/icmp", 14 | "revision": "3ec19112720433827bbce8be9342797f5a6aaaf9", 15 | "revisionTime": "2019-05-12T12:16:34Z" 16 | }, 17 | { 18 | "checksumSHA1": "CHpYrf4HcmHB60gnTNxgjGgY53w=", 19 | "path": "golang.org/x/net/internal/iana", 20 | "revision": "3ec19112720433827bbce8be9342797f5a6aaaf9", 21 | "revisionTime": "2019-05-12T12:16:34Z" 22 | }, 23 | { 24 | "checksumSHA1": "YOlvIj0lZ+0hXFFdewmBE0vQM9M=", 25 | "path": "golang.org/x/net/internal/socket", 26 | "revision": "3ec19112720433827bbce8be9342797f5a6aaaf9", 27 | "revisionTime": "2019-05-12T12:16:34Z" 28 | }, 29 | { 30 | "checksumSHA1": "h1Rl2vQ1yBAo5TEX4mJmlBD8oLg=", 31 | "path": "golang.org/x/net/ipv4", 32 | "revision": "3ec19112720433827bbce8be9342797f5a6aaaf9", 33 | "revisionTime": "2019-05-12T12:16:34Z" 34 | }, 35 | { 36 | "checksumSHA1": "K6ClTBgPcvOWK08yU4XvPXY6MYQ=", 37 | "path": "golang.org/x/net/ipv6", 38 | "revision": "3ec19112720433827bbce8be9342797f5a6aaaf9", 39 | "revisionTime": "2019-05-12T12:16:34Z" 40 | } 41 | ], 42 | "rootPath": "github.com/ylwang1122/go-mtr" 43 | } 44 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/ipv4/sys_ssmreq.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build darwin freebsd linux solaris 6 | 7 | package ipv4 8 | 9 | import ( 10 | "net" 11 | "unsafe" 12 | 13 | "golang.org/x/net/internal/socket" 14 | ) 15 | 16 | func (so *sockOpt) setGroupReq(c *socket.Conn, ifi *net.Interface, grp net.IP) error { 17 | var gr groupReq 18 | if ifi != nil { 19 | gr.Interface = uint32(ifi.Index) 20 | } 21 | gr.setGroup(grp) 22 | var b []byte 23 | if compatFreeBSD32 { 24 | var d [sizeofGroupReq + 4]byte 25 | s := (*[sizeofGroupReq]byte)(unsafe.Pointer(&gr)) 26 | copy(d[:4], s[:4]) 27 | copy(d[8:], s[4:]) 28 | b = d[:] 29 | } else { 30 | b = (*[sizeofGroupReq]byte)(unsafe.Pointer(&gr))[:sizeofGroupReq] 31 | } 32 | return so.Set(c, b) 33 | } 34 | 35 | func (so *sockOpt) setGroupSourceReq(c *socket.Conn, ifi *net.Interface, grp, src net.IP) error { 36 | var gsr groupSourceReq 37 | if ifi != nil { 38 | gsr.Interface = uint32(ifi.Index) 39 | } 40 | gsr.setSourceGroup(grp, src) 41 | var b []byte 42 | if compatFreeBSD32 { 43 | var d [sizeofGroupSourceReq + 4]byte 44 | s := (*[sizeofGroupSourceReq]byte)(unsafe.Pointer(&gsr)) 45 | copy(d[:4], s[:4]) 46 | copy(d[8:], s[4:]) 47 | b = d[:] 48 | } else { 49 | b = (*[sizeofGroupSourceReq]byte)(unsafe.Pointer(&gsr))[:sizeofGroupSourceReq] 50 | } 51 | return so.Set(c, b) 52 | } 53 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/ipv6/payload_nocmsg.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !aix,!darwin,!dragonfly,!freebsd,!linux,!netbsd,!openbsd,!solaris 6 | 7 | package ipv6 8 | 9 | import "net" 10 | 11 | // ReadFrom reads a payload of the received IPv6 datagram, from the 12 | // endpoint c, copying the payload into b. It returns the number of 13 | // bytes copied into b, the control message cm and the source address 14 | // src of the received datagram. 15 | func (c *payloadHandler) ReadFrom(b []byte) (n int, cm *ControlMessage, src net.Addr, err error) { 16 | if !c.ok() { 17 | return 0, nil, nil, errInvalidConn 18 | } 19 | if n, src, err = c.PacketConn.ReadFrom(b); err != nil { 20 | return 0, nil, nil, err 21 | } 22 | return 23 | } 24 | 25 | // WriteTo writes a payload of the IPv6 datagram, to the destination 26 | // address dst through the endpoint c, copying the payload from b. It 27 | // returns the number of bytes written. The control message cm allows 28 | // the IPv6 header fields and the datagram path to be specified. The 29 | // cm may be nil if control of the outgoing datagram is not required. 30 | func (c *payloadHandler) WriteTo(b []byte, cm *ControlMessage, dst net.Addr) (n int, err error) { 31 | if !c.ok() { 32 | return 0, errInvalidConn 33 | } 34 | if dst == nil { 35 | return 0, errMissingAddress 36 | } 37 | return c.PacketConn.WriteTo(b, dst) 38 | } 39 | -------------------------------------------------------------------------------- /common/func.go: -------------------------------------------------------------------------------- 1 | package common 2 | 3 | import ( 4 | "fmt" 5 | "net" 6 | "runtime" 7 | "strconv" 8 | "strings" 9 | "time" 10 | ) 11 | 12 | // 使用本地的localdns对域名进行解析获取其ip 13 | func DestAddrs(addr string) ([]string, error) { 14 | addrs, err := net.LookupHost(addr) 15 | if err != nil { 16 | return nil, err 17 | } 18 | 19 | // 判定获取到的ip地址是否都是ip 20 | ipAddrs := make([]string, 0) 21 | for _, addr := range addrs { 22 | ipAddr, err := net.ResolveIPAddr("ip", addr) 23 | if err != nil { 24 | continue 25 | } 26 | 27 | ipAddrs = append(ipAddrs, ipAddr.IP.String()) 28 | } 29 | 30 | return ipAddrs, nil 31 | } 32 | 33 | // 获取协程id 34 | func Goid() int { 35 | defer func() { 36 | if err := recover(); err != nil { 37 | fmt.Println("panic recover:panic info:%v", err) 38 | } 39 | }() 40 | 41 | var buf [64]byte 42 | n := runtime.Stack(buf[:], false) 43 | idField := strings.Fields(strings.TrimPrefix(string(buf[:n]), "goroutine "))[0] 44 | id, err := strconv.Atoi(idField) 45 | if err != nil { 46 | panic(fmt.Sprintf("cannot get goroutine id: %v", err)) 47 | } 48 | return id 49 | } 50 | 51 | // 判定ip相等 52 | func IsEqualIp(ips1, ips2 string) bool { 53 | ip1 := net.ParseIP(ips1) 54 | if ip1 == nil { 55 | return false 56 | } 57 | 58 | ip2 := net.ParseIP(ips2) 59 | if ip2 == nil { 60 | return false 61 | } 62 | 63 | if ip1.String() != ip2.String() { 64 | return false 65 | } 66 | 67 | return true 68 | } 69 | 70 | // 时间转换为float32 71 | func Time2Float(t time.Duration) float32 { 72 | return (float32)(t/time.Microsecond) / float32(1000) 73 | } 74 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/ipv6/sys_ssmreq.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build aix darwin freebsd linux solaris 6 | 7 | package ipv6 8 | 9 | import ( 10 | "net" 11 | "unsafe" 12 | 13 | "golang.org/x/net/internal/socket" 14 | ) 15 | 16 | var compatFreeBSD32 bool // 386 emulation on amd64 17 | 18 | func (so *sockOpt) setGroupReq(c *socket.Conn, ifi *net.Interface, grp net.IP) error { 19 | var gr groupReq 20 | if ifi != nil { 21 | gr.Interface = uint32(ifi.Index) 22 | } 23 | gr.setGroup(grp) 24 | var b []byte 25 | if compatFreeBSD32 { 26 | var d [sizeofGroupReq + 4]byte 27 | s := (*[sizeofGroupReq]byte)(unsafe.Pointer(&gr)) 28 | copy(d[:4], s[:4]) 29 | copy(d[8:], s[4:]) 30 | b = d[:] 31 | } else { 32 | b = (*[sizeofGroupReq]byte)(unsafe.Pointer(&gr))[:sizeofGroupReq] 33 | } 34 | return so.Set(c, b) 35 | } 36 | 37 | func (so *sockOpt) setGroupSourceReq(c *socket.Conn, ifi *net.Interface, grp, src net.IP) error { 38 | var gsr groupSourceReq 39 | if ifi != nil { 40 | gsr.Interface = uint32(ifi.Index) 41 | } 42 | gsr.setSourceGroup(grp, src) 43 | var b []byte 44 | if compatFreeBSD32 { 45 | var d [sizeofGroupSourceReq + 4]byte 46 | s := (*[sizeofGroupSourceReq]byte)(unsafe.Pointer(&gsr)) 47 | copy(d[:4], s[:4]) 48 | copy(d[8:], s[4:]) 49 | b = d[:] 50 | } else { 51 | b = (*[sizeofGroupSourceReq]byte)(unsafe.Pointer(&gsr))[:sizeofGroupSourceReq] 52 | } 53 | return so.Set(c, b) 54 | } 55 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/ipv6/genericopt.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package ipv6 6 | 7 | // TrafficClass returns the traffic class field value for outgoing 8 | // packets. 9 | func (c *genericOpt) TrafficClass() (int, error) { 10 | if !c.ok() { 11 | return 0, errInvalidConn 12 | } 13 | so, ok := sockOpts[ssoTrafficClass] 14 | if !ok { 15 | return 0, errNotImplemented 16 | } 17 | return so.GetInt(c.Conn) 18 | } 19 | 20 | // SetTrafficClass sets the traffic class field value for future 21 | // outgoing packets. 22 | func (c *genericOpt) SetTrafficClass(tclass int) error { 23 | if !c.ok() { 24 | return errInvalidConn 25 | } 26 | so, ok := sockOpts[ssoTrafficClass] 27 | if !ok { 28 | return errNotImplemented 29 | } 30 | return so.SetInt(c.Conn, tclass) 31 | } 32 | 33 | // HopLimit returns the hop limit field value for outgoing packets. 34 | func (c *genericOpt) HopLimit() (int, error) { 35 | if !c.ok() { 36 | return 0, errInvalidConn 37 | } 38 | so, ok := sockOpts[ssoHopLimit] 39 | if !ok { 40 | return 0, errNotImplemented 41 | } 42 | return so.GetInt(c.Conn) 43 | } 44 | 45 | // SetHopLimit sets the hop limit field value for future outgoing 46 | // packets. 47 | func (c *genericOpt) SetHopLimit(hoplim int) error { 48 | if !c.ok() { 49 | return errInvalidConn 50 | } 51 | so, ok := sockOpts[ssoHopLimit] 52 | if !ok { 53 | return errNotImplemented 54 | } 55 | return so.SetInt(c.Conn, hoplim) 56 | } 57 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/ipv4/payload_nocmsg.go: -------------------------------------------------------------------------------- 1 | // Copyright 2012 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !aix,!darwin,!dragonfly,!freebsd,!linux,!netbsd,!openbsd,!solaris 6 | 7 | package ipv4 8 | 9 | import "net" 10 | 11 | // ReadFrom reads a payload of the received IPv4 datagram, from the 12 | // endpoint c, copying the payload into b. It returns the number of 13 | // bytes copied into b, the control message cm and the source address 14 | // src of the received datagram. 15 | func (c *payloadHandler) ReadFrom(b []byte) (n int, cm *ControlMessage, src net.Addr, err error) { 16 | if !c.ok() { 17 | return 0, nil, nil, errInvalidConn 18 | } 19 | if n, src, err = c.PacketConn.ReadFrom(b); err != nil { 20 | return 0, nil, nil, err 21 | } 22 | return 23 | } 24 | 25 | // WriteTo writes a payload of the IPv4 datagram, to the destination 26 | // address dst through the endpoint c, copying the payload from b. It 27 | // returns the number of bytes written. The control message cm allows 28 | // the datagram path and the outgoing interface to be specified. 29 | // Currently only Darwin and Linux support this. The cm may be nil if 30 | // control of the outgoing datagram is not required. 31 | func (c *payloadHandler) WriteTo(b []byte, cm *ControlMessage, dst net.Addr) (n int, err error) { 32 | if !c.ok() { 33 | return 0, errInvalidConn 34 | } 35 | if dst == nil { 36 | return 0, errMissingAddress 37 | } 38 | return c.PacketConn.WriteTo(b, dst) 39 | } 40 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/ipv6/control_rfc2292_unix.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build darwin 6 | 7 | package ipv6 8 | 9 | import ( 10 | "unsafe" 11 | 12 | "golang.org/x/net/internal/iana" 13 | "golang.org/x/net/internal/socket" 14 | ) 15 | 16 | func marshal2292HopLimit(b []byte, cm *ControlMessage) []byte { 17 | m := socket.ControlMessage(b) 18 | m.MarshalHeader(iana.ProtocolIPv6, sysIPV6_2292HOPLIMIT, 4) 19 | if cm != nil { 20 | socket.NativeEndian.PutUint32(m.Data(4), uint32(cm.HopLimit)) 21 | } 22 | return m.Next(4) 23 | } 24 | 25 | func marshal2292PacketInfo(b []byte, cm *ControlMessage) []byte { 26 | m := socket.ControlMessage(b) 27 | m.MarshalHeader(iana.ProtocolIPv6, sysIPV6_2292PKTINFO, sizeofInet6Pktinfo) 28 | if cm != nil { 29 | pi := (*inet6Pktinfo)(unsafe.Pointer(&m.Data(sizeofInet6Pktinfo)[0])) 30 | if ip := cm.Src.To16(); ip != nil && ip.To4() == nil { 31 | copy(pi.Addr[:], ip) 32 | } 33 | if cm.IfIndex > 0 { 34 | pi.setIfindex(cm.IfIndex) 35 | } 36 | } 37 | return m.Next(sizeofInet6Pktinfo) 38 | } 39 | 40 | func marshal2292NextHop(b []byte, cm *ControlMessage) []byte { 41 | m := socket.ControlMessage(b) 42 | m.MarshalHeader(iana.ProtocolIPv6, sysIPV6_2292NEXTHOP, sizeofSockaddrInet6) 43 | if cm != nil { 44 | sa := (*sockaddrInet6)(unsafe.Pointer(&m.Data(sizeofSockaddrInet6)[0])) 45 | sa.setSockaddr(cm.NextHop, cm.IfIndex) 46 | } 47 | return m.Next(sizeofSockaddrInet6) 48 | } 49 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2009 The Go Authors. All rights reserved. 2 | 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions are 5 | met: 6 | 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above 10 | copyright notice, this list of conditions and the following disclaimer 11 | in the documentation and/or other materials provided with the 12 | distribution. 13 | * Neither the name of Google Inc. nor the names of its 14 | contributors may be used to endorse or promote products derived from 15 | this software without specific prior written permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/ipv4/iana.go: -------------------------------------------------------------------------------- 1 | // go generate gen.go 2 | // Code generated by the command above; DO NOT EDIT. 3 | 4 | package ipv4 5 | 6 | // Internet Control Message Protocol (ICMP) Parameters, Updated: 2018-02-26 7 | const ( 8 | ICMPTypeEchoReply ICMPType = 0 // Echo Reply 9 | ICMPTypeDestinationUnreachable ICMPType = 3 // Destination Unreachable 10 | ICMPTypeRedirect ICMPType = 5 // Redirect 11 | ICMPTypeEcho ICMPType = 8 // Echo 12 | ICMPTypeRouterAdvertisement ICMPType = 9 // Router Advertisement 13 | ICMPTypeRouterSolicitation ICMPType = 10 // Router Solicitation 14 | ICMPTypeTimeExceeded ICMPType = 11 // Time Exceeded 15 | ICMPTypeParameterProblem ICMPType = 12 // Parameter Problem 16 | ICMPTypeTimestamp ICMPType = 13 // Timestamp 17 | ICMPTypeTimestampReply ICMPType = 14 // Timestamp Reply 18 | ICMPTypePhoturis ICMPType = 40 // Photuris 19 | ICMPTypeExtendedEchoRequest ICMPType = 42 // Extended Echo Request 20 | ICMPTypeExtendedEchoReply ICMPType = 43 // Extended Echo Reply 21 | ) 22 | 23 | // Internet Control Message Protocol (ICMP) Parameters, Updated: 2018-02-26 24 | var icmpTypes = map[ICMPType]string{ 25 | 0: "echo reply", 26 | 3: "destination unreachable", 27 | 5: "redirect", 28 | 8: "echo", 29 | 9: "router advertisement", 30 | 10: "router solicitation", 31 | 11: "time exceeded", 32 | 12: "parameter problem", 33 | 13: "timestamp", 34 | 14: "timestamp reply", 35 | 40: "photuris", 36 | 42: "extended echo request", 37 | 43: "extended echo reply", 38 | } 39 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/ipv6/control_unix.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build aix darwin dragonfly freebsd linux netbsd openbsd solaris 6 | 7 | package ipv6 8 | 9 | import "golang.org/x/net/internal/socket" 10 | 11 | func setControlMessage(c *socket.Conn, opt *rawOpt, cf ControlFlags, on bool) error { 12 | opt.Lock() 13 | defer opt.Unlock() 14 | if so, ok := sockOpts[ssoReceiveTrafficClass]; ok && cf&FlagTrafficClass != 0 { 15 | if err := so.SetInt(c, boolint(on)); err != nil { 16 | return err 17 | } 18 | if on { 19 | opt.set(FlagTrafficClass) 20 | } else { 21 | opt.clear(FlagTrafficClass) 22 | } 23 | } 24 | if so, ok := sockOpts[ssoReceiveHopLimit]; ok && cf&FlagHopLimit != 0 { 25 | if err := so.SetInt(c, boolint(on)); err != nil { 26 | return err 27 | } 28 | if on { 29 | opt.set(FlagHopLimit) 30 | } else { 31 | opt.clear(FlagHopLimit) 32 | } 33 | } 34 | if so, ok := sockOpts[ssoReceivePacketInfo]; ok && cf&flagPacketInfo != 0 { 35 | if err := so.SetInt(c, boolint(on)); err != nil { 36 | return err 37 | } 38 | if on { 39 | opt.set(cf & flagPacketInfo) 40 | } else { 41 | opt.clear(cf & flagPacketInfo) 42 | } 43 | } 44 | if so, ok := sockOpts[ssoReceivePathMTU]; ok && cf&FlagPathMTU != 0 { 45 | if err := so.SetInt(c, boolint(on)); err != nil { 46 | return err 47 | } 48 | if on { 49 | opt.set(FlagPathMTU) 50 | } else { 51 | opt.clear(FlagPathMTU) 52 | } 53 | } 54 | return nil 55 | } 56 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/sys_linkname.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build aix go1.12,darwin 6 | 7 | package socket 8 | 9 | import ( 10 | "syscall" 11 | "unsafe" 12 | ) 13 | 14 | //go:linkname syscall_getsockopt syscall.getsockopt 15 | func syscall_getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *uint32) error 16 | 17 | func getsockopt(s uintptr, level, name int, b []byte) (int, error) { 18 | l := uint32(len(b)) 19 | err := syscall_getsockopt(int(s), level, name, unsafe.Pointer(&b[0]), &l) 20 | return int(l), err 21 | } 22 | 23 | //go:linkname syscall_setsockopt syscall.setsockopt 24 | func syscall_setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) error 25 | 26 | func setsockopt(s uintptr, level, name int, b []byte) error { 27 | return syscall_setsockopt(int(s), level, name, unsafe.Pointer(&b[0]), uintptr(len(b))) 28 | } 29 | 30 | //go:linkname syscall_recvmsg syscall.recvmsg 31 | func syscall_recvmsg(s int, msg *syscall.Msghdr, flags int) (n int, err error) 32 | 33 | func recvmsg(s uintptr, h *msghdr, flags int) (int, error) { 34 | return syscall_recvmsg(int(s), (*syscall.Msghdr)(unsafe.Pointer(h)), flags) 35 | } 36 | 37 | //go:linkname syscall_sendmsg syscall.sendmsg 38 | func syscall_sendmsg(s int, msg *syscall.Msghdr, flags int) (n int, err error) 39 | 40 | func sendmsg(s uintptr, h *msghdr, flags int) (int, error) { 41 | return syscall_sendmsg(int(s), (*syscall.Msghdr)(unsafe.Pointer(h)), flags) 42 | } 43 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/sys_stub.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !aix,!darwin,!dragonfly,!freebsd,!linux,!netbsd,!openbsd,!solaris,!windows 6 | 7 | package socket 8 | 9 | import ( 10 | "net" 11 | "runtime" 12 | "unsafe" 13 | ) 14 | 15 | const ( 16 | sysAF_UNSPEC = 0x0 17 | sysAF_INET = 0x2 18 | sysAF_INET6 = 0xa 19 | 20 | sysSOCK_RAW = 0x3 21 | ) 22 | 23 | func probeProtocolStack() int { 24 | switch runtime.GOARCH { 25 | case "amd64p32", "mips64p32": 26 | return 4 27 | default: 28 | var p uintptr 29 | return int(unsafe.Sizeof(p)) 30 | } 31 | } 32 | 33 | func marshalInetAddr(ip net.IP, port int, zone string) []byte { 34 | return nil 35 | } 36 | 37 | func parseInetAddr(b []byte, network string) (net.Addr, error) { 38 | return nil, errNotImplemented 39 | } 40 | 41 | func getsockopt(s uintptr, level, name int, b []byte) (int, error) { 42 | return 0, errNotImplemented 43 | } 44 | 45 | func setsockopt(s uintptr, level, name int, b []byte) error { 46 | return errNotImplemented 47 | } 48 | 49 | func recvmsg(s uintptr, h *msghdr, flags int) (int, error) { 50 | return 0, errNotImplemented 51 | } 52 | 53 | func sendmsg(s uintptr, h *msghdr, flags int) (int, error) { 54 | return 0, errNotImplemented 55 | } 56 | 57 | func recvmmsg(s uintptr, hs []mmsghdr, flags int) (int, error) { 58 | return 0, errNotImplemented 59 | } 60 | 61 | func sendmmsg(s uintptr, hs []mmsghdr, flags int) (int, error) { 62 | return 0, errNotImplemented 63 | } 64 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/rawconn.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package socket 6 | 7 | import ( 8 | "errors" 9 | "net" 10 | "os" 11 | "syscall" 12 | ) 13 | 14 | // A Conn represents a raw connection. 15 | type Conn struct { 16 | network string 17 | c syscall.RawConn 18 | } 19 | 20 | // NewConn returns a new raw connection. 21 | func NewConn(c net.Conn) (*Conn, error) { 22 | var err error 23 | var cc Conn 24 | switch c := c.(type) { 25 | case *net.TCPConn: 26 | cc.network = "tcp" 27 | cc.c, err = c.SyscallConn() 28 | case *net.UDPConn: 29 | cc.network = "udp" 30 | cc.c, err = c.SyscallConn() 31 | case *net.IPConn: 32 | cc.network = "ip" 33 | cc.c, err = c.SyscallConn() 34 | default: 35 | return nil, errors.New("unknown connection type") 36 | } 37 | if err != nil { 38 | return nil, err 39 | } 40 | return &cc, nil 41 | } 42 | 43 | func (o *Option) get(c *Conn, b []byte) (int, error) { 44 | var operr error 45 | var n int 46 | fn := func(s uintptr) { 47 | n, operr = getsockopt(s, o.Level, o.Name, b) 48 | } 49 | if err := c.c.Control(fn); err != nil { 50 | return 0, err 51 | } 52 | return n, os.NewSyscallError("getsockopt", operr) 53 | } 54 | 55 | func (o *Option) set(c *Conn, b []byte) error { 56 | var operr error 57 | fn := func(s uintptr) { 58 | operr = setsockopt(s, o.Level, o.Name, b) 59 | } 60 | if err := c.c.Control(fn); err != nil { 61 | return err 62 | } 63 | return os.NewSyscallError("setsockopt", operr) 64 | } 65 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/icmp/messagebody.go: -------------------------------------------------------------------------------- 1 | // Copyright 2012 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package icmp 6 | 7 | // A MessageBody represents an ICMP message body. 8 | type MessageBody interface { 9 | // Len returns the length of ICMP message body. 10 | // The provided proto must be either the ICMPv4 or ICMPv6 11 | // protocol number. 12 | Len(proto int) int 13 | 14 | // Marshal returns the binary encoding of ICMP message body. 15 | // The provided proto must be either the ICMPv4 or ICMPv6 16 | // protocol number. 17 | Marshal(proto int) ([]byte, error) 18 | } 19 | 20 | // A RawBody represents a raw message body. 21 | // 22 | // A raw message body is excluded from message processing and can be 23 | // used to construct applications such as protocol conformance 24 | // testing. 25 | type RawBody struct { 26 | Data []byte // data 27 | } 28 | 29 | // Len implements the Len method of MessageBody interface. 30 | func (p *RawBody) Len(proto int) int { 31 | if p == nil { 32 | return 0 33 | } 34 | return len(p.Data) 35 | } 36 | 37 | // Marshal implements the Marshal method of MessageBody interface. 38 | func (p *RawBody) Marshal(proto int) ([]byte, error) { 39 | return p.Data, nil 40 | } 41 | 42 | // parseRawBody parses b as an ICMP message body. 43 | func parseRawBody(proto int, b []byte) (MessageBody, error) { 44 | p := &RawBody{Data: make([]byte, len(b))} 45 | copy(p.Data, b) 46 | return p, nil 47 | } 48 | 49 | // A DefaultMessageBody represents the default message body. 50 | // 51 | // Deprecated: Use RawBody instead. 52 | type DefaultMessageBody = RawBody 53 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/ipv6/header.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package ipv6 6 | 7 | import ( 8 | "encoding/binary" 9 | "fmt" 10 | "net" 11 | ) 12 | 13 | const ( 14 | Version = 6 // protocol version 15 | HeaderLen = 40 // header length 16 | ) 17 | 18 | // A Header represents an IPv6 base header. 19 | type Header struct { 20 | Version int // protocol version 21 | TrafficClass int // traffic class 22 | FlowLabel int // flow label 23 | PayloadLen int // payload length 24 | NextHeader int // next header 25 | HopLimit int // hop limit 26 | Src net.IP // source address 27 | Dst net.IP // destination address 28 | } 29 | 30 | func (h *Header) String() string { 31 | if h == nil { 32 | return "" 33 | } 34 | return fmt.Sprintf("ver=%d tclass=%#x flowlbl=%#x payloadlen=%d nxthdr=%d hoplim=%d src=%v dst=%v", h.Version, h.TrafficClass, h.FlowLabel, h.PayloadLen, h.NextHeader, h.HopLimit, h.Src, h.Dst) 35 | } 36 | 37 | // ParseHeader parses b as an IPv6 base header. 38 | func ParseHeader(b []byte) (*Header, error) { 39 | if len(b) < HeaderLen { 40 | return nil, errHeaderTooShort 41 | } 42 | h := &Header{ 43 | Version: int(b[0]) >> 4, 44 | TrafficClass: int(b[0]&0x0f)<<4 | int(b[1])>>4, 45 | FlowLabel: int(b[1]&0x0f)<<16 | int(b[2])<<8 | int(b[3]), 46 | PayloadLen: int(binary.BigEndian.Uint16(b[4:6])), 47 | NextHeader: int(b[6]), 48 | HopLimit: int(b[7]), 49 | } 50 | h.Src = make(net.IP, net.IPv6len) 51 | copy(h.Src, b[8:24]) 52 | h.Dst = make(net.IP, net.IPv6len) 53 | copy(h.Dst, b[24:40]) 54 | return h, nil 55 | } 56 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/icmp/timeexceeded.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package icmp 6 | 7 | import ( 8 | "golang.org/x/net/internal/iana" 9 | "golang.org/x/net/ipv4" 10 | "golang.org/x/net/ipv6" 11 | ) 12 | 13 | // A TimeExceeded represents an ICMP time exceeded message body. 14 | type TimeExceeded struct { 15 | Data []byte // data, known as original datagram field 16 | Extensions []Extension // extensions 17 | } 18 | 19 | // Len implements the Len method of MessageBody interface. 20 | func (p *TimeExceeded) Len(proto int) int { 21 | if p == nil { 22 | return 0 23 | } 24 | l, _ := multipartMessageBodyDataLen(proto, true, p.Data, p.Extensions) 25 | return l 26 | } 27 | 28 | // Marshal implements the Marshal method of MessageBody interface. 29 | func (p *TimeExceeded) Marshal(proto int) ([]byte, error) { 30 | var typ Type 31 | switch proto { 32 | case iana.ProtocolICMP: 33 | typ = ipv4.ICMPTypeTimeExceeded 34 | case iana.ProtocolIPv6ICMP: 35 | typ = ipv6.ICMPTypeTimeExceeded 36 | default: 37 | return nil, errInvalidProtocol 38 | } 39 | if !validExtensions(typ, p.Extensions) { 40 | return nil, errInvalidExtension 41 | } 42 | return marshalMultipartMessageBody(proto, true, p.Data, p.Extensions) 43 | } 44 | 45 | // parseTimeExceeded parses b as an ICMP time exceeded message body. 46 | func parseTimeExceeded(proto int, typ Type, b []byte) (MessageBody, error) { 47 | if len(b) < 4 { 48 | return nil, errMessageTooShort 49 | } 50 | p := &TimeExceeded{} 51 | var err error 52 | p.Data, p.Extensions, err = parseMultipartMessageBody(proto, typ, b) 53 | if err != nil { 54 | return nil, err 55 | } 56 | return p, nil 57 | } 58 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/ipv4/icmp.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package ipv4 6 | 7 | import "golang.org/x/net/internal/iana" 8 | 9 | // An ICMPType represents a type of ICMP message. 10 | type ICMPType int 11 | 12 | func (typ ICMPType) String() string { 13 | s, ok := icmpTypes[typ] 14 | if !ok { 15 | return "" 16 | } 17 | return s 18 | } 19 | 20 | // Protocol returns the ICMPv4 protocol number. 21 | func (typ ICMPType) Protocol() int { 22 | return iana.ProtocolICMP 23 | } 24 | 25 | // An ICMPFilter represents an ICMP message filter for incoming 26 | // packets. The filter belongs to a packet delivery path on a host and 27 | // it cannot interact with forwarding packets or tunnel-outer packets. 28 | // 29 | // Note: RFC 8200 defines a reasonable role model and it works not 30 | // only for IPv6 but IPv4. A node means a device that implements IP. 31 | // A router means a node that forwards IP packets not explicitly 32 | // addressed to itself, and a host means a node that is not a router. 33 | type ICMPFilter struct { 34 | icmpFilter 35 | } 36 | 37 | // Accept accepts incoming ICMP packets including the type field value 38 | // typ. 39 | func (f *ICMPFilter) Accept(typ ICMPType) { 40 | f.accept(typ) 41 | } 42 | 43 | // Block blocks incoming ICMP packets including the type field value 44 | // typ. 45 | func (f *ICMPFilter) Block(typ ICMPType) { 46 | f.block(typ) 47 | } 48 | 49 | // SetAll sets the filter action to the filter. 50 | func (f *ICMPFilter) SetAll(block bool) { 51 | f.setAll(block) 52 | } 53 | 54 | // WillBlock reports whether the ICMP type will be blocked. 55 | func (f *ICMPFilter) WillBlock(typ ICMPType) bool { 56 | return f.willBlock(typ) 57 | } 58 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/icmp/dstunreach.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package icmp 6 | 7 | import ( 8 | "golang.org/x/net/internal/iana" 9 | "golang.org/x/net/ipv4" 10 | "golang.org/x/net/ipv6" 11 | ) 12 | 13 | // A DstUnreach represents an ICMP destination unreachable message 14 | // body. 15 | type DstUnreach struct { 16 | Data []byte // data, known as original datagram field 17 | Extensions []Extension // extensions 18 | } 19 | 20 | // Len implements the Len method of MessageBody interface. 21 | func (p *DstUnreach) Len(proto int) int { 22 | if p == nil { 23 | return 0 24 | } 25 | l, _ := multipartMessageBodyDataLen(proto, true, p.Data, p.Extensions) 26 | return l 27 | } 28 | 29 | // Marshal implements the Marshal method of MessageBody interface. 30 | func (p *DstUnreach) Marshal(proto int) ([]byte, error) { 31 | var typ Type 32 | switch proto { 33 | case iana.ProtocolICMP: 34 | typ = ipv4.ICMPTypeDestinationUnreachable 35 | case iana.ProtocolIPv6ICMP: 36 | typ = ipv6.ICMPTypeDestinationUnreachable 37 | default: 38 | return nil, errInvalidProtocol 39 | } 40 | if !validExtensions(typ, p.Extensions) { 41 | return nil, errInvalidExtension 42 | } 43 | return marshalMultipartMessageBody(proto, true, p.Data, p.Extensions) 44 | } 45 | 46 | // parseDstUnreach parses b as an ICMP destination unreachable message 47 | // body. 48 | func parseDstUnreach(proto int, typ Type, b []byte) (MessageBody, error) { 49 | if len(b) < 4 { 50 | return nil, errMessageTooShort 51 | } 52 | p := &DstUnreach{} 53 | var err error 54 | p.Data, p.Extensions, err = parseMultipartMessageBody(proto, typ, b) 55 | if err != nil { 56 | return nil, err 57 | } 58 | return p, nil 59 | } 60 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/sys_windows.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package socket 6 | 7 | import ( 8 | "syscall" 9 | "unsafe" 10 | ) 11 | 12 | func probeProtocolStack() int { 13 | var p uintptr 14 | return int(unsafe.Sizeof(p)) 15 | } 16 | 17 | const ( 18 | sysAF_UNSPEC = 0x0 19 | sysAF_INET = 0x2 20 | sysAF_INET6 = 0x17 21 | 22 | sysSOCK_RAW = 0x3 23 | ) 24 | 25 | type sockaddrInet struct { 26 | Family uint16 27 | Port uint16 28 | Addr [4]byte /* in_addr */ 29 | Zero [8]uint8 30 | } 31 | 32 | type sockaddrInet6 struct { 33 | Family uint16 34 | Port uint16 35 | Flowinfo uint32 36 | Addr [16]byte /* in6_addr */ 37 | Scope_id uint32 38 | } 39 | 40 | const ( 41 | sizeofSockaddrInet = 0x10 42 | sizeofSockaddrInet6 = 0x1c 43 | ) 44 | 45 | func getsockopt(s uintptr, level, name int, b []byte) (int, error) { 46 | l := uint32(len(b)) 47 | err := syscall.Getsockopt(syscall.Handle(s), int32(level), int32(name), (*byte)(unsafe.Pointer(&b[0])), (*int32)(unsafe.Pointer(&l))) 48 | return int(l), err 49 | } 50 | 51 | func setsockopt(s uintptr, level, name int, b []byte) error { 52 | return syscall.Setsockopt(syscall.Handle(s), int32(level), int32(name), (*byte)(unsafe.Pointer(&b[0])), int32(len(b))) 53 | } 54 | 55 | func recvmsg(s uintptr, h *msghdr, flags int) (int, error) { 56 | return 0, errNotImplemented 57 | } 58 | 59 | func sendmsg(s uintptr, h *msghdr, flags int) (int, error) { 60 | return 0, errNotImplemented 61 | } 62 | 63 | func recvmmsg(s uintptr, hs []mmsghdr, flags int) (int, error) { 64 | return 0, errNotImplemented 65 | } 66 | 67 | func sendmmsg(s uintptr, hs []mmsghdr, flags int) (int, error) { 68 | return 0, errNotImplemented 69 | } 70 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/ipv6/icmp.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package ipv6 6 | 7 | import "golang.org/x/net/internal/iana" 8 | 9 | // BUG(mikio): On Windows, methods related to ICMPFilter are not 10 | // implemented. 11 | 12 | // An ICMPType represents a type of ICMP message. 13 | type ICMPType int 14 | 15 | func (typ ICMPType) String() string { 16 | s, ok := icmpTypes[typ] 17 | if !ok { 18 | return "" 19 | } 20 | return s 21 | } 22 | 23 | // Protocol returns the ICMPv6 protocol number. 24 | func (typ ICMPType) Protocol() int { 25 | return iana.ProtocolIPv6ICMP 26 | } 27 | 28 | // An ICMPFilter represents an ICMP message filter for incoming 29 | // packets. The filter belongs to a packet delivery path on a host and 30 | // it cannot interact with forwarding packets or tunnel-outer packets. 31 | // 32 | // Note: RFC 8200 defines a reasonable role model. A node means a 33 | // device that implements IP. A router means a node that forwards IP 34 | // packets not explicitly addressed to itself, and a host means a node 35 | // that is not a router. 36 | type ICMPFilter struct { 37 | icmpv6Filter 38 | } 39 | 40 | // Accept accepts incoming ICMP packets including the type field value 41 | // typ. 42 | func (f *ICMPFilter) Accept(typ ICMPType) { 43 | f.accept(typ) 44 | } 45 | 46 | // Block blocks incoming ICMP packets including the type field value 47 | // typ. 48 | func (f *ICMPFilter) Block(typ ICMPType) { 49 | f.block(typ) 50 | } 51 | 52 | // SetAll sets the filter action to the filter. 53 | func (f *ICMPFilter) SetAll(block bool) { 54 | f.setAll(block) 55 | } 56 | 57 | // WillBlock reports whether the ICMP type will be blocked. 58 | func (f *ICMPFilter) WillBlock(typ ICMPType) bool { 59 | return f.willBlock(typ) 60 | } 61 | -------------------------------------------------------------------------------- /ping/type.go: -------------------------------------------------------------------------------- 1 | package ping 2 | 3 | import "time" 4 | 5 | const DEFAULT_TIMEOUT_MS = 800 6 | const DEFAULT_PACKET_SIZE = 56 7 | const DEFAULT_COUNT = 10 8 | const DEFAULT_INTERVAL_MS = 10 9 | const DEFAULT_TTL = 128 10 | 11 | type PingReturn struct { 12 | destAddr string 13 | success bool 14 | dropRate float64 15 | allTime time.Duration 16 | bestTime time.Duration 17 | avgTime time.Duration 18 | wrstTime time.Duration 19 | } 20 | 21 | type PingResult struct { 22 | success bool 23 | succSum int 24 | allTime time.Duration 25 | bestTime time.Duration 26 | avgTime time.Duration 27 | wrstTime time.Duration 28 | } 29 | 30 | type PingOptions struct { 31 | count int 32 | timeoutMs int 33 | intervalMs int 34 | packetSize int 35 | } 36 | 37 | func (options *PingOptions) Count() int { 38 | if options.count == 0 { 39 | options.count = DEFAULT_COUNT 40 | } 41 | return options.count 42 | } 43 | 44 | func (options *PingOptions) SetCount(count int) { 45 | options.count = count 46 | } 47 | 48 | func (options *PingOptions) TimeoutMs() int { 49 | if options.timeoutMs == 0 { 50 | options.timeoutMs = DEFAULT_TIMEOUT_MS 51 | } 52 | return options.timeoutMs 53 | } 54 | 55 | func (options *PingOptions) SetTimeoutMs(timeoutMs int) { 56 | options.timeoutMs = timeoutMs 57 | } 58 | 59 | func (options *PingOptions) IntervalMs() int { 60 | if options.intervalMs == 0 { 61 | options.intervalMs = DEFAULT_INTERVAL_MS 62 | } 63 | return options.intervalMs 64 | } 65 | 66 | func (options *PingOptions) SetIntervalMs(intervalMs int) { 67 | options.intervalMs = intervalMs 68 | } 69 | 70 | func (options *PingOptions) PacketSize() int { 71 | if options.packetSize == 0 { 72 | options.packetSize = DEFAULT_PACKET_SIZE 73 | } 74 | return options.packetSize 75 | } 76 | 77 | func (options *PingOptions) SetPacketSize(packetSize int) { 78 | options.packetSize = packetSize 79 | } 80 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/rawconn_msg.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build aix darwin dragonfly freebsd linux netbsd openbsd solaris windows 6 | 7 | package socket 8 | 9 | import ( 10 | "os" 11 | "syscall" 12 | ) 13 | 14 | func (c *Conn) recvMsg(m *Message, flags int) error { 15 | var h msghdr 16 | vs := make([]iovec, len(m.Buffers)) 17 | var sa []byte 18 | if c.network != "tcp" { 19 | sa = make([]byte, sizeofSockaddrInet6) 20 | } 21 | h.pack(vs, m.Buffers, m.OOB, sa) 22 | var operr error 23 | var n int 24 | fn := func(s uintptr) bool { 25 | n, operr = recvmsg(s, &h, flags) 26 | if operr == syscall.EAGAIN { 27 | return false 28 | } 29 | return true 30 | } 31 | if err := c.c.Read(fn); err != nil { 32 | return err 33 | } 34 | if operr != nil { 35 | return os.NewSyscallError("recvmsg", operr) 36 | } 37 | if c.network != "tcp" { 38 | var err error 39 | m.Addr, err = parseInetAddr(sa[:], c.network) 40 | if err != nil { 41 | return err 42 | } 43 | } 44 | m.N = n 45 | m.NN = h.controllen() 46 | m.Flags = h.flags() 47 | return nil 48 | } 49 | 50 | func (c *Conn) sendMsg(m *Message, flags int) error { 51 | var h msghdr 52 | vs := make([]iovec, len(m.Buffers)) 53 | var sa []byte 54 | if m.Addr != nil { 55 | sa = marshalInetAddr(m.Addr) 56 | } 57 | h.pack(vs, m.Buffers, m.OOB, sa) 58 | var operr error 59 | var n int 60 | fn := func(s uintptr) bool { 61 | n, operr = sendmsg(s, &h, flags) 62 | if operr == syscall.EAGAIN { 63 | return false 64 | } 65 | return true 66 | } 67 | if err := c.c.Write(fn); err != nil { 68 | return err 69 | } 70 | if operr != nil { 71 | return os.NewSyscallError("sendmsg", operr) 72 | } 73 | m.N = n 74 | m.NN = len(m.OOB) 75 | return nil 76 | } 77 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/rawconn_mmsg.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build linux 6 | 7 | package socket 8 | 9 | import ( 10 | "net" 11 | "os" 12 | "syscall" 13 | ) 14 | 15 | func (c *Conn) recvMsgs(ms []Message, flags int) (int, error) { 16 | hs := make(mmsghdrs, len(ms)) 17 | var parseFn func([]byte, string) (net.Addr, error) 18 | if c.network != "tcp" { 19 | parseFn = parseInetAddr 20 | } 21 | if err := hs.pack(ms, parseFn, nil); err != nil { 22 | return 0, err 23 | } 24 | var operr error 25 | var n int 26 | fn := func(s uintptr) bool { 27 | n, operr = recvmmsg(s, hs, flags) 28 | if operr == syscall.EAGAIN { 29 | return false 30 | } 31 | return true 32 | } 33 | if err := c.c.Read(fn); err != nil { 34 | return n, err 35 | } 36 | if operr != nil { 37 | return n, os.NewSyscallError("recvmmsg", operr) 38 | } 39 | if err := hs[:n].unpack(ms[:n], parseFn, c.network); err != nil { 40 | return n, err 41 | } 42 | return n, nil 43 | } 44 | 45 | func (c *Conn) sendMsgs(ms []Message, flags int) (int, error) { 46 | hs := make(mmsghdrs, len(ms)) 47 | var marshalFn func(net.Addr) []byte 48 | if c.network != "tcp" { 49 | marshalFn = marshalInetAddr 50 | } 51 | if err := hs.pack(ms, nil, marshalFn); err != nil { 52 | return 0, err 53 | } 54 | var operr error 55 | var n int 56 | fn := func(s uintptr) bool { 57 | n, operr = sendmmsg(s, hs, flags) 58 | if operr == syscall.EAGAIN { 59 | return false 60 | } 61 | return true 62 | } 63 | if err := c.c.Write(fn); err != nil { 64 | return n, err 65 | } 66 | if operr != nil { 67 | return n, os.NewSyscallError("sendmmsg", operr) 68 | } 69 | if err := hs[:n].unpack(ms[:n], nil, ""); err != nil { 70 | return n, err 71 | } 72 | return n, nil 73 | } 74 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/ipv4/sockopt.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package ipv4 6 | 7 | import "golang.org/x/net/internal/socket" 8 | 9 | // Sticky socket options 10 | const ( 11 | ssoTOS = iota // header field for unicast packet 12 | ssoTTL // header field for unicast packet 13 | ssoMulticastTTL // header field for multicast packet 14 | ssoMulticastInterface // outbound interface for multicast packet 15 | ssoMulticastLoopback // loopback for multicast packet 16 | ssoReceiveTTL // header field on received packet 17 | ssoReceiveDst // header field on received packet 18 | ssoReceiveInterface // inbound interface on received packet 19 | ssoPacketInfo // incbound or outbound packet path 20 | ssoHeaderPrepend // ipv4 header prepend 21 | ssoStripHeader // strip ipv4 header 22 | ssoICMPFilter // icmp filter 23 | ssoJoinGroup // any-source multicast 24 | ssoLeaveGroup // any-source multicast 25 | ssoJoinSourceGroup // source-specific multicast 26 | ssoLeaveSourceGroup // source-specific multicast 27 | ssoBlockSourceGroup // any-source or source-specific multicast 28 | ssoUnblockSourceGroup // any-source or source-specific multicast 29 | ssoAttachFilter // attach BPF for filtering inbound traffic 30 | ) 31 | 32 | // Sticky socket option value types 33 | const ( 34 | ssoTypeIPMreq = iota + 1 35 | ssoTypeIPMreqn 36 | ssoTypeGroupReq 37 | ssoTypeGroupSourceReq 38 | ) 39 | 40 | // A sockOpt represents a binding for sticky socket option. 41 | type sockOpt struct { 42 | socket.Option 43 | typ int // hint for option value type; optional 44 | } 45 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/icmp/helper_posix.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build aix darwin dragonfly freebsd linux netbsd openbsd solaris windows 6 | 7 | package icmp 8 | 9 | import ( 10 | "net" 11 | "strconv" 12 | "syscall" 13 | ) 14 | 15 | func sockaddr(family int, address string) (syscall.Sockaddr, error) { 16 | switch family { 17 | case syscall.AF_INET: 18 | a, err := net.ResolveIPAddr("ip4", address) 19 | if err != nil { 20 | return nil, err 21 | } 22 | if len(a.IP) == 0 { 23 | a.IP = net.IPv4zero 24 | } 25 | if a.IP = a.IP.To4(); a.IP == nil { 26 | return nil, net.InvalidAddrError("non-ipv4 address") 27 | } 28 | sa := &syscall.SockaddrInet4{} 29 | copy(sa.Addr[:], a.IP) 30 | return sa, nil 31 | case syscall.AF_INET6: 32 | a, err := net.ResolveIPAddr("ip6", address) 33 | if err != nil { 34 | return nil, err 35 | } 36 | if len(a.IP) == 0 { 37 | a.IP = net.IPv6unspecified 38 | } 39 | if a.IP.Equal(net.IPv4zero) { 40 | a.IP = net.IPv6unspecified 41 | } 42 | if a.IP = a.IP.To16(); a.IP == nil || a.IP.To4() != nil { 43 | return nil, net.InvalidAddrError("non-ipv6 address") 44 | } 45 | sa := &syscall.SockaddrInet6{ZoneId: zoneToUint32(a.Zone)} 46 | copy(sa.Addr[:], a.IP) 47 | return sa, nil 48 | default: 49 | return nil, net.InvalidAddrError("unexpected family") 50 | } 51 | } 52 | 53 | func zoneToUint32(zone string) uint32 { 54 | if zone == "" { 55 | return 0 56 | } 57 | if ifi, err := net.InterfaceByName(zone); err == nil { 58 | return uint32(ifi.Index) 59 | } 60 | n, err := strconv.Atoi(zone) 61 | if err != nil { 62 | return 0 63 | } 64 | return uint32(n) 65 | } 66 | 67 | func last(s string, b byte) int { 68 | i := len(s) 69 | for i--; i >= 0; i-- { 70 | if s[i] == b { 71 | break 72 | } 73 | } 74 | return i 75 | } 76 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/ipv4/sys_dragonfly.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package ipv4 6 | 7 | import ( 8 | "net" 9 | "syscall" 10 | 11 | "golang.org/x/net/internal/iana" 12 | "golang.org/x/net/internal/socket" 13 | ) 14 | 15 | var ( 16 | ctlOpts = [ctlMax]ctlOpt{ 17 | ctlTTL: {sysIP_RECVTTL, 1, marshalTTL, parseTTL}, 18 | ctlDst: {sysIP_RECVDSTADDR, net.IPv4len, marshalDst, parseDst}, 19 | ctlInterface: {sysIP_RECVIF, syscall.SizeofSockaddrDatalink, marshalInterface, parseInterface}, 20 | } 21 | 22 | sockOpts = map[int]*sockOpt{ 23 | ssoTOS: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_TOS, Len: 4}}, 24 | ssoTTL: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_TTL, Len: 4}}, 25 | ssoMulticastTTL: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_MULTICAST_TTL, Len: 1}}, 26 | ssoMulticastInterface: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_MULTICAST_IF, Len: 4}}, 27 | ssoMulticastLoopback: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_MULTICAST_LOOP, Len: 4}}, 28 | ssoReceiveTTL: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_RECVTTL, Len: 4}}, 29 | ssoReceiveDst: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_RECVDSTADDR, Len: 4}}, 30 | ssoReceiveInterface: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_RECVIF, Len: 4}}, 31 | ssoHeaderPrepend: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_HDRINCL, Len: 4}}, 32 | ssoJoinGroup: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_ADD_MEMBERSHIP, Len: sizeofIPMreq}, typ: ssoTypeIPMreq}, 33 | ssoLeaveGroup: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_DROP_MEMBERSHIP, Len: sizeofIPMreq}, typ: ssoTypeIPMreq}, 34 | } 35 | ) 36 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/ipv6/zsys_netbsd.go: -------------------------------------------------------------------------------- 1 | // Created by cgo -godefs - DO NOT EDIT 2 | // cgo -godefs defs_netbsd.go 3 | 4 | package ipv6 5 | 6 | const ( 7 | sysIPV6_UNICAST_HOPS = 0x4 8 | sysIPV6_MULTICAST_IF = 0x9 9 | sysIPV6_MULTICAST_HOPS = 0xa 10 | sysIPV6_MULTICAST_LOOP = 0xb 11 | sysIPV6_JOIN_GROUP = 0xc 12 | sysIPV6_LEAVE_GROUP = 0xd 13 | sysIPV6_PORTRANGE = 0xe 14 | sysICMP6_FILTER = 0x12 15 | 16 | sysIPV6_CHECKSUM = 0x1a 17 | sysIPV6_V6ONLY = 0x1b 18 | 19 | sysIPV6_IPSEC_POLICY = 0x1c 20 | 21 | sysIPV6_RTHDRDSTOPTS = 0x23 22 | 23 | sysIPV6_RECVPKTINFO = 0x24 24 | sysIPV6_RECVHOPLIMIT = 0x25 25 | sysIPV6_RECVRTHDR = 0x26 26 | sysIPV6_RECVHOPOPTS = 0x27 27 | sysIPV6_RECVDSTOPTS = 0x28 28 | 29 | sysIPV6_USE_MIN_MTU = 0x2a 30 | sysIPV6_RECVPATHMTU = 0x2b 31 | sysIPV6_PATHMTU = 0x2c 32 | 33 | sysIPV6_PKTINFO = 0x2e 34 | sysIPV6_HOPLIMIT = 0x2f 35 | sysIPV6_NEXTHOP = 0x30 36 | sysIPV6_HOPOPTS = 0x31 37 | sysIPV6_DSTOPTS = 0x32 38 | sysIPV6_RTHDR = 0x33 39 | 40 | sysIPV6_RECVTCLASS = 0x39 41 | 42 | sysIPV6_TCLASS = 0x3d 43 | sysIPV6_DONTFRAG = 0x3e 44 | 45 | sysIPV6_PORTRANGE_DEFAULT = 0x0 46 | sysIPV6_PORTRANGE_HIGH = 0x1 47 | sysIPV6_PORTRANGE_LOW = 0x2 48 | 49 | sizeofSockaddrInet6 = 0x1c 50 | sizeofInet6Pktinfo = 0x14 51 | sizeofIPv6Mtuinfo = 0x20 52 | 53 | sizeofIPv6Mreq = 0x14 54 | 55 | sizeofICMPv6Filter = 0x20 56 | ) 57 | 58 | type sockaddrInet6 struct { 59 | Len uint8 60 | Family uint8 61 | Port uint16 62 | Flowinfo uint32 63 | Addr [16]byte /* in6_addr */ 64 | Scope_id uint32 65 | } 66 | 67 | type inet6Pktinfo struct { 68 | Addr [16]byte /* in6_addr */ 69 | Ifindex uint32 70 | } 71 | 72 | type ipv6Mtuinfo struct { 73 | Addr sockaddrInet6 74 | Mtu uint32 75 | } 76 | 77 | type ipv6Mreq struct { 78 | Multiaddr [16]byte /* in6_addr */ 79 | Interface uint32 80 | } 81 | 82 | type icmpv6Filter struct { 83 | Filt [8]uint32 84 | } 85 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/ipv4/sys_bsd.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build netbsd openbsd 6 | 7 | package ipv4 8 | 9 | import ( 10 | "net" 11 | "syscall" 12 | 13 | "golang.org/x/net/internal/iana" 14 | "golang.org/x/net/internal/socket" 15 | ) 16 | 17 | var ( 18 | ctlOpts = [ctlMax]ctlOpt{ 19 | ctlTTL: {sysIP_RECVTTL, 1, marshalTTL, parseTTL}, 20 | ctlDst: {sysIP_RECVDSTADDR, net.IPv4len, marshalDst, parseDst}, 21 | ctlInterface: {sysIP_RECVIF, syscall.SizeofSockaddrDatalink, marshalInterface, parseInterface}, 22 | } 23 | 24 | sockOpts = map[int]*sockOpt{ 25 | ssoTOS: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_TOS, Len: 4}}, 26 | ssoTTL: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_TTL, Len: 4}}, 27 | ssoMulticastTTL: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_MULTICAST_TTL, Len: 1}}, 28 | ssoMulticastInterface: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_MULTICAST_IF, Len: 4}}, 29 | ssoMulticastLoopback: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_MULTICAST_LOOP, Len: 1}}, 30 | ssoReceiveTTL: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_RECVTTL, Len: 4}}, 31 | ssoReceiveDst: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_RECVDSTADDR, Len: 4}}, 32 | ssoReceiveInterface: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_RECVIF, Len: 4}}, 33 | ssoHeaderPrepend: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_HDRINCL, Len: 4}}, 34 | ssoJoinGroup: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_ADD_MEMBERSHIP, Len: sizeofIPMreq}, typ: ssoTypeIPMreq}, 35 | ssoLeaveGroup: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_DROP_MEMBERSHIP, Len: sizeofIPMreq}, typ: ssoTypeIPMreq}, 36 | } 37 | ) 38 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/ipv4/sys_aix.go: -------------------------------------------------------------------------------- 1 | // Copyright 2019 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // Added for go1.11 compatibility 6 | // +build aix 7 | 8 | package ipv4 9 | 10 | import ( 11 | "net" 12 | "syscall" 13 | 14 | "golang.org/x/net/internal/iana" 15 | "golang.org/x/net/internal/socket" 16 | ) 17 | 18 | var ( 19 | ctlOpts = [ctlMax]ctlOpt{ 20 | ctlTTL: {sysIP_RECVTTL, 1, marshalTTL, parseTTL}, 21 | ctlDst: {sysIP_RECVDSTADDR, net.IPv4len, marshalDst, parseDst}, 22 | ctlInterface: {sysIP_RECVIF, syscall.SizeofSockaddrDatalink, marshalInterface, parseInterface}, 23 | } 24 | 25 | sockOpts = map[int]*sockOpt{ 26 | ssoTOS: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_TOS, Len: 4}}, 27 | ssoTTL: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_TTL, Len: 4}}, 28 | ssoMulticastTTL: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_MULTICAST_TTL, Len: 1}}, 29 | ssoMulticastInterface: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_MULTICAST_IF, Len: 4}}, 30 | ssoMulticastLoopback: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_MULTICAST_LOOP, Len: 1}}, 31 | ssoReceiveTTL: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_RECVTTL, Len: 4}}, 32 | ssoReceiveDst: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_RECVDSTADDR, Len: 4}}, 33 | ssoReceiveInterface: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_RECVIF, Len: 4}}, 34 | ssoHeaderPrepend: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_HDRINCL, Len: 4}}, 35 | ssoJoinGroup: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_ADD_MEMBERSHIP, Len: sizeofIPMreq}, typ: ssoTypeIPMreq}, 36 | ssoLeaveGroup: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_DROP_MEMBERSHIP, Len: sizeofIPMreq}, typ: ssoTypeIPMreq}, 37 | } 38 | ) 39 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/ipv4/control_unix.go: -------------------------------------------------------------------------------- 1 | // Copyright 2012 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build aix darwin dragonfly freebsd linux netbsd openbsd solaris 6 | 7 | package ipv4 8 | 9 | import ( 10 | "unsafe" 11 | 12 | "golang.org/x/net/internal/iana" 13 | "golang.org/x/net/internal/socket" 14 | ) 15 | 16 | func setControlMessage(c *socket.Conn, opt *rawOpt, cf ControlFlags, on bool) error { 17 | opt.Lock() 18 | defer opt.Unlock() 19 | if so, ok := sockOpts[ssoReceiveTTL]; ok && cf&FlagTTL != 0 { 20 | if err := so.SetInt(c, boolint(on)); err != nil { 21 | return err 22 | } 23 | if on { 24 | opt.set(FlagTTL) 25 | } else { 26 | opt.clear(FlagTTL) 27 | } 28 | } 29 | if so, ok := sockOpts[ssoPacketInfo]; ok { 30 | if cf&(FlagSrc|FlagDst|FlagInterface) != 0 { 31 | if err := so.SetInt(c, boolint(on)); err != nil { 32 | return err 33 | } 34 | if on { 35 | opt.set(cf & (FlagSrc | FlagDst | FlagInterface)) 36 | } else { 37 | opt.clear(cf & (FlagSrc | FlagDst | FlagInterface)) 38 | } 39 | } 40 | } else { 41 | if so, ok := sockOpts[ssoReceiveDst]; ok && cf&FlagDst != 0 { 42 | if err := so.SetInt(c, boolint(on)); err != nil { 43 | return err 44 | } 45 | if on { 46 | opt.set(FlagDst) 47 | } else { 48 | opt.clear(FlagDst) 49 | } 50 | } 51 | if so, ok := sockOpts[ssoReceiveInterface]; ok && cf&FlagInterface != 0 { 52 | if err := so.SetInt(c, boolint(on)); err != nil { 53 | return err 54 | } 55 | if on { 56 | opt.set(FlagInterface) 57 | } else { 58 | opt.clear(FlagInterface) 59 | } 60 | } 61 | } 62 | return nil 63 | } 64 | 65 | func marshalTTL(b []byte, cm *ControlMessage) []byte { 66 | m := socket.ControlMessage(b) 67 | m.MarshalHeader(iana.ProtocolIP, sysIP_RECVTTL, 1) 68 | return m.Next(1) 69 | } 70 | 71 | func parseTTL(cm *ControlMessage, b []byte) { 72 | cm.TTL = int(*(*byte)(unsafe.Pointer(&b[:1][0]))) 73 | } 74 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/ipv6/sockopt.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package ipv6 6 | 7 | import "golang.org/x/net/internal/socket" 8 | 9 | // Sticky socket options 10 | const ( 11 | ssoTrafficClass = iota // header field for unicast packet, RFC 3542 12 | ssoHopLimit // header field for unicast packet, RFC 3493 13 | ssoMulticastInterface // outbound interface for multicast packet, RFC 3493 14 | ssoMulticastHopLimit // header field for multicast packet, RFC 3493 15 | ssoMulticastLoopback // loopback for multicast packet, RFC 3493 16 | ssoReceiveTrafficClass // header field on received packet, RFC 3542 17 | ssoReceiveHopLimit // header field on received packet, RFC 2292 or 3542 18 | ssoReceivePacketInfo // incbound or outbound packet path, RFC 2292 or 3542 19 | ssoReceivePathMTU // path mtu, RFC 3542 20 | ssoPathMTU // path mtu, RFC 3542 21 | ssoChecksum // packet checksum, RFC 2292 or 3542 22 | ssoICMPFilter // icmp filter, RFC 2292 or 3542 23 | ssoJoinGroup // any-source multicast, RFC 3493 24 | ssoLeaveGroup // any-source multicast, RFC 3493 25 | ssoJoinSourceGroup // source-specific multicast 26 | ssoLeaveSourceGroup // source-specific multicast 27 | ssoBlockSourceGroup // any-source or source-specific multicast 28 | ssoUnblockSourceGroup // any-source or source-specific multicast 29 | ssoAttachFilter // attach BPF for filtering inbound traffic 30 | ) 31 | 32 | // Sticky socket option value types 33 | const ( 34 | ssoTypeIPMreq = iota + 1 35 | ssoTypeGroupReq 36 | ssoTypeGroupSourceReq 37 | ) 38 | 39 | // A sockOpt represents a binding for sticky socket option. 40 | type sockOpt struct { 41 | socket.Option 42 | typ int // hint for option value type; optional 43 | } 44 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/ipv6/zsys_dragonfly.go: -------------------------------------------------------------------------------- 1 | // Created by cgo -godefs - DO NOT EDIT 2 | // cgo -godefs defs_dragonfly.go 3 | 4 | package ipv6 5 | 6 | const ( 7 | sysIPV6_UNICAST_HOPS = 0x4 8 | sysIPV6_MULTICAST_IF = 0x9 9 | sysIPV6_MULTICAST_HOPS = 0xa 10 | sysIPV6_MULTICAST_LOOP = 0xb 11 | sysIPV6_JOIN_GROUP = 0xc 12 | sysIPV6_LEAVE_GROUP = 0xd 13 | sysIPV6_PORTRANGE = 0xe 14 | sysICMP6_FILTER = 0x12 15 | 16 | sysIPV6_CHECKSUM = 0x1a 17 | sysIPV6_V6ONLY = 0x1b 18 | 19 | sysIPV6_IPSEC_POLICY = 0x1c 20 | 21 | sysIPV6_RTHDRDSTOPTS = 0x23 22 | sysIPV6_RECVPKTINFO = 0x24 23 | sysIPV6_RECVHOPLIMIT = 0x25 24 | sysIPV6_RECVRTHDR = 0x26 25 | sysIPV6_RECVHOPOPTS = 0x27 26 | sysIPV6_RECVDSTOPTS = 0x28 27 | 28 | sysIPV6_USE_MIN_MTU = 0x2a 29 | sysIPV6_RECVPATHMTU = 0x2b 30 | 31 | sysIPV6_PATHMTU = 0x2c 32 | 33 | sysIPV6_PKTINFO = 0x2e 34 | sysIPV6_HOPLIMIT = 0x2f 35 | sysIPV6_NEXTHOP = 0x30 36 | sysIPV6_HOPOPTS = 0x31 37 | sysIPV6_DSTOPTS = 0x32 38 | sysIPV6_RTHDR = 0x33 39 | 40 | sysIPV6_RECVTCLASS = 0x39 41 | 42 | sysIPV6_AUTOFLOWLABEL = 0x3b 43 | 44 | sysIPV6_TCLASS = 0x3d 45 | sysIPV6_DONTFRAG = 0x3e 46 | 47 | sysIPV6_PREFER_TEMPADDR = 0x3f 48 | 49 | sysIPV6_PORTRANGE_DEFAULT = 0x0 50 | sysIPV6_PORTRANGE_HIGH = 0x1 51 | sysIPV6_PORTRANGE_LOW = 0x2 52 | 53 | sizeofSockaddrInet6 = 0x1c 54 | sizeofInet6Pktinfo = 0x14 55 | sizeofIPv6Mtuinfo = 0x20 56 | 57 | sizeofIPv6Mreq = 0x14 58 | 59 | sizeofICMPv6Filter = 0x20 60 | ) 61 | 62 | type sockaddrInet6 struct { 63 | Len uint8 64 | Family uint8 65 | Port uint16 66 | Flowinfo uint32 67 | Addr [16]byte /* in6_addr */ 68 | Scope_id uint32 69 | } 70 | 71 | type inet6Pktinfo struct { 72 | Addr [16]byte /* in6_addr */ 73 | Ifindex uint32 74 | } 75 | 76 | type ipv6Mtuinfo struct { 77 | Addr sockaddrInet6 78 | Mtu uint32 79 | } 80 | 81 | type ipv6Mreq struct { 82 | Multiaddr [16]byte /* in6_addr */ 83 | Interface uint32 84 | } 85 | 86 | type icmpv6Filter struct { 87 | Filt [8]uint32 88 | } 89 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/ipv4/sockopt_posix.go: -------------------------------------------------------------------------------- 1 | // Copyright 2012 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build aix darwin dragonfly freebsd linux netbsd openbsd solaris windows 6 | 7 | package ipv4 8 | 9 | import ( 10 | "net" 11 | "unsafe" 12 | 13 | "golang.org/x/net/bpf" 14 | "golang.org/x/net/internal/socket" 15 | ) 16 | 17 | func (so *sockOpt) getMulticastInterface(c *socket.Conn) (*net.Interface, error) { 18 | switch so.typ { 19 | case ssoTypeIPMreqn: 20 | return so.getIPMreqn(c) 21 | default: 22 | return so.getMulticastIf(c) 23 | } 24 | } 25 | 26 | func (so *sockOpt) setMulticastInterface(c *socket.Conn, ifi *net.Interface) error { 27 | switch so.typ { 28 | case ssoTypeIPMreqn: 29 | return so.setIPMreqn(c, ifi, nil) 30 | default: 31 | return so.setMulticastIf(c, ifi) 32 | } 33 | } 34 | 35 | func (so *sockOpt) getICMPFilter(c *socket.Conn) (*ICMPFilter, error) { 36 | b := make([]byte, so.Len) 37 | n, err := so.Get(c, b) 38 | if err != nil { 39 | return nil, err 40 | } 41 | if n != sizeofICMPFilter { 42 | return nil, errNotImplemented 43 | } 44 | return (*ICMPFilter)(unsafe.Pointer(&b[0])), nil 45 | } 46 | 47 | func (so *sockOpt) setICMPFilter(c *socket.Conn, f *ICMPFilter) error { 48 | b := (*[sizeofICMPFilter]byte)(unsafe.Pointer(f))[:sizeofICMPFilter] 49 | return so.Set(c, b) 50 | } 51 | 52 | func (so *sockOpt) setGroup(c *socket.Conn, ifi *net.Interface, grp net.IP) error { 53 | switch so.typ { 54 | case ssoTypeIPMreq: 55 | return so.setIPMreq(c, ifi, grp) 56 | case ssoTypeIPMreqn: 57 | return so.setIPMreqn(c, ifi, grp) 58 | case ssoTypeGroupReq: 59 | return so.setGroupReq(c, ifi, grp) 60 | default: 61 | return errNotImplemented 62 | } 63 | } 64 | 65 | func (so *sockOpt) setSourceGroup(c *socket.Conn, ifi *net.Interface, grp, src net.IP) error { 66 | return so.setGroupSourceReq(c, ifi, grp, src) 67 | } 68 | 69 | func (so *sockOpt) setBPF(c *socket.Conn, f []bpf.RawInstruction) error { 70 | return so.setAttachFilter(c, f) 71 | } 72 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/sys_linux_386.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package socket 6 | 7 | import ( 8 | "syscall" 9 | "unsafe" 10 | ) 11 | 12 | func probeProtocolStack() int { return 4 } 13 | 14 | const ( 15 | sysSETSOCKOPT = 0xe 16 | sysGETSOCKOPT = 0xf 17 | sysSENDMSG = 0x10 18 | sysRECVMSG = 0x11 19 | sysRECVMMSG = 0x13 20 | sysSENDMMSG = 0x14 21 | ) 22 | 23 | func socketcall(call, a0, a1, a2, a3, a4, a5 uintptr) (uintptr, syscall.Errno) 24 | func rawsocketcall(call, a0, a1, a2, a3, a4, a5 uintptr) (uintptr, syscall.Errno) 25 | 26 | func getsockopt(s uintptr, level, name int, b []byte) (int, error) { 27 | l := uint32(len(b)) 28 | _, errno := socketcall(sysGETSOCKOPT, s, uintptr(level), uintptr(name), uintptr(unsafe.Pointer(&b[0])), uintptr(unsafe.Pointer(&l)), 0) 29 | return int(l), errnoErr(errno) 30 | } 31 | 32 | func setsockopt(s uintptr, level, name int, b []byte) error { 33 | _, errno := socketcall(sysSETSOCKOPT, s, uintptr(level), uintptr(name), uintptr(unsafe.Pointer(&b[0])), uintptr(len(b)), 0) 34 | return errnoErr(errno) 35 | } 36 | 37 | func recvmsg(s uintptr, h *msghdr, flags int) (int, error) { 38 | n, errno := socketcall(sysRECVMSG, s, uintptr(unsafe.Pointer(h)), uintptr(flags), 0, 0, 0) 39 | return int(n), errnoErr(errno) 40 | } 41 | 42 | func sendmsg(s uintptr, h *msghdr, flags int) (int, error) { 43 | n, errno := socketcall(sysSENDMSG, s, uintptr(unsafe.Pointer(h)), uintptr(flags), 0, 0, 0) 44 | return int(n), errnoErr(errno) 45 | } 46 | 47 | func recvmmsg(s uintptr, hs []mmsghdr, flags int) (int, error) { 48 | n, errno := socketcall(sysRECVMMSG, s, uintptr(unsafe.Pointer(&hs[0])), uintptr(len(hs)), uintptr(flags), 0, 0) 49 | return int(n), errnoErr(errno) 50 | } 51 | 52 | func sendmmsg(s uintptr, hs []mmsghdr, flags int) (int, error) { 53 | n, errno := socketcall(sysSENDMMSG, s, uintptr(unsafe.Pointer(&hs[0])), uintptr(len(hs)), uintptr(flags), 0, 0) 54 | return int(n), errnoErr(errno) 55 | } 56 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/socket/sys_linux_s390x.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package socket 6 | 7 | import ( 8 | "syscall" 9 | "unsafe" 10 | ) 11 | 12 | func probeProtocolStack() int { return 8 } 13 | 14 | const ( 15 | sysSETSOCKOPT = 0xe 16 | sysGETSOCKOPT = 0xf 17 | sysSENDMSG = 0x10 18 | sysRECVMSG = 0x11 19 | sysRECVMMSG = 0x13 20 | sysSENDMMSG = 0x14 21 | ) 22 | 23 | func socketcall(call, a0, a1, a2, a3, a4, a5 uintptr) (uintptr, syscall.Errno) 24 | func rawsocketcall(call, a0, a1, a2, a3, a4, a5 uintptr) (uintptr, syscall.Errno) 25 | 26 | func getsockopt(s uintptr, level, name int, b []byte) (int, error) { 27 | l := uint32(len(b)) 28 | _, errno := socketcall(sysGETSOCKOPT, s, uintptr(level), uintptr(name), uintptr(unsafe.Pointer(&b[0])), uintptr(unsafe.Pointer(&l)), 0) 29 | return int(l), errnoErr(errno) 30 | } 31 | 32 | func setsockopt(s uintptr, level, name int, b []byte) error { 33 | _, errno := socketcall(sysSETSOCKOPT, s, uintptr(level), uintptr(name), uintptr(unsafe.Pointer(&b[0])), uintptr(len(b)), 0) 34 | return errnoErr(errno) 35 | } 36 | 37 | func recvmsg(s uintptr, h *msghdr, flags int) (int, error) { 38 | n, errno := socketcall(sysRECVMSG, s, uintptr(unsafe.Pointer(h)), uintptr(flags), 0, 0, 0) 39 | return int(n), errnoErr(errno) 40 | } 41 | 42 | func sendmsg(s uintptr, h *msghdr, flags int) (int, error) { 43 | n, errno := socketcall(sysSENDMSG, s, uintptr(unsafe.Pointer(h)), uintptr(flags), 0, 0, 0) 44 | return int(n), errnoErr(errno) 45 | } 46 | 47 | func recvmmsg(s uintptr, hs []mmsghdr, flags int) (int, error) { 48 | n, errno := socketcall(sysRECVMMSG, s, uintptr(unsafe.Pointer(&hs[0])), uintptr(len(hs)), uintptr(flags), 0, 0) 49 | return int(n), errnoErr(errno) 50 | } 51 | 52 | func sendmmsg(s uintptr, hs []mmsghdr, flags int) (int, error) { 53 | n, errno := socketcall(sysSENDMMSG, s, uintptr(unsafe.Pointer(&hs[0])), uintptr(len(hs)), uintptr(flags), 0, 0) 54 | return int(n), errnoErr(errno) 55 | } 56 | -------------------------------------------------------------------------------- /mtr/type.go: -------------------------------------------------------------------------------- 1 | // Copyright 2019 JD Inc. All Rights Reserved. 2 | // type.go - file brief introduce 3 | /* 4 | modification history 5 | ---------------------------------------------- 6 | 2019/5/26 0:20, by wangyulong3@jd.com, create 7 | 8 | */ 9 | /* 10 | Description 11 | 12 | */ 13 | 14 | package mtr 15 | 16 | import ( 17 | "time" 18 | 19 | "github.com/ylwang1122/go-mtr/common" 20 | ) 21 | 22 | const DEFAULT_MAX_HOPS = 30 23 | const DEFAULT_TIMEOUT_MS = 800 24 | const DEFAULT_PACKET_SIZE = 56 25 | const DEFAULT_SNT_SIZE = 10 26 | 27 | type MtrReturn struct { 28 | Success bool 29 | TTL int 30 | Host string 31 | SuccSum int 32 | LastTime time.Duration 33 | AllTime time.Duration 34 | BestTime time.Duration 35 | AvgTime time.Duration 36 | WrstTime time.Duration 37 | } 38 | 39 | type MtrResult struct { 40 | DestAddress string 41 | Hops []common.IcmpHop 42 | } 43 | 44 | type MtrOptions struct { 45 | maxHops int 46 | timeoutMs int 47 | packetSize int 48 | sntSize int 49 | } 50 | 51 | func (options *MtrOptions) MaxHops() int { 52 | if options.maxHops == 0 { 53 | options.maxHops = DEFAULT_MAX_HOPS 54 | } 55 | return options.maxHops 56 | } 57 | 58 | func (options *MtrOptions) SetMaxHops(maxHops int) { 59 | options.maxHops = maxHops 60 | } 61 | 62 | func (options *MtrOptions) TimeoutMs() int { 63 | if options.timeoutMs == 0 { 64 | options.timeoutMs = DEFAULT_TIMEOUT_MS 65 | } 66 | return options.timeoutMs 67 | } 68 | 69 | func (options *MtrOptions) SetTimeoutMs(timeoutMs int) { 70 | options.timeoutMs = timeoutMs 71 | } 72 | 73 | func (options *MtrOptions) SntSize() int { 74 | if options.sntSize == 0 { 75 | options.sntSize = DEFAULT_SNT_SIZE 76 | } 77 | return options.sntSize 78 | } 79 | 80 | func (options *MtrOptions) SetSntSize(sntSize int) { 81 | options.sntSize = sntSize 82 | } 83 | 84 | func (options *MtrOptions) PacketSize() int { 85 | if options.packetSize == 0 { 86 | options.packetSize = DEFAULT_PACKET_SIZE 87 | } 88 | return options.packetSize 89 | } 90 | 91 | func (options *MtrOptions) SetPacketSize(packetSize int) { 92 | options.packetSize = packetSize 93 | } 94 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/ipv6/zsys_openbsd.go: -------------------------------------------------------------------------------- 1 | // Created by cgo -godefs - DO NOT EDIT 2 | // cgo -godefs defs_openbsd.go 3 | 4 | package ipv6 5 | 6 | const ( 7 | sysIPV6_UNICAST_HOPS = 0x4 8 | sysIPV6_MULTICAST_IF = 0x9 9 | sysIPV6_MULTICAST_HOPS = 0xa 10 | sysIPV6_MULTICAST_LOOP = 0xb 11 | sysIPV6_JOIN_GROUP = 0xc 12 | sysIPV6_LEAVE_GROUP = 0xd 13 | sysIPV6_PORTRANGE = 0xe 14 | sysICMP6_FILTER = 0x12 15 | 16 | sysIPV6_CHECKSUM = 0x1a 17 | sysIPV6_V6ONLY = 0x1b 18 | 19 | sysIPV6_RTHDRDSTOPTS = 0x23 20 | 21 | sysIPV6_RECVPKTINFO = 0x24 22 | sysIPV6_RECVHOPLIMIT = 0x25 23 | sysIPV6_RECVRTHDR = 0x26 24 | sysIPV6_RECVHOPOPTS = 0x27 25 | sysIPV6_RECVDSTOPTS = 0x28 26 | 27 | sysIPV6_USE_MIN_MTU = 0x2a 28 | sysIPV6_RECVPATHMTU = 0x2b 29 | 30 | sysIPV6_PATHMTU = 0x2c 31 | 32 | sysIPV6_PKTINFO = 0x2e 33 | sysIPV6_HOPLIMIT = 0x2f 34 | sysIPV6_NEXTHOP = 0x30 35 | sysIPV6_HOPOPTS = 0x31 36 | sysIPV6_DSTOPTS = 0x32 37 | sysIPV6_RTHDR = 0x33 38 | 39 | sysIPV6_AUTH_LEVEL = 0x35 40 | sysIPV6_ESP_TRANS_LEVEL = 0x36 41 | sysIPV6_ESP_NETWORK_LEVEL = 0x37 42 | sysIPSEC6_OUTSA = 0x38 43 | sysIPV6_RECVTCLASS = 0x39 44 | 45 | sysIPV6_AUTOFLOWLABEL = 0x3b 46 | sysIPV6_IPCOMP_LEVEL = 0x3c 47 | 48 | sysIPV6_TCLASS = 0x3d 49 | sysIPV6_DONTFRAG = 0x3e 50 | sysIPV6_PIPEX = 0x3f 51 | 52 | sysIPV6_RTABLE = 0x1021 53 | 54 | sysIPV6_PORTRANGE_DEFAULT = 0x0 55 | sysIPV6_PORTRANGE_HIGH = 0x1 56 | sysIPV6_PORTRANGE_LOW = 0x2 57 | 58 | sizeofSockaddrInet6 = 0x1c 59 | sizeofInet6Pktinfo = 0x14 60 | sizeofIPv6Mtuinfo = 0x20 61 | 62 | sizeofIPv6Mreq = 0x14 63 | 64 | sizeofICMPv6Filter = 0x20 65 | ) 66 | 67 | type sockaddrInet6 struct { 68 | Len uint8 69 | Family uint8 70 | Port uint16 71 | Flowinfo uint32 72 | Addr [16]byte /* in6_addr */ 73 | Scope_id uint32 74 | } 75 | 76 | type inet6Pktinfo struct { 77 | Addr [16]byte /* in6_addr */ 78 | Ifindex uint32 79 | } 80 | 81 | type ipv6Mtuinfo struct { 82 | Addr sockaddrInet6 83 | Mtu uint32 84 | } 85 | 86 | type ipv6Mreq struct { 87 | Multiaddr [16]byte /* in6_addr */ 88 | Interface uint32 89 | } 90 | 91 | type icmpv6Filter struct { 92 | Filt [8]uint32 93 | } 94 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/icmp/mpls.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package icmp 6 | 7 | import "encoding/binary" 8 | 9 | // MPLSLabel represents an MPLS label stack entry. 10 | type MPLSLabel struct { 11 | Label int // label value 12 | TC int // traffic class; formerly experimental use 13 | S bool // bottom of stack 14 | TTL int // time to live 15 | } 16 | 17 | const ( 18 | classMPLSLabelStack = 1 19 | typeIncomingMPLSLabelStack = 1 20 | ) 21 | 22 | // MPLSLabelStack represents an MPLS label stack. 23 | type MPLSLabelStack struct { 24 | Class int // extension object class number 25 | Type int // extension object sub-type 26 | Labels []MPLSLabel 27 | } 28 | 29 | // Len implements the Len method of Extension interface. 30 | func (ls *MPLSLabelStack) Len(proto int) int { 31 | return 4 + (4 * len(ls.Labels)) 32 | } 33 | 34 | // Marshal implements the Marshal method of Extension interface. 35 | func (ls *MPLSLabelStack) Marshal(proto int) ([]byte, error) { 36 | b := make([]byte, ls.Len(proto)) 37 | if err := ls.marshal(proto, b); err != nil { 38 | return nil, err 39 | } 40 | return b, nil 41 | } 42 | 43 | func (ls *MPLSLabelStack) marshal(proto int, b []byte) error { 44 | l := ls.Len(proto) 45 | binary.BigEndian.PutUint16(b[:2], uint16(l)) 46 | b[2], b[3] = classMPLSLabelStack, typeIncomingMPLSLabelStack 47 | off := 4 48 | for _, ll := range ls.Labels { 49 | b[off], b[off+1], b[off+2] = byte(ll.Label>>12), byte(ll.Label>>4&0xff), byte(ll.Label<<4&0xf0) 50 | b[off+2] |= byte(ll.TC << 1 & 0x0e) 51 | if ll.S { 52 | b[off+2] |= 0x1 53 | } 54 | b[off+3] = byte(ll.TTL) 55 | off += 4 56 | } 57 | return nil 58 | } 59 | 60 | func parseMPLSLabelStack(b []byte) (Extension, error) { 61 | ls := &MPLSLabelStack{ 62 | Class: int(b[2]), 63 | Type: int(b[3]), 64 | } 65 | for b = b[4:]; len(b) >= 4; b = b[4:] { 66 | ll := MPLSLabel{ 67 | Label: int(b[0])<<12 | int(b[1])<<4 | int(b[2])>>4, 68 | TC: int(b[2]&0x0e) >> 1, 69 | TTL: int(b[3]), 70 | } 71 | if b[2]&0x1 != 0 { 72 | ll.S = true 73 | } 74 | ls.Labels = append(ls.Labels, ll) 75 | } 76 | return ls, nil 77 | } 78 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/icmp/paramprob.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package icmp 6 | 7 | import ( 8 | "encoding/binary" 9 | 10 | "golang.org/x/net/internal/iana" 11 | "golang.org/x/net/ipv4" 12 | ) 13 | 14 | // A ParamProb represents an ICMP parameter problem message body. 15 | type ParamProb struct { 16 | Pointer uintptr // offset within the data where the error was detected 17 | Data []byte // data, known as original datagram field 18 | Extensions []Extension // extensions 19 | } 20 | 21 | // Len implements the Len method of MessageBody interface. 22 | func (p *ParamProb) Len(proto int) int { 23 | if p == nil { 24 | return 0 25 | } 26 | l, _ := multipartMessageBodyDataLen(proto, true, p.Data, p.Extensions) 27 | return l 28 | } 29 | 30 | // Marshal implements the Marshal method of MessageBody interface. 31 | func (p *ParamProb) Marshal(proto int) ([]byte, error) { 32 | switch proto { 33 | case iana.ProtocolICMP: 34 | if !validExtensions(ipv4.ICMPTypeParameterProblem, p.Extensions) { 35 | return nil, errInvalidExtension 36 | } 37 | b, err := marshalMultipartMessageBody(proto, true, p.Data, p.Extensions) 38 | if err != nil { 39 | return nil, err 40 | } 41 | b[0] = byte(p.Pointer) 42 | return b, nil 43 | case iana.ProtocolIPv6ICMP: 44 | b := make([]byte, p.Len(proto)) 45 | binary.BigEndian.PutUint32(b[:4], uint32(p.Pointer)) 46 | copy(b[4:], p.Data) 47 | return b, nil 48 | default: 49 | return nil, errInvalidProtocol 50 | } 51 | } 52 | 53 | // parseParamProb parses b as an ICMP parameter problem message body. 54 | func parseParamProb(proto int, typ Type, b []byte) (MessageBody, error) { 55 | if len(b) < 4 { 56 | return nil, errMessageTooShort 57 | } 58 | p := &ParamProb{} 59 | if proto == iana.ProtocolIPv6ICMP { 60 | p.Pointer = uintptr(binary.BigEndian.Uint32(b[:4])) 61 | p.Data = make([]byte, len(b)-4) 62 | copy(p.Data, b[4:]) 63 | return p, nil 64 | } 65 | p.Pointer = uintptr(b[0]) 66 | var err error 67 | p.Data, p.Extensions, err = parseMultipartMessageBody(proto, typ, b) 68 | if err != nil { 69 | return nil, err 70 | } 71 | return p, nil 72 | } 73 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/ipv4/helper.go: -------------------------------------------------------------------------------- 1 | // Copyright 2012 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package ipv4 6 | 7 | import ( 8 | "errors" 9 | "net" 10 | "runtime" 11 | 12 | "golang.org/x/net/internal/socket" 13 | ) 14 | 15 | var ( 16 | errInvalidConn = errors.New("invalid connection") 17 | errMissingAddress = errors.New("missing address") 18 | errMissingHeader = errors.New("missing header") 19 | errNilHeader = errors.New("nil header") 20 | errHeaderTooShort = errors.New("header too short") 21 | errExtHeaderTooShort = errors.New("extension header too short") 22 | errInvalidConnType = errors.New("invalid conn type") 23 | errNoSuchInterface = errors.New("no such interface") 24 | errNoSuchMulticastInterface = errors.New("no such multicast interface") 25 | errNotImplemented = errors.New("not implemented on " + runtime.GOOS + "/" + runtime.GOARCH) 26 | 27 | // See https://www.freebsd.org/doc/en/books/porters-handbook/versions.html. 28 | freebsdVersion uint32 29 | compatFreeBSD32 bool // 386 emulation on amd64 30 | ) 31 | 32 | // See golang.org/issue/30899. 33 | func adjustFreeBSD32(m *socket.Message) { 34 | // FreeBSD 12.0-RELEASE is affected by https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=236737 35 | if 1200086 <= freebsdVersion && freebsdVersion < 1201000 { 36 | l := (m.NN + 4 - 1) &^ (4 - 1) 37 | if m.NN < l && l <= len(m.OOB) { 38 | m.NN = l 39 | } 40 | } 41 | } 42 | 43 | func boolint(b bool) int { 44 | if b { 45 | return 1 46 | } 47 | return 0 48 | } 49 | 50 | func netAddrToIP4(a net.Addr) net.IP { 51 | switch v := a.(type) { 52 | case *net.UDPAddr: 53 | if ip := v.IP.To4(); ip != nil { 54 | return ip 55 | } 56 | case *net.IPAddr: 57 | if ip := v.IP.To4(); ip != nil { 58 | return ip 59 | } 60 | } 61 | return nil 62 | } 63 | 64 | func opAddr(a net.Addr) net.Addr { 65 | switch a.(type) { 66 | case *net.TCPAddr: 67 | if a == nil { 68 | return nil 69 | } 70 | case *net.UDPAddr: 71 | if a == nil { 72 | return nil 73 | } 74 | case *net.IPAddr: 75 | if a == nil { 76 | return nil 77 | } 78 | } 79 | return a 80 | } 81 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/icmp/ipv4.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package icmp 6 | 7 | import ( 8 | "encoding/binary" 9 | "net" 10 | "runtime" 11 | 12 | "golang.org/x/net/internal/socket" 13 | "golang.org/x/net/ipv4" 14 | ) 15 | 16 | // freebsdVersion is set in sys_freebsd.go. 17 | // See http://www.freebsd.org/doc/en/books/porters-handbook/freebsd-versions.html. 18 | var freebsdVersion uint32 19 | 20 | // ParseIPv4Header returns the IPv4 header of the IPv4 packet that 21 | // triggered an ICMP error message. 22 | // This is found in the Data field of the ICMP error message body. 23 | // 24 | // The provided b must be in the format used by a raw ICMP socket on 25 | // the local system. 26 | // This may differ from the wire format, and the format used by a raw 27 | // IP socket, depending on the system. 28 | // 29 | // To parse an IPv6 header, use ipv6.ParseHeader. 30 | func ParseIPv4Header(b []byte) (*ipv4.Header, error) { 31 | if len(b) < ipv4.HeaderLen { 32 | return nil, errHeaderTooShort 33 | } 34 | hdrlen := int(b[0]&0x0f) << 2 35 | if hdrlen > len(b) { 36 | return nil, errBufferTooShort 37 | } 38 | h := &ipv4.Header{ 39 | Version: int(b[0] >> 4), 40 | Len: hdrlen, 41 | TOS: int(b[1]), 42 | ID: int(binary.BigEndian.Uint16(b[4:6])), 43 | FragOff: int(binary.BigEndian.Uint16(b[6:8])), 44 | TTL: int(b[8]), 45 | Protocol: int(b[9]), 46 | Checksum: int(binary.BigEndian.Uint16(b[10:12])), 47 | Src: net.IPv4(b[12], b[13], b[14], b[15]), 48 | Dst: net.IPv4(b[16], b[17], b[18], b[19]), 49 | } 50 | switch runtime.GOOS { 51 | case "darwin": 52 | h.TotalLen = int(socket.NativeEndian.Uint16(b[2:4])) 53 | case "freebsd": 54 | if freebsdVersion >= 1000000 { 55 | h.TotalLen = int(binary.BigEndian.Uint16(b[2:4])) 56 | } else { 57 | h.TotalLen = int(socket.NativeEndian.Uint16(b[2:4])) 58 | } 59 | default: 60 | h.TotalLen = int(binary.BigEndian.Uint16(b[2:4])) 61 | } 62 | h.Flags = ipv4.HeaderFlags(h.FragOff&0xe000) >> 13 63 | h.FragOff = h.FragOff & 0x1fff 64 | if hdrlen-ipv4.HeaderLen > 0 { 65 | h.Options = make([]byte, hdrlen-ipv4.HeaderLen) 66 | copy(h.Options, b[ipv4.HeaderLen:]) 67 | } 68 | return h, nil 69 | } 70 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/ipv6/sys_windows.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package ipv6 6 | 7 | import ( 8 | "net" 9 | "syscall" 10 | 11 | "golang.org/x/net/internal/iana" 12 | "golang.org/x/net/internal/socket" 13 | ) 14 | 15 | const ( 16 | // See ws2tcpip.h. 17 | sysIPV6_UNICAST_HOPS = 0x4 18 | sysIPV6_MULTICAST_IF = 0x9 19 | sysIPV6_MULTICAST_HOPS = 0xa 20 | sysIPV6_MULTICAST_LOOP = 0xb 21 | sysIPV6_JOIN_GROUP = 0xc 22 | sysIPV6_LEAVE_GROUP = 0xd 23 | sysIPV6_PKTINFO = 0x13 24 | 25 | sizeofSockaddrInet6 = 0x1c 26 | 27 | sizeofIPv6Mreq = 0x14 28 | sizeofIPv6Mtuinfo = 0x20 29 | sizeofICMPv6Filter = 0 30 | ) 31 | 32 | type sockaddrInet6 struct { 33 | Family uint16 34 | Port uint16 35 | Flowinfo uint32 36 | Addr [16]byte /* in6_addr */ 37 | Scope_id uint32 38 | } 39 | 40 | type ipv6Mreq struct { 41 | Multiaddr [16]byte /* in6_addr */ 42 | Interface uint32 43 | } 44 | 45 | type ipv6Mtuinfo struct { 46 | Addr sockaddrInet6 47 | Mtu uint32 48 | } 49 | 50 | type icmpv6Filter struct { 51 | // TODO(mikio): implement this 52 | } 53 | 54 | var ( 55 | ctlOpts = [ctlMax]ctlOpt{} 56 | 57 | sockOpts = map[int]*sockOpt{ 58 | ssoHopLimit: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: sysIPV6_UNICAST_HOPS, Len: 4}}, 59 | ssoMulticastInterface: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: sysIPV6_MULTICAST_IF, Len: 4}}, 60 | ssoMulticastHopLimit: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: sysIPV6_MULTICAST_HOPS, Len: 4}}, 61 | ssoMulticastLoopback: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: sysIPV6_MULTICAST_LOOP, Len: 4}}, 62 | ssoJoinGroup: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: sysIPV6_JOIN_GROUP, Len: sizeofIPv6Mreq}, typ: ssoTypeIPMreq}, 63 | ssoLeaveGroup: {Option: socket.Option{Level: iana.ProtocolIPv6, Name: sysIPV6_LEAVE_GROUP, Len: sizeofIPv6Mreq}, typ: ssoTypeIPMreq}, 64 | } 65 | ) 66 | 67 | func (sa *sockaddrInet6) setSockaddr(ip net.IP, i int) { 68 | sa.Family = syscall.AF_INET6 69 | copy(sa.Addr[:], ip) 70 | sa.Scope_id = uint32(i) 71 | } 72 | 73 | func (mreq *ipv6Mreq) setIfindex(i int) { 74 | mreq.Interface = uint32(i) 75 | } 76 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/ipv6/zsys_aix_ppc64.go: -------------------------------------------------------------------------------- 1 | // Code generated by cmd/cgo -godefs; DO NOT EDIT. 2 | // cgo -godefs defs_aix.go 3 | 4 | // Added for go1.11 compatibility 5 | // +build aix 6 | 7 | package ipv6 8 | 9 | const ( 10 | sysIPV6_UNICAST_HOPS = 0x4 11 | sysIPV6_MULTICAST_IF = 0x9 12 | sysIPV6_MULTICAST_HOPS = 0xa 13 | sysIPV6_MULTICAST_LOOP = 0xb 14 | sysIPV6_JOIN_GROUP = 0xc 15 | sysIPV6_LEAVE_GROUP = 0xd 16 | sysICMP6_FILTER = 0x26 17 | 18 | sysIPV6_CHECKSUM = 0x27 19 | sysIPV6_V6ONLY = 0x25 20 | 21 | sysIPV6_RTHDRDSTOPTS = 0x37 22 | 23 | sysIPV6_RECVPKTINFO = 0x23 24 | sysIPV6_RECVHOPLIMIT = 0x29 25 | sysIPV6_RECVRTHDR = 0x33 26 | sysIPV6_RECVHOPOPTS = 0x35 27 | sysIPV6_RECVDSTOPTS = 0x38 28 | 29 | sysIPV6_USE_MIN_MTU = 0x2c 30 | sysIPV6_RECVPATHMTU = 0x2f 31 | sysIPV6_PATHMTU = 0x2e 32 | 33 | sysIPV6_PKTINFO = 0x21 34 | sysIPV6_HOPLIMIT = 0x28 35 | sysIPV6_NEXTHOP = 0x30 36 | sysIPV6_HOPOPTS = 0x34 37 | sysIPV6_DSTOPTS = 0x36 38 | sysIPV6_RTHDR = 0x32 39 | 40 | sysIPV6_RECVTCLASS = 0x2a 41 | 42 | sysIPV6_TCLASS = 0x2b 43 | sysIPV6_DONTFRAG = 0x2d 44 | 45 | sizeofSockaddrStorage = 0x508 46 | sizeofSockaddrInet6 = 0x1c 47 | sizeofInet6Pktinfo = 0x14 48 | sizeofIPv6Mtuinfo = 0x20 49 | 50 | sizeofIPv6Mreq = 0x14 51 | sizeofGroupReq = 0x510 52 | sizeofGroupSourceReq = 0xa18 53 | 54 | sizeofICMPv6Filter = 0x20 55 | ) 56 | 57 | type sockaddrStorage struct { 58 | X__ss_len uint8 59 | Family uint8 60 | X__ss_pad1 [6]uint8 61 | X__ss_align int64 62 | X__ss_pad2 [1265]uint8 63 | Pad_cgo_0 [7]byte 64 | } 65 | 66 | type sockaddrInet6 struct { 67 | Len uint8 68 | Family uint8 69 | Port uint16 70 | Flowinfo uint32 71 | Addr [16]byte /* in6_addr */ 72 | Scope_id uint32 73 | } 74 | 75 | type inet6Pktinfo struct { 76 | Addr [16]byte /* in6_addr */ 77 | Ifindex int32 78 | } 79 | 80 | type ipv6Mtuinfo struct { 81 | Addr sockaddrInet6 82 | Mtu uint32 83 | } 84 | 85 | type ipv6Mreq struct { 86 | Multiaddr [16]byte /* in6_addr */ 87 | Interface uint32 88 | } 89 | 90 | type icmpv6Filter struct { 91 | Filt [8]uint32 92 | } 93 | 94 | type groupReq struct { 95 | Interface uint32 96 | Group sockaddrStorage 97 | } 98 | 99 | type groupSourceReq struct { 100 | Interface uint32 101 | Group sockaddrStorage 102 | Source sockaddrStorage 103 | } 104 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/ipv4/sys_windows.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package ipv4 6 | 7 | import ( 8 | "golang.org/x/net/internal/iana" 9 | "golang.org/x/net/internal/socket" 10 | ) 11 | 12 | const ( 13 | // See ws2tcpip.h. 14 | sysIP_OPTIONS = 0x1 15 | sysIP_HDRINCL = 0x2 16 | sysIP_TOS = 0x3 17 | sysIP_TTL = 0x4 18 | sysIP_MULTICAST_IF = 0x9 19 | sysIP_MULTICAST_TTL = 0xa 20 | sysIP_MULTICAST_LOOP = 0xb 21 | sysIP_ADD_MEMBERSHIP = 0xc 22 | sysIP_DROP_MEMBERSHIP = 0xd 23 | sysIP_DONTFRAGMENT = 0xe 24 | sysIP_ADD_SOURCE_MEMBERSHIP = 0xf 25 | sysIP_DROP_SOURCE_MEMBERSHIP = 0x10 26 | sysIP_PKTINFO = 0x13 27 | 28 | sizeofInetPktinfo = 0x8 29 | sizeofIPMreq = 0x8 30 | sizeofIPMreqSource = 0xc 31 | ) 32 | 33 | type inetPktinfo struct { 34 | Addr [4]byte 35 | Ifindex int32 36 | } 37 | 38 | type ipMreq struct { 39 | Multiaddr [4]byte 40 | Interface [4]byte 41 | } 42 | 43 | type ipMreqSource struct { 44 | Multiaddr [4]byte 45 | Sourceaddr [4]byte 46 | Interface [4]byte 47 | } 48 | 49 | // See http://msdn.microsoft.com/en-us/library/windows/desktop/ms738586(v=vs.85).aspx 50 | var ( 51 | ctlOpts = [ctlMax]ctlOpt{} 52 | 53 | sockOpts = map[int]*sockOpt{ 54 | ssoTOS: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_TOS, Len: 4}}, 55 | ssoTTL: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_TTL, Len: 4}}, 56 | ssoMulticastTTL: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_MULTICAST_TTL, Len: 4}}, 57 | ssoMulticastInterface: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_MULTICAST_IF, Len: 4}}, 58 | ssoMulticastLoopback: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_MULTICAST_LOOP, Len: 4}}, 59 | ssoHeaderPrepend: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_HDRINCL, Len: 4}}, 60 | ssoJoinGroup: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_ADD_MEMBERSHIP, Len: sizeofIPMreq}, typ: ssoTypeIPMreq}, 61 | ssoLeaveGroup: {Option: socket.Option{Level: iana.ProtocolIP, Name: sysIP_DROP_MEMBERSHIP, Len: sizeofIPMreq}, typ: ssoTypeIPMreq}, 62 | } 63 | ) 64 | 65 | func (pi *inetPktinfo) setIfindex(i int) { 66 | pi.Ifindex = int32(i) 67 | } 68 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/ipv4/zsys_freebsd_386.go: -------------------------------------------------------------------------------- 1 | // Created by cgo -godefs - DO NOT EDIT 2 | // cgo -godefs defs_freebsd.go 3 | 4 | package ipv4 5 | 6 | const ( 7 | sysIP_OPTIONS = 0x1 8 | sysIP_HDRINCL = 0x2 9 | sysIP_TOS = 0x3 10 | sysIP_TTL = 0x4 11 | sysIP_RECVOPTS = 0x5 12 | sysIP_RECVRETOPTS = 0x6 13 | sysIP_RECVDSTADDR = 0x7 14 | sysIP_SENDSRCADDR = 0x7 15 | sysIP_RETOPTS = 0x8 16 | sysIP_RECVIF = 0x14 17 | sysIP_ONESBCAST = 0x17 18 | sysIP_BINDANY = 0x18 19 | sysIP_RECVTTL = 0x41 20 | sysIP_MINTTL = 0x42 21 | sysIP_DONTFRAG = 0x43 22 | sysIP_RECVTOS = 0x44 23 | 24 | sysIP_MULTICAST_IF = 0x9 25 | sysIP_MULTICAST_TTL = 0xa 26 | sysIP_MULTICAST_LOOP = 0xb 27 | sysIP_ADD_MEMBERSHIP = 0xc 28 | sysIP_DROP_MEMBERSHIP = 0xd 29 | sysIP_MULTICAST_VIF = 0xe 30 | sysIP_ADD_SOURCE_MEMBERSHIP = 0x46 31 | sysIP_DROP_SOURCE_MEMBERSHIP = 0x47 32 | sysIP_BLOCK_SOURCE = 0x48 33 | sysIP_UNBLOCK_SOURCE = 0x49 34 | sysMCAST_JOIN_GROUP = 0x50 35 | sysMCAST_LEAVE_GROUP = 0x51 36 | sysMCAST_JOIN_SOURCE_GROUP = 0x52 37 | sysMCAST_LEAVE_SOURCE_GROUP = 0x53 38 | sysMCAST_BLOCK_SOURCE = 0x54 39 | sysMCAST_UNBLOCK_SOURCE = 0x55 40 | 41 | sizeofSockaddrStorage = 0x80 42 | sizeofSockaddrInet = 0x10 43 | 44 | sizeofIPMreq = 0x8 45 | sizeofIPMreqn = 0xc 46 | sizeofIPMreqSource = 0xc 47 | sizeofGroupReq = 0x84 48 | sizeofGroupSourceReq = 0x104 49 | ) 50 | 51 | type sockaddrStorage struct { 52 | Len uint8 53 | Family uint8 54 | X__ss_pad1 [6]int8 55 | X__ss_align int64 56 | X__ss_pad2 [112]int8 57 | } 58 | 59 | type sockaddrInet struct { 60 | Len uint8 61 | Family uint8 62 | Port uint16 63 | Addr [4]byte /* in_addr */ 64 | Zero [8]int8 65 | } 66 | 67 | type ipMreq struct { 68 | Multiaddr [4]byte /* in_addr */ 69 | Interface [4]byte /* in_addr */ 70 | } 71 | 72 | type ipMreqn struct { 73 | Multiaddr [4]byte /* in_addr */ 74 | Address [4]byte /* in_addr */ 75 | Ifindex int32 76 | } 77 | 78 | type ipMreqSource struct { 79 | Multiaddr [4]byte /* in_addr */ 80 | Sourceaddr [4]byte /* in_addr */ 81 | Interface [4]byte /* in_addr */ 82 | } 83 | 84 | type groupReq struct { 85 | Interface uint32 86 | Group sockaddrStorage 87 | } 88 | 89 | type groupSourceReq struct { 90 | Interface uint32 91 | Group sockaddrStorage 92 | Source sockaddrStorage 93 | } 94 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/ipv6/defs_netbsd.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build ignore 6 | 7 | // +godefs map struct_in6_addr [16]byte /* in6_addr */ 8 | 9 | package ipv6 10 | 11 | /* 12 | #include 13 | #include 14 | 15 | #include 16 | #include 17 | */ 18 | import "C" 19 | 20 | const ( 21 | sysIPV6_UNICAST_HOPS = C.IPV6_UNICAST_HOPS 22 | sysIPV6_MULTICAST_IF = C.IPV6_MULTICAST_IF 23 | sysIPV6_MULTICAST_HOPS = C.IPV6_MULTICAST_HOPS 24 | sysIPV6_MULTICAST_LOOP = C.IPV6_MULTICAST_LOOP 25 | sysIPV6_JOIN_GROUP = C.IPV6_JOIN_GROUP 26 | sysIPV6_LEAVE_GROUP = C.IPV6_LEAVE_GROUP 27 | sysIPV6_PORTRANGE = C.IPV6_PORTRANGE 28 | sysICMP6_FILTER = C.ICMP6_FILTER 29 | 30 | sysIPV6_CHECKSUM = C.IPV6_CHECKSUM 31 | sysIPV6_V6ONLY = C.IPV6_V6ONLY 32 | 33 | sysIPV6_IPSEC_POLICY = C.IPV6_IPSEC_POLICY 34 | 35 | sysIPV6_RTHDRDSTOPTS = C.IPV6_RTHDRDSTOPTS 36 | 37 | sysIPV6_RECVPKTINFO = C.IPV6_RECVPKTINFO 38 | sysIPV6_RECVHOPLIMIT = C.IPV6_RECVHOPLIMIT 39 | sysIPV6_RECVRTHDR = C.IPV6_RECVRTHDR 40 | sysIPV6_RECVHOPOPTS = C.IPV6_RECVHOPOPTS 41 | sysIPV6_RECVDSTOPTS = C.IPV6_RECVDSTOPTS 42 | 43 | sysIPV6_USE_MIN_MTU = C.IPV6_USE_MIN_MTU 44 | sysIPV6_RECVPATHMTU = C.IPV6_RECVPATHMTU 45 | sysIPV6_PATHMTU = C.IPV6_PATHMTU 46 | 47 | sysIPV6_PKTINFO = C.IPV6_PKTINFO 48 | sysIPV6_HOPLIMIT = C.IPV6_HOPLIMIT 49 | sysIPV6_NEXTHOP = C.IPV6_NEXTHOP 50 | sysIPV6_HOPOPTS = C.IPV6_HOPOPTS 51 | sysIPV6_DSTOPTS = C.IPV6_DSTOPTS 52 | sysIPV6_RTHDR = C.IPV6_RTHDR 53 | 54 | sysIPV6_RECVTCLASS = C.IPV6_RECVTCLASS 55 | 56 | sysIPV6_TCLASS = C.IPV6_TCLASS 57 | sysIPV6_DONTFRAG = C.IPV6_DONTFRAG 58 | 59 | sysIPV6_PORTRANGE_DEFAULT = C.IPV6_PORTRANGE_DEFAULT 60 | sysIPV6_PORTRANGE_HIGH = C.IPV6_PORTRANGE_HIGH 61 | sysIPV6_PORTRANGE_LOW = C.IPV6_PORTRANGE_LOW 62 | 63 | sizeofSockaddrInet6 = C.sizeof_struct_sockaddr_in6 64 | sizeofInet6Pktinfo = C.sizeof_struct_in6_pktinfo 65 | sizeofIPv6Mtuinfo = C.sizeof_struct_ip6_mtuinfo 66 | 67 | sizeofIPv6Mreq = C.sizeof_struct_ipv6_mreq 68 | 69 | sizeofICMPv6Filter = C.sizeof_struct_icmp6_filter 70 | ) 71 | 72 | type sockaddrInet6 C.struct_sockaddr_in6 73 | 74 | type inet6Pktinfo C.struct_in6_pktinfo 75 | 76 | type ipv6Mtuinfo C.struct_ip6_mtuinfo 77 | 78 | type ipv6Mreq C.struct_ipv6_mreq 79 | 80 | type icmpv6Filter C.struct_icmp6_filter 81 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/ipv4/zsys_freebsd_amd64.go: -------------------------------------------------------------------------------- 1 | // Created by cgo -godefs - DO NOT EDIT 2 | // cgo -godefs defs_freebsd.go 3 | 4 | package ipv4 5 | 6 | const ( 7 | sysIP_OPTIONS = 0x1 8 | sysIP_HDRINCL = 0x2 9 | sysIP_TOS = 0x3 10 | sysIP_TTL = 0x4 11 | sysIP_RECVOPTS = 0x5 12 | sysIP_RECVRETOPTS = 0x6 13 | sysIP_RECVDSTADDR = 0x7 14 | sysIP_SENDSRCADDR = 0x7 15 | sysIP_RETOPTS = 0x8 16 | sysIP_RECVIF = 0x14 17 | sysIP_ONESBCAST = 0x17 18 | sysIP_BINDANY = 0x18 19 | sysIP_RECVTTL = 0x41 20 | sysIP_MINTTL = 0x42 21 | sysIP_DONTFRAG = 0x43 22 | sysIP_RECVTOS = 0x44 23 | 24 | sysIP_MULTICAST_IF = 0x9 25 | sysIP_MULTICAST_TTL = 0xa 26 | sysIP_MULTICAST_LOOP = 0xb 27 | sysIP_ADD_MEMBERSHIP = 0xc 28 | sysIP_DROP_MEMBERSHIP = 0xd 29 | sysIP_MULTICAST_VIF = 0xe 30 | sysIP_ADD_SOURCE_MEMBERSHIP = 0x46 31 | sysIP_DROP_SOURCE_MEMBERSHIP = 0x47 32 | sysIP_BLOCK_SOURCE = 0x48 33 | sysIP_UNBLOCK_SOURCE = 0x49 34 | sysMCAST_JOIN_GROUP = 0x50 35 | sysMCAST_LEAVE_GROUP = 0x51 36 | sysMCAST_JOIN_SOURCE_GROUP = 0x52 37 | sysMCAST_LEAVE_SOURCE_GROUP = 0x53 38 | sysMCAST_BLOCK_SOURCE = 0x54 39 | sysMCAST_UNBLOCK_SOURCE = 0x55 40 | 41 | sizeofSockaddrStorage = 0x80 42 | sizeofSockaddrInet = 0x10 43 | 44 | sizeofIPMreq = 0x8 45 | sizeofIPMreqn = 0xc 46 | sizeofIPMreqSource = 0xc 47 | sizeofGroupReq = 0x88 48 | sizeofGroupSourceReq = 0x108 49 | ) 50 | 51 | type sockaddrStorage struct { 52 | Len uint8 53 | Family uint8 54 | X__ss_pad1 [6]int8 55 | X__ss_align int64 56 | X__ss_pad2 [112]int8 57 | } 58 | 59 | type sockaddrInet struct { 60 | Len uint8 61 | Family uint8 62 | Port uint16 63 | Addr [4]byte /* in_addr */ 64 | Zero [8]int8 65 | } 66 | 67 | type ipMreq struct { 68 | Multiaddr [4]byte /* in_addr */ 69 | Interface [4]byte /* in_addr */ 70 | } 71 | 72 | type ipMreqn struct { 73 | Multiaddr [4]byte /* in_addr */ 74 | Address [4]byte /* in_addr */ 75 | Ifindex int32 76 | } 77 | 78 | type ipMreqSource struct { 79 | Multiaddr [4]byte /* in_addr */ 80 | Sourceaddr [4]byte /* in_addr */ 81 | Interface [4]byte /* in_addr */ 82 | } 83 | 84 | type groupReq struct { 85 | Interface uint32 86 | Pad_cgo_0 [4]byte 87 | Group sockaddrStorage 88 | } 89 | 90 | type groupSourceReq struct { 91 | Interface uint32 92 | Pad_cgo_0 [4]byte 93 | Group sockaddrStorage 94 | Source sockaddrStorage 95 | } 96 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/ipv4/zsys_freebsd_arm.go: -------------------------------------------------------------------------------- 1 | // Created by cgo -godefs - DO NOT EDIT 2 | // cgo -godefs defs_freebsd.go 3 | 4 | package ipv4 5 | 6 | const ( 7 | sysIP_OPTIONS = 0x1 8 | sysIP_HDRINCL = 0x2 9 | sysIP_TOS = 0x3 10 | sysIP_TTL = 0x4 11 | sysIP_RECVOPTS = 0x5 12 | sysIP_RECVRETOPTS = 0x6 13 | sysIP_RECVDSTADDR = 0x7 14 | sysIP_SENDSRCADDR = 0x7 15 | sysIP_RETOPTS = 0x8 16 | sysIP_RECVIF = 0x14 17 | sysIP_ONESBCAST = 0x17 18 | sysIP_BINDANY = 0x18 19 | sysIP_RECVTTL = 0x41 20 | sysIP_MINTTL = 0x42 21 | sysIP_DONTFRAG = 0x43 22 | sysIP_RECVTOS = 0x44 23 | 24 | sysIP_MULTICAST_IF = 0x9 25 | sysIP_MULTICAST_TTL = 0xa 26 | sysIP_MULTICAST_LOOP = 0xb 27 | sysIP_ADD_MEMBERSHIP = 0xc 28 | sysIP_DROP_MEMBERSHIP = 0xd 29 | sysIP_MULTICAST_VIF = 0xe 30 | sysIP_ADD_SOURCE_MEMBERSHIP = 0x46 31 | sysIP_DROP_SOURCE_MEMBERSHIP = 0x47 32 | sysIP_BLOCK_SOURCE = 0x48 33 | sysIP_UNBLOCK_SOURCE = 0x49 34 | sysMCAST_JOIN_GROUP = 0x50 35 | sysMCAST_LEAVE_GROUP = 0x51 36 | sysMCAST_JOIN_SOURCE_GROUP = 0x52 37 | sysMCAST_LEAVE_SOURCE_GROUP = 0x53 38 | sysMCAST_BLOCK_SOURCE = 0x54 39 | sysMCAST_UNBLOCK_SOURCE = 0x55 40 | 41 | sizeofSockaddrStorage = 0x80 42 | sizeofSockaddrInet = 0x10 43 | 44 | sizeofIPMreq = 0x8 45 | sizeofIPMreqn = 0xc 46 | sizeofIPMreqSource = 0xc 47 | sizeofGroupReq = 0x88 48 | sizeofGroupSourceReq = 0x108 49 | ) 50 | 51 | type sockaddrStorage struct { 52 | Len uint8 53 | Family uint8 54 | X__ss_pad1 [6]int8 55 | X__ss_align int64 56 | X__ss_pad2 [112]int8 57 | } 58 | 59 | type sockaddrInet struct { 60 | Len uint8 61 | Family uint8 62 | Port uint16 63 | Addr [4]byte /* in_addr */ 64 | Zero [8]int8 65 | } 66 | 67 | type ipMreq struct { 68 | Multiaddr [4]byte /* in_addr */ 69 | Interface [4]byte /* in_addr */ 70 | } 71 | 72 | type ipMreqn struct { 73 | Multiaddr [4]byte /* in_addr */ 74 | Address [4]byte /* in_addr */ 75 | Ifindex int32 76 | } 77 | 78 | type ipMreqSource struct { 79 | Multiaddr [4]byte /* in_addr */ 80 | Sourceaddr [4]byte /* in_addr */ 81 | Interface [4]byte /* in_addr */ 82 | } 83 | 84 | type groupReq struct { 85 | Interface uint32 86 | Pad_cgo_0 [4]byte 87 | Group sockaddrStorage 88 | } 89 | 90 | type groupSourceReq struct { 91 | Interface uint32 92 | Pad_cgo_0 [4]byte 93 | Group sockaddrStorage 94 | Source sockaddrStorage 95 | } 96 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/ipv6/defs_aix.go: -------------------------------------------------------------------------------- 1 | // Copyright 2019 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build ignore 6 | 7 | // +godefs map struct_in6_addr [16]byte /* in6_addr */ 8 | 9 | package ipv6 10 | 11 | /* 12 | #include 13 | #include 14 | 15 | #include 16 | #include 17 | */ 18 | import "C" 19 | 20 | const ( 21 | sysIPV6_UNICAST_HOPS = C.IPV6_UNICAST_HOPS 22 | sysIPV6_MULTICAST_IF = C.IPV6_MULTICAST_IF 23 | sysIPV6_MULTICAST_HOPS = C.IPV6_MULTICAST_HOPS 24 | sysIPV6_MULTICAST_LOOP = C.IPV6_MULTICAST_LOOP 25 | sysIPV6_JOIN_GROUP = C.IPV6_JOIN_GROUP 26 | sysIPV6_LEAVE_GROUP = C.IPV6_LEAVE_GROUP 27 | sysICMP6_FILTER = C.ICMP6_FILTER 28 | 29 | sysIPV6_CHECKSUM = C.IPV6_CHECKSUM 30 | sysIPV6_V6ONLY = C.IPV6_V6ONLY 31 | 32 | sysIPV6_RTHDRDSTOPTS = C.IPV6_RTHDRDSTOPTS 33 | 34 | sysIPV6_RECVPKTINFO = C.IPV6_RECVPKTINFO 35 | sysIPV6_RECVHOPLIMIT = C.IPV6_RECVHOPLIMIT 36 | sysIPV6_RECVRTHDR = C.IPV6_RECVRTHDR 37 | sysIPV6_RECVHOPOPTS = C.IPV6_RECVHOPOPTS 38 | sysIPV6_RECVDSTOPTS = C.IPV6_RECVDSTOPTS 39 | 40 | sysIPV6_USE_MIN_MTU = C.IPV6_USE_MIN_MTU 41 | sysIPV6_RECVPATHMTU = C.IPV6_RECVPATHMTU 42 | sysIPV6_PATHMTU = C.IPV6_PATHMTU 43 | 44 | sysIPV6_PKTINFO = C.IPV6_PKTINFO 45 | sysIPV6_HOPLIMIT = C.IPV6_HOPLIMIT 46 | sysIPV6_NEXTHOP = C.IPV6_NEXTHOP 47 | sysIPV6_HOPOPTS = C.IPV6_HOPOPTS 48 | sysIPV6_DSTOPTS = C.IPV6_DSTOPTS 49 | sysIPV6_RTHDR = C.IPV6_RTHDR 50 | 51 | sysIPV6_RECVTCLASS = C.IPV6_RECVTCLASS 52 | 53 | sysIPV6_TCLASS = C.IPV6_TCLASS 54 | sysIPV6_DONTFRAG = C.IPV6_DONTFRAG 55 | 56 | sizeofSockaddrStorage = C.sizeof_struct_sockaddr_storage 57 | sizeofSockaddrInet6 = C.sizeof_struct_sockaddr_in6 58 | sizeofInet6Pktinfo = C.sizeof_struct_in6_pktinfo 59 | sizeofIPv6Mtuinfo = C.sizeof_struct_ip6_mtuinfo 60 | 61 | sizeofIPv6Mreq = C.sizeof_struct_ipv6_mreq 62 | sizeofGroupReq = C.sizeof_struct_group_req 63 | sizeofGroupSourceReq = C.sizeof_struct_group_source_req 64 | 65 | sizeofICMPv6Filter = C.sizeof_struct_icmp6_filter 66 | ) 67 | 68 | type sockaddrStorage C.struct_sockaddr_storage 69 | 70 | type sockaddrInet6 C.struct_sockaddr_in6 71 | 72 | type inet6Pktinfo C.struct_in6_pktinfo 73 | 74 | type ipv6Mtuinfo C.struct_ip6_mtuinfo 75 | 76 | type ipv6Mreq C.struct_ipv6_mreq 77 | 78 | type icmpv6Filter C.struct_icmp6_filter 79 | 80 | type groupReq C.struct_group_req 81 | 82 | type groupSourceReq C.struct_group_source_req 83 | --------------------------------------------------------------------------------