├── .travis.yml ├── LICENSE ├── README.md ├── cmd └── cmd.go ├── config └── config.go ├── main.go ├── scanner └── scanner.go └── vendor ├── github.com ├── bogdanovich │ └── dns_resolver │ │ ├── LICENSE │ │ ├── README.md │ │ ├── dns_resolver.go │ │ └── resolv.conf ├── bradhe │ └── stopwatch │ │ ├── README.md │ │ ├── main.go │ │ └── stop_watch.go ├── dutchcoders │ └── netstack │ │ ├── LICENSE │ │ ├── README.md │ │ ├── conn.go │ │ ├── ipv4 │ │ ├── helper.go │ │ └── ipv4.go │ │ ├── netstack.go │ │ ├── stack.go │ │ ├── state.go │ │ ├── statetable.go │ │ └── tcp │ │ └── tcp.go ├── fatih │ └── color │ │ ├── LICENSE.md │ │ ├── README.md │ │ ├── color.go │ │ └── doc.go ├── mattn │ ├── go-colorable │ │ ├── LICENSE │ │ ├── README.md │ │ ├── colorable_others.go │ │ ├── colorable_windows.go │ │ └── noncolorable.go │ └── go-isatty │ │ ├── LICENSE │ │ ├── README.md │ │ ├── doc.go │ │ ├── isatty_appengine.go │ │ ├── isatty_bsd.go │ │ ├── isatty_linux.go │ │ ├── isatty_solaris.go │ │ └── isatty_windows.go ├── miekg │ └── dns │ │ ├── AUTHORS │ │ ├── CONTRIBUTORS │ │ ├── COPYRIGHT │ │ ├── LICENSE │ │ ├── README.md │ │ ├── client.go │ │ ├── clientconfig.go │ │ ├── defaults.go │ │ ├── dns.go │ │ ├── dnssec.go │ │ ├── dnssec_keygen.go │ │ ├── dnssec_keyscan.go │ │ ├── dnssec_privkey.go │ │ ├── doc.go │ │ ├── edns.go │ │ ├── format.go │ │ ├── generate.go │ │ ├── labels.go │ │ ├── msg.go │ │ ├── msg_generate.go │ │ ├── msg_helpers.go │ │ ├── nsecx.go │ │ ├── privaterr.go │ │ ├── rawmsg.go │ │ ├── reverse.go │ │ ├── sanitize.go │ │ ├── scan.go │ │ ├── scan_rr.go │ │ ├── scanner.go │ │ ├── server.go │ │ ├── sig0.go │ │ ├── singleinflight.go │ │ ├── tlsa.go │ │ ├── tsig.go │ │ ├── types.go │ │ ├── types_generate.go │ │ ├── udp.go │ │ ├── udp_linux.go │ │ ├── udp_other.go │ │ ├── udp_plan9.go │ │ ├── udp_windows.go │ │ ├── update.go │ │ ├── xfr.go │ │ ├── zmsg.go │ │ └── ztypes.go ├── minio │ └── cli │ │ ├── LICENSE │ │ ├── README.md │ │ ├── app.go │ │ ├── bool.go │ │ ├── cli.go │ │ ├── command.go │ │ ├── context.go │ │ ├── duration.go │ │ ├── flag.go │ │ ├── float64.go │ │ ├── help.go │ │ ├── int.go │ │ ├── intslice.go │ │ ├── string.go │ │ └── stringslice.go ├── op │ └── go-logging │ │ ├── CHANGELOG.md │ │ ├── CONTRIBUTORS │ │ ├── LICENSE │ │ ├── README.md │ │ ├── backend.go │ │ ├── format.go │ │ ├── level.go │ │ ├── log_nix.go │ │ ├── log_windows.go │ │ ├── logger.go │ │ ├── memory.go │ │ ├── multi.go │ │ ├── syslog.go │ │ └── syslog_fallback.go └── pkg │ └── profile │ ├── AUTHORS │ ├── LICENSE │ ├── README.md │ ├── profile.go │ ├── trace.go │ └── trace16.go ├── golang.org └── x │ ├── net │ ├── LICENSE │ ├── PATENTS │ ├── bpf │ │ ├── asm.go │ │ ├── constants.go │ │ ├── doc.go │ │ ├── instructions.go │ │ ├── vm.go │ │ └── vm_instructions.go │ ├── internal │ │ ├── iana │ │ │ ├── const.go │ │ │ └── gen.go │ │ └── netreflect │ │ │ ├── socket.go │ │ │ ├── socket_posix.go │ │ │ └── socket_stub.go │ └── ipv4 │ │ ├── bpfopt_linux.go │ │ ├── bpfopt_stub.go │ │ ├── control.go │ │ ├── control_bsd.go │ │ ├── control_pktinfo.go │ │ ├── control_stub.go │ │ ├── control_unix.go │ │ ├── control_windows.go │ │ ├── defs_darwin.go │ │ ├── defs_dragonfly.go │ │ ├── defs_freebsd.go │ │ ├── defs_linux.go │ │ ├── defs_netbsd.go │ │ ├── defs_openbsd.go │ │ ├── defs_solaris.go │ │ ├── dgramopt_posix.go │ │ ├── dgramopt_stub.go │ │ ├── doc.go │ │ ├── endpoint.go │ │ ├── gen.go │ │ ├── genericopt_posix.go │ │ ├── genericopt_stub.go │ │ ├── header.go │ │ ├── helper.go │ │ ├── iana.go │ │ ├── icmp.go │ │ ├── icmp_linux.go │ │ ├── icmp_stub.go │ │ ├── packet.go │ │ ├── payload.go │ │ ├── payload_cmsg.go │ │ ├── payload_nocmsg.go │ │ ├── sockopt.go │ │ ├── sockopt_asmreq.go │ │ ├── sockopt_asmreq_posix.go │ │ ├── sockopt_asmreq_stub.go │ │ ├── sockopt_asmreqn_stub.go │ │ ├── sockopt_asmreqn_unix.go │ │ ├── sockopt_posix.go │ │ ├── sockopt_ssmreq_stub.go │ │ ├── sockopt_ssmreq_unix.go │ │ ├── sockopt_stub.go │ │ ├── sys_bsd.go │ │ ├── sys_darwin.go │ │ ├── sys_freebsd.go │ │ ├── sys_linux.go │ │ ├── sys_linux_386.s │ │ ├── sys_openbsd.go │ │ ├── sys_solaris.go │ │ ├── sys_solaris_amd64.s │ │ ├── sys_stub.go │ │ ├── sys_windows.go │ │ ├── syscall_linux_386.go │ │ ├── syscall_solaris.go │ │ ├── syscall_unix.go │ │ ├── syscall_windows.go │ │ ├── zsys_darwin.go │ │ ├── zsys_dragonfly.go │ │ ├── zsys_freebsd_386.go │ │ ├── zsys_freebsd_amd64.go │ │ ├── zsys_freebsd_arm.go │ │ ├── zsys_linux_386.go │ │ ├── zsys_linux_amd64.go │ │ ├── zsys_linux_arm.go │ │ ├── zsys_linux_arm64.go │ │ ├── zsys_linux_mips64.go │ │ ├── zsys_linux_mips64le.go │ │ ├── zsys_linux_ppc.go │ │ ├── zsys_linux_ppc64.go │ │ ├── zsys_linux_ppc64le.go │ │ ├── zsys_linux_s390x.go │ │ ├── zsys_netbsd.go │ │ ├── zsys_openbsd.go │ │ └── zsys_solaris.go │ └── sys │ ├── LICENSE │ ├── PATENTS │ └── unix │ ├── asm.s │ ├── asm_darwin_386.s │ ├── asm_darwin_amd64.s │ ├── asm_darwin_arm.s │ ├── asm_darwin_arm64.s │ ├── asm_dragonfly_amd64.s │ ├── asm_freebsd_386.s │ ├── asm_freebsd_amd64.s │ ├── asm_freebsd_arm.s │ ├── asm_linux_386.s │ ├── asm_linux_amd64.s │ ├── asm_linux_arm.s │ ├── asm_linux_arm64.s │ ├── asm_linux_mips64x.s │ ├── asm_linux_ppc64x.s │ ├── asm_linux_s390x.s │ ├── asm_netbsd_386.s │ ├── asm_netbsd_amd64.s │ ├── asm_netbsd_arm.s │ ├── asm_openbsd_386.s │ ├── asm_openbsd_amd64.s │ ├── asm_solaris_amd64.s │ ├── bluetooth_linux.go │ ├── constants.go │ ├── env_unix.go │ ├── env_unset.go │ ├── flock.go │ ├── flock_linux_32bit.go │ ├── gccgo.go │ ├── gccgo_c.c │ ├── gccgo_linux_amd64.go │ ├── gccgo_linux_sparc64.go │ ├── mkall.sh │ ├── mkerrors.sh │ ├── mkpost.go │ ├── mksyscall.pl │ ├── mksyscall_solaris.pl │ ├── mksysctl_openbsd.pl │ ├── mksysnum_darwin.pl │ ├── mksysnum_dragonfly.pl │ ├── mksysnum_freebsd.pl │ ├── mksysnum_linux.pl │ ├── mksysnum_netbsd.pl │ ├── mksysnum_openbsd.pl │ ├── race.go │ ├── race0.go │ ├── sockcmsg_linux.go │ ├── sockcmsg_unix.go │ ├── str.go │ ├── syscall.go │ ├── syscall_bsd.go │ ├── syscall_darwin.go │ ├── syscall_darwin_386.go │ ├── syscall_darwin_amd64.go │ ├── syscall_darwin_arm.go │ ├── syscall_darwin_arm64.go │ ├── syscall_dragonfly.go │ ├── syscall_dragonfly_amd64.go │ ├── syscall_freebsd.go │ ├── syscall_freebsd_386.go │ ├── syscall_freebsd_amd64.go │ ├── syscall_freebsd_arm.go │ ├── syscall_linux.go │ ├── syscall_linux_386.go │ ├── syscall_linux_amd64.go │ ├── syscall_linux_arm.go │ ├── syscall_linux_arm64.go │ ├── syscall_linux_mips64x.go │ ├── syscall_linux_ppc64x.go │ ├── syscall_linux_s390x.go │ ├── syscall_linux_sparc64.go │ ├── syscall_netbsd.go │ ├── syscall_netbsd_386.go │ ├── syscall_netbsd_amd64.go │ ├── syscall_netbsd_arm.go │ ├── syscall_no_getwd.go │ ├── syscall_openbsd.go │ ├── syscall_openbsd_386.go │ ├── syscall_openbsd_amd64.go │ ├── syscall_solaris.go │ ├── syscall_solaris_amd64.go │ ├── syscall_unix.go │ ├── types_darwin.go │ ├── types_dragonfly.go │ ├── types_freebsd.go │ ├── types_linux.go │ ├── types_netbsd.go │ ├── types_openbsd.go │ ├── types_solaris.go │ ├── zerrors_darwin_386.go │ ├── zerrors_darwin_amd64.go │ ├── zerrors_darwin_arm.go │ ├── zerrors_darwin_arm64.go │ ├── zerrors_dragonfly_amd64.go │ ├── zerrors_freebsd_386.go │ ├── zerrors_freebsd_amd64.go │ ├── zerrors_freebsd_arm.go │ ├── zerrors_linux_386.go │ ├── zerrors_linux_amd64.go │ ├── zerrors_linux_arm.go │ ├── zerrors_linux_arm64.go │ ├── zerrors_linux_mips64.go │ ├── zerrors_linux_mips64le.go │ ├── zerrors_linux_ppc64.go │ ├── zerrors_linux_ppc64le.go │ ├── zerrors_linux_s390x.go │ ├── zerrors_linux_sparc64.go │ ├── zerrors_netbsd_386.go │ ├── zerrors_netbsd_amd64.go │ ├── zerrors_netbsd_arm.go │ ├── zerrors_openbsd_386.go │ ├── zerrors_openbsd_amd64.go │ ├── zerrors_solaris_amd64.go │ ├── zsyscall_darwin_386.go │ ├── zsyscall_darwin_amd64.go │ ├── zsyscall_darwin_arm.go │ ├── zsyscall_darwin_arm64.go │ ├── zsyscall_dragonfly_amd64.go │ ├── zsyscall_freebsd_386.go │ ├── zsyscall_freebsd_amd64.go │ ├── zsyscall_freebsd_arm.go │ ├── zsyscall_linux_386.go │ ├── zsyscall_linux_amd64.go │ ├── zsyscall_linux_arm.go │ ├── zsyscall_linux_arm64.go │ ├── zsyscall_linux_mips64.go │ ├── zsyscall_linux_mips64le.go │ ├── zsyscall_linux_ppc64.go │ ├── zsyscall_linux_ppc64le.go │ ├── zsyscall_linux_s390x.go │ ├── zsyscall_linux_sparc64.go │ ├── zsyscall_netbsd_386.go │ ├── zsyscall_netbsd_amd64.go │ ├── zsyscall_netbsd_arm.go │ ├── zsyscall_openbsd_386.go │ ├── zsyscall_openbsd_amd64.go │ ├── zsyscall_solaris_amd64.go │ ├── zsysctl_openbsd.go │ ├── zsysnum_darwin_386.go │ ├── zsysnum_darwin_amd64.go │ ├── zsysnum_darwin_arm.go │ ├── zsysnum_darwin_arm64.go │ ├── zsysnum_dragonfly_amd64.go │ ├── zsysnum_freebsd_386.go │ ├── zsysnum_freebsd_amd64.go │ ├── zsysnum_freebsd_arm.go │ ├── zsysnum_linux_386.go │ ├── zsysnum_linux_amd64.go │ ├── zsysnum_linux_arm.go │ ├── zsysnum_linux_arm64.go │ ├── zsysnum_linux_mips64.go │ ├── zsysnum_linux_mips64le.go │ ├── zsysnum_linux_ppc64.go │ ├── zsysnum_linux_ppc64le.go │ ├── zsysnum_linux_s390x.go │ ├── zsysnum_linux_sparc64.go │ ├── zsysnum_netbsd_386.go │ ├── zsysnum_netbsd_amd64.go │ ├── zsysnum_netbsd_arm.go │ ├── zsysnum_openbsd_386.go │ ├── zsysnum_openbsd_amd64.go │ ├── zsysnum_solaris_amd64.go │ ├── ztypes_darwin_386.go │ ├── ztypes_darwin_amd64.go │ ├── ztypes_darwin_arm.go │ ├── ztypes_darwin_arm64.go │ ├── ztypes_dragonfly_amd64.go │ ├── ztypes_freebsd_386.go │ ├── ztypes_freebsd_amd64.go │ ├── ztypes_freebsd_arm.go │ ├── ztypes_linux_386.go │ ├── ztypes_linux_amd64.go │ ├── ztypes_linux_arm.go │ ├── ztypes_linux_arm64.go │ ├── ztypes_linux_mips64.go │ ├── ztypes_linux_mips64le.go │ ├── ztypes_linux_ppc64.go │ ├── ztypes_linux_ppc64le.go │ ├── ztypes_linux_s390x.go │ ├── ztypes_linux_sparc64.go │ ├── ztypes_netbsd_386.go │ ├── ztypes_netbsd_amd64.go │ ├── ztypes_netbsd_arm.go │ ├── ztypes_openbsd_386.go │ ├── ztypes_openbsd_amd64.go │ └── ztypes_solaris_amd64.go └── vendor.json /.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | 3 | env: 4 | - GIMME_OS=linux GIMME_ARCH=amd64 5 | 6 | go: 7 | - master 8 | 9 | install: 10 | - go get -d -v ./... 11 | 12 | script: 13 | - go build -v ./... 14 | -------------------------------------------------------------------------------- /config/config.go: -------------------------------------------------------------------------------- 1 | package config 2 | 3 | import ( 4 | "reflect" 5 | 6 | "github.com/minio/cli" 7 | ) 8 | 9 | type Config struct { 10 | UseTLS bool `flag:"tls"` 11 | 12 | Port int `flag:"port"` 13 | NumThreads int `flag:"threads"` 14 | 15 | Interface string `flag:"interface"` 16 | 17 | Timeout int `flag:"timeout"` 18 | UserAgent string `flag:"user-agent"` 19 | EnableProfiler bool `flag:"profiler"` 20 | 21 | Resolvers string `flag:"resolvers"` 22 | Prefix string `flag:"prefix"` 23 | 24 | Paths []string 25 | } 26 | 27 | func LoadFromContext(c *cli.Context) *Config { 28 | config := &Config{} 29 | 30 | v2 := reflect.ValueOf(config).Elem() 31 | v := v2.Type() 32 | 33 | for i := 0; i < v.NumField(); i++ { 34 | f := v.Field(i) 35 | 36 | tag := f.Tag.Get("flag") 37 | if tag == "" { 38 | continue 39 | } 40 | 41 | dest := v2.FieldByName(f.Name) 42 | 43 | switch f.Type.Kind() { 44 | case reflect.Bool: 45 | dest.SetBool(c.GlobalBool(tag)) 46 | case reflect.Int: 47 | dest.SetInt(int64(c.GlobalInt(tag))) 48 | case reflect.String: 49 | dest.SetString(c.GlobalString(tag)) 50 | } 51 | } 52 | return config 53 | } 54 | -------------------------------------------------------------------------------- /main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | cmd "github.com/dutchcoders/anam/cmd" 5 | ) 6 | 7 | func main() { 8 | app := cmd.New() 9 | app.RunAndExitOnError() 10 | } 11 | -------------------------------------------------------------------------------- /vendor/github.com/bogdanovich/dns_resolver/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Anton Bogdanovich 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /vendor/github.com/bogdanovich/dns_resolver/README.md: -------------------------------------------------------------------------------- 1 | # Simple dns resolver implemented in go 2 | [![Build Status](https://travis-ci.org/bogdanovich/dns_resolver.svg?branch=master)](https://travis-ci.org/bogdanovich/dns_resolver) 3 | [![Go Walker](http://gowalker.org/api/v1/badge)](https://gowalker.org/github.com/bogdanovich/dns_resolver) 4 | 5 | Based on based on miekg/dns. 6 | 7 | ## Features 8 | 9 | - Uses provided dns servers array in random order 10 | - Retries dns requests in case of i/o timeout 11 | 12 | ## Installing 13 | 14 | ### Using *go get* 15 | 16 | $ go get github.com/bogdanovich/dns_resolver 17 | 18 | After this command *dns_resolver* is ready to use. Its source will be in: 19 | 20 | $GOPATH/src/github.com/bogdanovich/dns_resolver 21 | 22 | ## Example 23 | 24 | ``` go 25 | package main 26 | 27 | import ( 28 | "log" 29 | "github.com/bogdanovich/dns_resolver" 30 | ) 31 | 32 | func main() { 33 | resolver := dns_resolver.New([]string{"8.8.8.8", "8.8.4.4"}) 34 | // OR 35 | // resolver := dns_resolver.NewFromResolvConf("resolv.conf") 36 | 37 | // In case of i/o timeout 38 | resolver.RetryTimes = 5 39 | 40 | ip, err := resolver.LookupHost("google.com") 41 | if err != nil { 42 | log.Fatal(err.Error()) 43 | } 44 | log.Println(ip) 45 | // Output [216.58.192.46] 46 | } 47 | 48 | ``` 49 | -------------------------------------------------------------------------------- /vendor/github.com/bogdanovich/dns_resolver/dns_resolver.go: -------------------------------------------------------------------------------- 1 | // Package dns_resolver is a simple dns resolver 2 | // based on miekg/dns 3 | package dns_resolver 4 | 5 | import ( 6 | "errors" 7 | "math/rand" 8 | "net" 9 | "os" 10 | "strings" 11 | "time" 12 | 13 | "github.com/miekg/dns" 14 | ) 15 | 16 | // DnsResolver represents a dns resolver 17 | type DnsResolver struct { 18 | Servers []string 19 | RetryTimes int 20 | r *rand.Rand 21 | } 22 | 23 | // New initializes DnsResolver. 24 | func New(servers []string) *DnsResolver { 25 | for i := range servers { 26 | servers[i] += ":53" 27 | } 28 | 29 | return &DnsResolver{servers, len(servers) * 2, rand.New(rand.NewSource(time.Now().UnixNano()))} 30 | } 31 | 32 | // NewFromResolvConf initializes DnsResolver from resolv.conf like file. 33 | func NewFromResolvConf(path string) (*DnsResolver, error) { 34 | if _, err := os.Stat(path); os.IsNotExist(err) { 35 | return &DnsResolver{}, errors.New("no such file or directory: " + path) 36 | } 37 | config, err := dns.ClientConfigFromFile(path) 38 | servers := []string{} 39 | for _, ipAddress := range config.Servers { 40 | servers = append(servers, ipAddress+":53") 41 | } 42 | return &DnsResolver{servers, len(servers) * 2, rand.New(rand.NewSource(time.Now().UnixNano()))}, err 43 | } 44 | 45 | // LookupHost returns IP addresses of provied host. 46 | // In case of timeout retries query RetryTimes times. 47 | func (r *DnsResolver) LookupHost(host string) ([]net.IP, error) { 48 | return r.lookupHost(host, r.RetryTimes) 49 | } 50 | 51 | func (r *DnsResolver) lookupHost(host string, triesLeft int) ([]net.IP, error) { 52 | m1 := new(dns.Msg) 53 | m1.Id = dns.Id() 54 | m1.RecursionDesired = true 55 | m1.Question = make([]dns.Question, 1) 56 | m1.Question[0] = dns.Question{dns.Fqdn(host), dns.TypeA, dns.ClassINET} 57 | in, err := dns.Exchange(m1, r.Servers[r.r.Intn(len(r.Servers))]) 58 | 59 | result := []net.IP{} 60 | 61 | if err != nil { 62 | if strings.HasSuffix(err.Error(), "i/o timeout") && triesLeft > 0 { 63 | triesLeft-- 64 | return r.lookupHost(host, triesLeft) 65 | } 66 | return result, err 67 | } 68 | 69 | if in != nil && in.Rcode != dns.RcodeSuccess { 70 | return result, errors.New(dns.RcodeToString[in.Rcode]) 71 | } 72 | 73 | for _, record := range in.Answer { 74 | if t, ok := record.(*dns.A); ok { 75 | result = append(result, t.A) 76 | } 77 | } 78 | return result, err 79 | } 80 | -------------------------------------------------------------------------------- /vendor/github.com/bogdanovich/dns_resolver/resolv.conf: -------------------------------------------------------------------------------- 1 | nameserver 8.8.8.8 2 | nameserver 8.8.4.4 3 | 4 | -------------------------------------------------------------------------------- /vendor/github.com/bradhe/stopwatch/README.md: -------------------------------------------------------------------------------- 1 | # StopWatch 2 | 3 | A really, really simple package for timing bits of code. The intention is to 4 | provide a simple, light-weight library for benchmarking specific bits of your 5 | code when need be. 6 | 7 | ## Example 8 | 9 | Pretty straight forward. 10 | 11 | ```go 12 | package main 13 | 14 | import ( 15 | "github.com/bradhe/stopwatch" 16 | "fmt" 17 | ) 18 | 19 | func main() { 20 | start := stopwatch.Start() 21 | 22 | // Do some work. 23 | 24 | watch := stopwatch.Stop(start) 25 | fmt.Printf("Milliseconds elapsed: %v\n", watch.Milliseconds()) 26 | } 27 | ``` 28 | 29 | ## Contributing 30 | 31 | Really? You want to contribute? Well, okay. 32 | 33 | 1. Fork and fix/implement in a branch. 34 | 1. Make sure tests pass. 35 | 1. Make sure you've added new coverage. 36 | 1. Submit a PR. 37 | -------------------------------------------------------------------------------- /vendor/github.com/bradhe/stopwatch/main.go: -------------------------------------------------------------------------------- 1 | package stopwatch 2 | 3 | import ( 4 | "time" 5 | ) 6 | 7 | func Start() time.Time { 8 | return time.Now() 9 | } 10 | 11 | func Stop(start time.Time) *StopWatch { 12 | watch := StopWatch{start: start, stop: time.Now()} 13 | return &watch 14 | } 15 | -------------------------------------------------------------------------------- /vendor/github.com/bradhe/stopwatch/stop_watch.go: -------------------------------------------------------------------------------- 1 | package stopwatch 2 | 3 | import ( 4 | "time" 5 | ) 6 | 7 | type StopWatch struct { 8 | start, stop time.Time 9 | } 10 | 11 | func (self *StopWatch) Milliseconds() uint32 { 12 | return uint32(self.stop.Sub(self.start) / time.Millisecond) 13 | } 14 | -------------------------------------------------------------------------------- /vendor/github.com/dutchcoders/netstack/README.md: -------------------------------------------------------------------------------- 1 | # netstack 2 | Custom network stack in Go 3 | 4 | This networkstack implements (very) basic and rudimentary support for connecting tcp streams. There needs to be a lot to be implemented and optimised. 5 | 6 | # Configuration (for now) 7 | 8 | Linux will send RST packets for unknown tcp packets, so this needs to be disabled using iptables. 9 | 10 | ``` 11 | iptables -A OUTPUT -p tcp --tcp-flags RST RST -j DROP 12 | iptables -I OUTPUT -p icmp --icmp-type destination-unreachable -j DROP 13 | ``` 14 | 15 | # Samples 16 | 17 | See samples folder. 18 | 19 | # References 20 | 21 | * http://backreference.org/2010/03/26/tuntap-interface-tutorial/ 22 | * http://stackoverflow.com/questions/3062205/setting-the-source-ip-for-a-udp-socket 23 | * http://stackoverflow.com/questions/12177708/raw-socket-promiscuous-mode-not-sniffing-what-i-write 24 | * http://stackoverflow.com/questions/110341/tcp-handshake-with-sock-raw-socket 25 | * http://devdungeon.com/content/packet-capture-injection-and-analysis-gopacket 26 | * https://en.wikipedia.org/wiki/Transmission_Control_Protocol#/media/File:Tcp_state_diagram_fixed_new.svg 27 | * https://github.com/mindreframer/golang-stuff/blob/master/github.com/pebbe/zmq2/examples/udpping1.go 28 | * https://github.com/adamdunkels/uip/blob/master/uip/uip.c 29 | * http://www.darkcoding.net/uncategorized/raw-sockets-in-go-ip-layer/ 30 | * http://lxr.free-electrons.com/source/net/ipv4/tcp.c 31 | * https://www.freebsd.org/doc/en/books/developers-handbook/sockets-essential-functions.html 32 | * http://stackoverflow.com/questions/8047728/how-to-set-linux-kernel-not-to-send-rst-ack-so-that-i-can-give-syn-ack-within-r 33 | 34 | 35 | -------------------------------------------------------------------------------- /vendor/github.com/dutchcoders/netstack/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 | "encoding/binary" 9 | "errors" 10 | "net" 11 | "unsafe" 12 | ) 13 | 14 | var ( 15 | errMissingAddress = errors.New("missing address") 16 | errMissingHeader = errors.New("missing header") 17 | errHeaderTooShort = errors.New("header too short") 18 | errBufferTooShort = errors.New("buffer too short") 19 | errInvalidConnType = errors.New("invalid conn type") 20 | errOpNoSupport = errors.New("operation not supported") 21 | errNoSuchInterface = errors.New("no such interface") 22 | errNoSuchMulticastInterface = errors.New("no such multicast interface") 23 | 24 | // See http://www.freebsd.org/doc/en/books/porters-handbook/freebsd-versions.html. 25 | freebsdVersion uint32 26 | 27 | nativeEndian binary.ByteOrder 28 | ) 29 | 30 | func init() { 31 | i := uint32(1) 32 | b := (*[4]byte)(unsafe.Pointer(&i)) 33 | if b[0] == 1 { 34 | nativeEndian = binary.LittleEndian 35 | } else { 36 | nativeEndian = binary.BigEndian 37 | } 38 | } 39 | 40 | func boolint(b bool) int { 41 | if b { 42 | return 1 43 | } 44 | return 0 45 | } 46 | 47 | func netAddrToIP4(a net.Addr) net.IP { 48 | switch v := a.(type) { 49 | case *net.UDPAddr: 50 | if ip := v.IP.To4(); ip != nil { 51 | return ip 52 | } 53 | case *net.IPAddr: 54 | if ip := v.IP.To4(); ip != nil { 55 | return ip 56 | } 57 | } 58 | return nil 59 | } 60 | -------------------------------------------------------------------------------- /vendor/github.com/dutchcoders/netstack/netstack.go: -------------------------------------------------------------------------------- 1 | package netstack 2 | 3 | // +build amd64,linux 4 | 5 | import ( 6 | "fmt" 7 | "log" 8 | "math/rand" 9 | _ "net/http/pprof" 10 | "strconv" 11 | "strings" 12 | "time" 13 | ) 14 | 15 | func init() { 16 | rand.Seed(time.Now().UTC().UnixNano()) 17 | } 18 | 19 | const ( 20 | MaxEpollEvents = 64 21 | DefaultBufferSize = 65535 22 | ) 23 | 24 | type SocketState int 25 | 26 | const ( 27 | SocketClosed SocketState = iota 28 | SocketListen 29 | SocketSynReceived 30 | SocketSynSent 31 | SocketEstablished 32 | SocketFinWait1 33 | SocketFinWait2 34 | SocketClosing 35 | SocketTimeWait 36 | SocketCloseWait 37 | SocketLastAck 38 | ) 39 | 40 | func (ss SocketState) String() string { 41 | switch ss { 42 | case SocketClosed: 43 | return "SocketClosed" 44 | case SocketListen: 45 | return "SocketListen" 46 | case SocketSynReceived: 47 | return "SocketSynReceived" 48 | case SocketSynSent: 49 | return "SocketSynSent" 50 | case SocketEstablished: 51 | return "SocketEstablished" 52 | case SocketFinWait1: 53 | return "SocketFinWait1" 54 | case SocketFinWait2: 55 | return "SocketFinWait2" 56 | case SocketClosing: 57 | return "SocketClosing" 58 | case SocketTimeWait: 59 | return "SocketTimeWait" 60 | case SocketCloseWait: 61 | return "SocketCloseWait" 62 | case SocketLastAck: 63 | return "SocketLastAck" 64 | default: 65 | return fmt.Sprintf("Unknown state: %d", int(ss)) 66 | } 67 | } 68 | 69 | func to4byte(addr string) [4]byte { 70 | parts := strings.Split(addr, ".") 71 | b0, err := strconv.Atoi(parts[0]) 72 | fmt.Println(addr) 73 | if err != nil { 74 | log.Fatalf("to4byte: %s (latency works with IPv4 addresses only, but not IPv6!)\n", err) 75 | } 76 | b1, _ := strconv.Atoi(parts[1]) 77 | b2, _ := strconv.Atoi(parts[2]) 78 | b3, _ := strconv.Atoi(parts[3]) 79 | return [4]byte{byte(b0), byte(b1), byte(b2), byte(b3)} 80 | } 81 | 82 | type socket struct { 83 | } 84 | 85 | type listener struct { 86 | s chan bool 87 | } 88 | 89 | func (l *listener) Accept() (socket, error) { 90 | <-l.s 91 | 92 | // wait for packets to arrive. Return a socket 93 | return socket{}, nil 94 | } 95 | -------------------------------------------------------------------------------- /vendor/github.com/dutchcoders/netstack/state.go: -------------------------------------------------------------------------------- 1 | package netstack 2 | 3 | import ( 4 | "net" 5 | "sync" 6 | "time" 7 | ) 8 | 9 | type State struct { 10 | sync.Mutex 11 | 12 | SrcIP net.IP 13 | SrcPort uint16 14 | DestIP net.IP 15 | DestPort uint16 16 | 17 | Last time.Time 18 | 19 | RecvNext uint32 20 | SendNext uint32 21 | SendUnAcknowledged uint32 22 | LastAcked uint32 23 | 24 | SocketState SocketState 25 | 26 | ID int 27 | 28 | Conn *Connection 29 | } 30 | -------------------------------------------------------------------------------- /vendor/github.com/dutchcoders/netstack/statetable.go: -------------------------------------------------------------------------------- 1 | package netstack 2 | 3 | // +build amd64,linux 4 | 5 | import ( 6 | "net" 7 | _ "net/http/pprof" 8 | ) 9 | 10 | func (st *StateTable) Add(state *State) { 11 | *st = append(*st, state) 12 | } 13 | 14 | // GetState will return the state for the ip, port combination 15 | func (st *StateTable) Get(SrcIP, DestIP net.IP, SrcPort, DestPort uint16) *State { 16 | for _, state := range *st { 17 | if state.SrcPort != SrcPort && state.DestPort != SrcPort { 18 | continue 19 | } 20 | 21 | if state.DestPort != DestPort && state.SrcPort != DestPort { 22 | continue 23 | } 24 | 25 | // comparing ipv6 with ipv4 now 26 | if !state.SrcIP.Equal(SrcIP) && !state.DestIP.Equal(SrcIP) { 27 | continue 28 | } 29 | 30 | if !state.DestIP.Equal(DestIP) && !state.SrcIP.Equal(DestIP) { 31 | continue 32 | } 33 | 34 | return state 35 | } 36 | /* 37 | 38 | state := &State{ 39 | SrcIP: SrcIP, 40 | DestIP: DestIP, 41 | 42 | SrcPort: SrcPort, 43 | DestPort: DestPort, 44 | 45 | SocketState: SocketClosed, 46 | } 47 | 48 | st.Add(state) 49 | return state 50 | */ 51 | return nil 52 | } 53 | 54 | type StateTable []*State 55 | 56 | var stateTable StateTable 57 | -------------------------------------------------------------------------------- /vendor/github.com/fatih/color/LICENSE.md: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2013 Fatih Arslan 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | this software and associated documentation files (the "Software"), to deal in 7 | the Software without restriction, including without limitation the rights to 8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | the Software, and to permit persons to whom the Software is furnished to do so, 10 | subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /vendor/github.com/mattn/go-colorable/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 Yasuhiro Matsumoto 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /vendor/github.com/mattn/go-colorable/README.md: -------------------------------------------------------------------------------- 1 | # go-colorable 2 | 3 | Colorable writer for windows. 4 | 5 | For example, most of logger packages doesn't show colors on windows. (I know we can do it with ansicon. But I don't want.) 6 | This package is possible to handle escape sequence for ansi color on windows. 7 | 8 | ## Too Bad! 9 | 10 | ![](https://raw.githubusercontent.com/mattn/go-colorable/gh-pages/bad.png) 11 | 12 | 13 | ## So Good! 14 | 15 | ![](https://raw.githubusercontent.com/mattn/go-colorable/gh-pages/good.png) 16 | 17 | ## Usage 18 | 19 | ```go 20 | logrus.SetFormatter(&logrus.TextFormatter{ForceColors: true}) 21 | logrus.SetOutput(colorable.NewColorableStdout()) 22 | 23 | logrus.Info("succeeded") 24 | logrus.Warn("not correct") 25 | logrus.Error("something error") 26 | logrus.Fatal("panic") 27 | ``` 28 | 29 | You can compile above code on non-windows OSs. 30 | 31 | ## Installation 32 | 33 | ``` 34 | $ go get github.com/mattn/go-colorable 35 | ``` 36 | 37 | # License 38 | 39 | MIT 40 | 41 | # Author 42 | 43 | Yasuhiro Matsumoto (a.k.a mattn) 44 | -------------------------------------------------------------------------------- /vendor/github.com/mattn/go-colorable/colorable_others.go: -------------------------------------------------------------------------------- 1 | // +build !windows 2 | 3 | package colorable 4 | 5 | import ( 6 | "io" 7 | "os" 8 | ) 9 | 10 | func NewColorable(file *os.File) io.Writer { 11 | if file == nil { 12 | panic("nil passed instead of *os.File to NewColorable()") 13 | } 14 | 15 | return file 16 | } 17 | 18 | func NewColorableStdout() io.Writer { 19 | return os.Stdout 20 | } 21 | 22 | func NewColorableStderr() io.Writer { 23 | return os.Stderr 24 | } 25 | -------------------------------------------------------------------------------- /vendor/github.com/mattn/go-colorable/noncolorable.go: -------------------------------------------------------------------------------- 1 | package colorable 2 | 3 | import ( 4 | "bytes" 5 | "io" 6 | ) 7 | 8 | type NonColorable struct { 9 | out io.Writer 10 | lastbuf bytes.Buffer 11 | } 12 | 13 | func NewNonColorable(w io.Writer) io.Writer { 14 | return &NonColorable{out: w} 15 | } 16 | 17 | func (w *NonColorable) Write(data []byte) (n int, err error) { 18 | er := bytes.NewReader(data) 19 | var bw [1]byte 20 | loop: 21 | for { 22 | c1, err := er.ReadByte() 23 | if err != nil { 24 | break loop 25 | } 26 | if c1 != 0x1b { 27 | bw[0] = c1 28 | w.out.Write(bw[:]) 29 | continue 30 | } 31 | c2, err := er.ReadByte() 32 | if err != nil { 33 | w.lastbuf.WriteByte(c1) 34 | break loop 35 | } 36 | if c2 != 0x5b { 37 | w.lastbuf.WriteByte(c1) 38 | w.lastbuf.WriteByte(c2) 39 | continue 40 | } 41 | 42 | var buf bytes.Buffer 43 | for { 44 | c, err := er.ReadByte() 45 | if err != nil { 46 | w.lastbuf.WriteByte(c1) 47 | w.lastbuf.WriteByte(c2) 48 | w.lastbuf.Write(buf.Bytes()) 49 | break loop 50 | } 51 | if ('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z') || c == '@' { 52 | break 53 | } 54 | buf.Write([]byte(string(c))) 55 | } 56 | } 57 | return len(data) - w.lastbuf.Len(), nil 58 | } 59 | -------------------------------------------------------------------------------- /vendor/github.com/mattn/go-isatty/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) Yasuhiro MATSUMOTO 2 | 3 | MIT License (Expat) 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 6 | 7 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 10 | -------------------------------------------------------------------------------- /vendor/github.com/mattn/go-isatty/README.md: -------------------------------------------------------------------------------- 1 | # go-isatty 2 | 3 | isatty for golang 4 | 5 | ## Usage 6 | 7 | ```go 8 | package main 9 | 10 | import ( 11 | "fmt" 12 | "github.com/mattn/go-isatty" 13 | "os" 14 | ) 15 | 16 | func main() { 17 | if isatty.IsTerminal(os.Stdout.Fd()) { 18 | fmt.Println("Is Terminal") 19 | } else { 20 | fmt.Println("Is Not Terminal") 21 | } 22 | } 23 | ``` 24 | 25 | ## Installation 26 | 27 | ``` 28 | $ go get github.com/mattn/go-isatty 29 | ``` 30 | 31 | # License 32 | 33 | MIT 34 | 35 | # Author 36 | 37 | Yasuhiro Matsumoto (a.k.a mattn) 38 | -------------------------------------------------------------------------------- /vendor/github.com/mattn/go-isatty/doc.go: -------------------------------------------------------------------------------- 1 | // Package isatty implements interface to isatty 2 | package isatty 3 | -------------------------------------------------------------------------------- /vendor/github.com/mattn/go-isatty/isatty_appengine.go: -------------------------------------------------------------------------------- 1 | // +build appengine 2 | 3 | package isatty 4 | 5 | // IsTerminal returns true if the file descriptor is terminal which 6 | // is always false on on appengine classic which is a sandboxed PaaS. 7 | func IsTerminal(fd uintptr) bool { 8 | return false 9 | } 10 | -------------------------------------------------------------------------------- /vendor/github.com/mattn/go-isatty/isatty_bsd.go: -------------------------------------------------------------------------------- 1 | // +build darwin freebsd openbsd netbsd dragonfly 2 | // +build !appengine 3 | 4 | package isatty 5 | 6 | import ( 7 | "syscall" 8 | "unsafe" 9 | ) 10 | 11 | const ioctlReadTermios = syscall.TIOCGETA 12 | 13 | // IsTerminal return true if the file descriptor is terminal. 14 | func IsTerminal(fd uintptr) bool { 15 | var termios syscall.Termios 16 | _, _, err := syscall.Syscall6(syscall.SYS_IOCTL, fd, ioctlReadTermios, uintptr(unsafe.Pointer(&termios)), 0, 0, 0) 17 | return err == 0 18 | } 19 | -------------------------------------------------------------------------------- /vendor/github.com/mattn/go-isatty/isatty_linux.go: -------------------------------------------------------------------------------- 1 | // +build linux 2 | // +build !appengine 3 | 4 | package isatty 5 | 6 | import ( 7 | "syscall" 8 | "unsafe" 9 | ) 10 | 11 | const ioctlReadTermios = syscall.TCGETS 12 | 13 | // IsTerminal return true if the file descriptor is terminal. 14 | func IsTerminal(fd uintptr) bool { 15 | var termios syscall.Termios 16 | _, _, err := syscall.Syscall6(syscall.SYS_IOCTL, fd, ioctlReadTermios, uintptr(unsafe.Pointer(&termios)), 0, 0, 0) 17 | return err == 0 18 | } 19 | -------------------------------------------------------------------------------- /vendor/github.com/mattn/go-isatty/isatty_solaris.go: -------------------------------------------------------------------------------- 1 | // +build solaris 2 | // +build !appengine 3 | 4 | package isatty 5 | 6 | import ( 7 | "golang.org/x/sys/unix" 8 | ) 9 | 10 | // IsTerminal returns true if the given file descriptor is a terminal. 11 | // see: http://src.illumos.org/source/xref/illumos-gate/usr/src/lib/libbc/libc/gen/common/isatty.c 12 | func IsTerminal(fd uintptr) bool { 13 | var termio unix.Termio 14 | err := unix.IoctlSetTermio(int(fd), unix.TCGETA, &termio) 15 | return err == nil 16 | } 17 | -------------------------------------------------------------------------------- /vendor/github.com/mattn/go-isatty/isatty_windows.go: -------------------------------------------------------------------------------- 1 | // +build windows 2 | // +build !appengine 3 | 4 | package isatty 5 | 6 | import ( 7 | "syscall" 8 | "unsafe" 9 | ) 10 | 11 | var kernel32 = syscall.NewLazyDLL("kernel32.dll") 12 | var procGetConsoleMode = kernel32.NewProc("GetConsoleMode") 13 | 14 | // IsTerminal return true if the file descriptor is terminal. 15 | func IsTerminal(fd uintptr) bool { 16 | var st uint32 17 | r, _, e := syscall.Syscall(procGetConsoleMode.Addr(), 2, fd, uintptr(unsafe.Pointer(&st)), 0) 18 | return r != 0 && e == 0 19 | } 20 | -------------------------------------------------------------------------------- /vendor/github.com/miekg/dns/AUTHORS: -------------------------------------------------------------------------------- 1 | Miek Gieben 2 | -------------------------------------------------------------------------------- /vendor/github.com/miekg/dns/CONTRIBUTORS: -------------------------------------------------------------------------------- 1 | Alex A. Skinner 2 | Andrew Tunnell-Jones 3 | Ask Bjørn Hansen 4 | Dave Cheney 5 | Dusty Wilson 6 | Marek Majkowski 7 | Peter van Dijk 8 | Omri Bahumi 9 | Alex Sergeyev 10 | -------------------------------------------------------------------------------- /vendor/github.com/miekg/dns/COPYRIGHT: -------------------------------------------------------------------------------- 1 | Copyright 2009 The Go Authors. All rights reserved. Use of this source code 2 | is governed by a BSD-style license that can be found in the LICENSE file. 3 | Extensions of the original work are copyright (c) 2011 Miek Gieben 4 | 5 | Copyright 2011 Miek Gieben. All rights reserved. Use of this source code is 6 | governed by a BSD-style license that can be found in the LICENSE file. 7 | 8 | Copyright 2014 CloudFlare. All rights reserved. Use of this source code is 9 | governed by a BSD-style license that can be found in the LICENSE file. 10 | -------------------------------------------------------------------------------- /vendor/github.com/miekg/dns/LICENSE: -------------------------------------------------------------------------------- 1 | Extensions of the original work are copyright (c) 2011 Miek Gieben 2 | 3 | As this is fork of the official Go code the same license applies: 4 | 5 | Copyright (c) 2009 The Go Authors. All rights reserved. 6 | 7 | Redistribution and use in source and binary forms, with or without 8 | modification, are permitted provided that the following conditions are 9 | met: 10 | 11 | * Redistributions of source code must retain the above copyright 12 | notice, this list of conditions and the following disclaimer. 13 | * Redistributions in binary form must reproduce the above 14 | copyright notice, this list of conditions and the following disclaimer 15 | in the documentation and/or other materials provided with the 16 | distribution. 17 | * Neither the name of Google Inc. nor the names of its 18 | contributors may be used to endorse or promote products derived from 19 | this software without specific prior written permission. 20 | 21 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 23 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 24 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 25 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 26 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 27 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 28 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 29 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 31 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 | 33 | -------------------------------------------------------------------------------- /vendor/github.com/miekg/dns/rawmsg.go: -------------------------------------------------------------------------------- 1 | package dns 2 | 3 | import "encoding/binary" 4 | 5 | // rawSetRdlength sets the rdlength in the header of 6 | // the RR. The offset 'off' must be positioned at the 7 | // start of the header of the RR, 'end' must be the 8 | // end of the RR. 9 | func rawSetRdlength(msg []byte, off, end int) bool { 10 | l := len(msg) 11 | Loop: 12 | for { 13 | if off+1 > l { 14 | return false 15 | } 16 | c := int(msg[off]) 17 | off++ 18 | switch c & 0xC0 { 19 | case 0x00: 20 | if c == 0x00 { 21 | // End of the domainname 22 | break Loop 23 | } 24 | if off+c > l { 25 | return false 26 | } 27 | off += c 28 | 29 | case 0xC0: 30 | // pointer, next byte included, ends domainname 31 | off++ 32 | break Loop 33 | } 34 | } 35 | // The domainname has been seen, we at the start of the fixed part in the header. 36 | // Type is 2 bytes, class is 2 bytes, ttl 4 and then 2 bytes for the length. 37 | off += 2 + 2 + 4 38 | if off+2 > l { 39 | return false 40 | } 41 | //off+1 is the end of the header, 'end' is the end of the rr 42 | //so 'end' - 'off+2' is the length of the rdata 43 | rdatalen := end - (off + 2) 44 | if rdatalen > 0xFFFF { 45 | return false 46 | } 47 | binary.BigEndian.PutUint16(msg[off:], uint16(rdatalen)) 48 | return true 49 | } 50 | -------------------------------------------------------------------------------- /vendor/github.com/miekg/dns/reverse.go: -------------------------------------------------------------------------------- 1 | package dns 2 | 3 | // StringToType is the reverse of TypeToString, needed for string parsing. 4 | var StringToType = reverseInt16(TypeToString) 5 | 6 | // StringToClass is the reverse of ClassToString, needed for string parsing. 7 | var StringToClass = reverseInt16(ClassToString) 8 | 9 | // Map of opcodes strings. 10 | var StringToOpcode = reverseInt(OpcodeToString) 11 | 12 | // Map of rcodes strings. 13 | var StringToRcode = reverseInt(RcodeToString) 14 | 15 | // Reverse a map 16 | func reverseInt8(m map[uint8]string) map[string]uint8 { 17 | n := make(map[string]uint8, len(m)) 18 | for u, s := range m { 19 | n[s] = u 20 | } 21 | return n 22 | } 23 | 24 | func reverseInt16(m map[uint16]string) map[string]uint16 { 25 | n := make(map[string]uint16, len(m)) 26 | for u, s := range m { 27 | n[s] = u 28 | } 29 | return n 30 | } 31 | 32 | func reverseInt(m map[int]string) map[string]int { 33 | n := make(map[string]int, len(m)) 34 | for u, s := range m { 35 | n[s] = u 36 | } 37 | return n 38 | } 39 | -------------------------------------------------------------------------------- /vendor/github.com/miekg/dns/sanitize.go: -------------------------------------------------------------------------------- 1 | package dns 2 | 3 | // Dedup removes identical RRs from rrs. It preserves the original ordering. 4 | // The lowest TTL of any duplicates is used in the remaining one. Dedup modifies 5 | // rrs. 6 | // m is used to store the RRs temporay. If it is nil a new map will be allocated. 7 | func Dedup(rrs []RR, m map[string]RR) []RR { 8 | if m == nil { 9 | m = make(map[string]RR) 10 | } 11 | // Save the keys, so we don't have to call normalizedString twice. 12 | keys := make([]*string, 0, len(rrs)) 13 | 14 | for _, r := range rrs { 15 | key := normalizedString(r) 16 | keys = append(keys, &key) 17 | if _, ok := m[key]; ok { 18 | // Shortest TTL wins. 19 | if m[key].Header().Ttl > r.Header().Ttl { 20 | m[key].Header().Ttl = r.Header().Ttl 21 | } 22 | continue 23 | } 24 | 25 | m[key] = r 26 | } 27 | // If the length of the result map equals the amount of RRs we got, 28 | // it means they were all different. We can then just return the original rrset. 29 | if len(m) == len(rrs) { 30 | return rrs 31 | } 32 | 33 | j := 0 34 | for i, r := range rrs { 35 | // If keys[i] lives in the map, we should copy and remove it. 36 | if _, ok := m[*keys[i]]; ok { 37 | delete(m, *keys[i]) 38 | rrs[j] = r 39 | j++ 40 | } 41 | 42 | if len(m) == 0 { 43 | break 44 | } 45 | } 46 | 47 | return rrs[:j] 48 | } 49 | 50 | // normalizedString returns a normalized string from r. The TTL 51 | // is removed and the domain name is lowercased. We go from this: 52 | // DomainNameTTLCLASSTYPERDATA to: 53 | // lowercasenameCLASSTYPE... 54 | func normalizedString(r RR) string { 55 | // A string Go DNS makes has: domainnameTTL... 56 | b := []byte(r.String()) 57 | 58 | // find the first non-escaped tab, then another, so we capture where the TTL lives. 59 | esc := false 60 | ttlStart, ttlEnd := 0, 0 61 | for i := 0; i < len(b) && ttlEnd == 0; i++ { 62 | switch { 63 | case b[i] == '\\': 64 | esc = !esc 65 | case b[i] == '\t' && !esc: 66 | if ttlStart == 0 { 67 | ttlStart = i 68 | continue 69 | } 70 | if ttlEnd == 0 { 71 | ttlEnd = i 72 | } 73 | case b[i] >= 'A' && b[i] <= 'Z' && !esc: 74 | b[i] += 32 75 | default: 76 | esc = false 77 | } 78 | } 79 | 80 | // remove TTL. 81 | copy(b[ttlStart:], b[ttlEnd:]) 82 | cut := ttlEnd - ttlStart 83 | return string(b[:len(b)-cut]) 84 | } 85 | -------------------------------------------------------------------------------- /vendor/github.com/miekg/dns/scanner.go: -------------------------------------------------------------------------------- 1 | package dns 2 | 3 | // Implement a simple scanner, return a byte stream from an io reader. 4 | 5 | import ( 6 | "bufio" 7 | "io" 8 | "text/scanner" 9 | ) 10 | 11 | type scan struct { 12 | src *bufio.Reader 13 | position scanner.Position 14 | eof bool // Have we just seen a eof 15 | } 16 | 17 | func scanInit(r io.Reader) *scan { 18 | s := new(scan) 19 | s.src = bufio.NewReader(r) 20 | s.position.Line = 1 21 | return s 22 | } 23 | 24 | // tokenText returns the next byte from the input 25 | func (s *scan) tokenText() (byte, error) { 26 | c, err := s.src.ReadByte() 27 | if err != nil { 28 | return c, err 29 | } 30 | // delay the newline handling until the next token is delivered, 31 | // fixes off-by-one errors when reporting a parse error. 32 | if s.eof == true { 33 | s.position.Line++ 34 | s.position.Column = 0 35 | s.eof = false 36 | } 37 | if c == '\n' { 38 | s.eof = true 39 | return c, nil 40 | } 41 | s.position.Column++ 42 | return c, nil 43 | } 44 | -------------------------------------------------------------------------------- /vendor/github.com/miekg/dns/singleinflight.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 | // Adapted for dns package usage by Miek Gieben. 6 | 7 | package dns 8 | 9 | import "sync" 10 | import "time" 11 | 12 | // call is an in-flight or completed singleflight.Do call 13 | type call struct { 14 | wg sync.WaitGroup 15 | val *Msg 16 | rtt time.Duration 17 | err error 18 | dups int 19 | } 20 | 21 | // singleflight represents a class of work and forms a namespace in 22 | // which units of work can be executed with duplicate suppression. 23 | type singleflight struct { 24 | sync.Mutex // protects m 25 | m map[string]*call // lazily initialized 26 | } 27 | 28 | // Do executes and returns the results of the given function, making 29 | // sure that only one execution is in-flight for a given key at a 30 | // time. If a duplicate comes in, the duplicate caller waits for the 31 | // original to complete and receives the same results. 32 | // The return value shared indicates whether v was given to multiple callers. 33 | func (g *singleflight) Do(key string, fn func() (*Msg, time.Duration, error)) (v *Msg, rtt time.Duration, err error, shared bool) { 34 | g.Lock() 35 | if g.m == nil { 36 | g.m = make(map[string]*call) 37 | } 38 | if c, ok := g.m[key]; ok { 39 | c.dups++ 40 | g.Unlock() 41 | c.wg.Wait() 42 | return c.val, c.rtt, c.err, true 43 | } 44 | c := new(call) 45 | c.wg.Add(1) 46 | g.m[key] = c 47 | g.Unlock() 48 | 49 | c.val, c.rtt, c.err = fn() 50 | c.wg.Done() 51 | 52 | g.Lock() 53 | delete(g.m, key) 54 | g.Unlock() 55 | 56 | return c.val, c.rtt, c.err, c.dups > 0 57 | } 58 | -------------------------------------------------------------------------------- /vendor/github.com/miekg/dns/tlsa.go: -------------------------------------------------------------------------------- 1 | package dns 2 | 3 | import ( 4 | "crypto/sha256" 5 | "crypto/sha512" 6 | "crypto/x509" 7 | "encoding/hex" 8 | "errors" 9 | "io" 10 | "net" 11 | "strconv" 12 | ) 13 | 14 | // CertificateToDANE converts a certificate to a hex string as used in the TLSA record. 15 | func CertificateToDANE(selector, matchingType uint8, cert *x509.Certificate) (string, error) { 16 | switch matchingType { 17 | case 0: 18 | switch selector { 19 | case 0: 20 | return hex.EncodeToString(cert.Raw), nil 21 | case 1: 22 | return hex.EncodeToString(cert.RawSubjectPublicKeyInfo), nil 23 | } 24 | case 1: 25 | h := sha256.New() 26 | switch selector { 27 | case 0: 28 | io.WriteString(h, string(cert.Raw)) 29 | return hex.EncodeToString(h.Sum(nil)), nil 30 | case 1: 31 | io.WriteString(h, string(cert.RawSubjectPublicKeyInfo)) 32 | return hex.EncodeToString(h.Sum(nil)), nil 33 | } 34 | case 2: 35 | h := sha512.New() 36 | switch selector { 37 | case 0: 38 | io.WriteString(h, string(cert.Raw)) 39 | return hex.EncodeToString(h.Sum(nil)), nil 40 | case 1: 41 | io.WriteString(h, string(cert.RawSubjectPublicKeyInfo)) 42 | return hex.EncodeToString(h.Sum(nil)), nil 43 | } 44 | } 45 | return "", errors.New("dns: bad TLSA MatchingType or TLSA Selector") 46 | } 47 | 48 | // Sign creates a TLSA record from an SSL certificate. 49 | func (r *TLSA) Sign(usage, selector, matchingType int, cert *x509.Certificate) (err error) { 50 | r.Hdr.Rrtype = TypeTLSA 51 | r.Usage = uint8(usage) 52 | r.Selector = uint8(selector) 53 | r.MatchingType = uint8(matchingType) 54 | 55 | r.Certificate, err = CertificateToDANE(r.Selector, r.MatchingType, cert) 56 | if err != nil { 57 | return err 58 | } 59 | return nil 60 | } 61 | 62 | // Verify verifies a TLSA record against an SSL certificate. If it is OK 63 | // a nil error is returned. 64 | func (r *TLSA) Verify(cert *x509.Certificate) error { 65 | c, err := CertificateToDANE(r.Selector, r.MatchingType, cert) 66 | if err != nil { 67 | return err // Not also ErrSig? 68 | } 69 | if r.Certificate == c { 70 | return nil 71 | } 72 | return ErrSig // ErrSig, really? 73 | } 74 | 75 | // TLSAName returns the ownername of a TLSA resource record as per the 76 | // rules specified in RFC 6698, Section 3. 77 | func TLSAName(name, service, network string) (string, error) { 78 | if !IsFqdn(name) { 79 | return "", ErrFqdn 80 | } 81 | p, err := net.LookupPort(network, service) 82 | if err != nil { 83 | return "", err 84 | } 85 | return "_" + strconv.Itoa(p) + "._" + network + "." + name, nil 86 | } 87 | -------------------------------------------------------------------------------- /vendor/github.com/miekg/dns/udp.go: -------------------------------------------------------------------------------- 1 | // +build !windows,!plan9 2 | 3 | package dns 4 | 5 | import ( 6 | "net" 7 | "syscall" 8 | ) 9 | 10 | // SessionUDP holds the remote address and the associated 11 | // out-of-band data. 12 | type SessionUDP struct { 13 | raddr *net.UDPAddr 14 | context []byte 15 | } 16 | 17 | // RemoteAddr returns the remote network address. 18 | func (s *SessionUDP) RemoteAddr() net.Addr { return s.raddr } 19 | 20 | // setUDPSocketOptions sets the UDP socket options. 21 | // This function is implemented on a per platform basis. See udp_*.go for more details 22 | func setUDPSocketOptions(conn *net.UDPConn) error { 23 | sa, err := getUDPSocketName(conn) 24 | if err != nil { 25 | return err 26 | } 27 | switch sa.(type) { 28 | case *syscall.SockaddrInet6: 29 | v6only, err := getUDPSocketOptions6Only(conn) 30 | if err != nil { 31 | return err 32 | } 33 | setUDPSocketOptions6(conn) 34 | if !v6only { 35 | setUDPSocketOptions4(conn) 36 | } 37 | case *syscall.SockaddrInet4: 38 | setUDPSocketOptions4(conn) 39 | } 40 | return nil 41 | } 42 | 43 | // ReadFromSessionUDP acts just like net.UDPConn.ReadFrom(), but returns a session object instead of a 44 | // net.UDPAddr. 45 | func ReadFromSessionUDP(conn *net.UDPConn, b []byte) (int, *SessionUDP, error) { 46 | oob := make([]byte, 40) 47 | n, oobn, _, raddr, err := conn.ReadMsgUDP(b, oob) 48 | if err != nil { 49 | return n, nil, err 50 | } 51 | return n, &SessionUDP{raddr, oob[:oobn]}, err 52 | } 53 | 54 | // WriteToSessionUDP acts just like net.UDPConn.WritetTo(), but uses a *SessionUDP instead of a net.Addr. 55 | func WriteToSessionUDP(conn *net.UDPConn, b []byte, session *SessionUDP) (int, error) { 56 | n, _, err := conn.WriteMsgUDP(b, session.context, session.raddr) 57 | return n, err 58 | } 59 | -------------------------------------------------------------------------------- /vendor/github.com/miekg/dns/udp_linux.go: -------------------------------------------------------------------------------- 1 | // +build linux 2 | 3 | package dns 4 | 5 | // See: 6 | // * http://stackoverflow.com/questions/3062205/setting-the-source-ip-for-a-udp-socket and 7 | // * http://blog.powerdns.com/2012/10/08/on-binding-datagram-udp-sockets-to-the-any-addresses/ 8 | // 9 | // Why do we need this: When listening on 0.0.0.0 with UDP so kernel decides what is the outgoing 10 | // interface, this might not always be the correct one. This code will make sure the egress 11 | // packet's interface matched the ingress' one. 12 | 13 | import ( 14 | "net" 15 | "syscall" 16 | ) 17 | 18 | // setUDPSocketOptions4 prepares the v4 socket for sessions. 19 | func setUDPSocketOptions4(conn *net.UDPConn) error { 20 | file, err := conn.File() 21 | if err != nil { 22 | return err 23 | } 24 | if err := syscall.SetsockoptInt(int(file.Fd()), syscall.IPPROTO_IP, syscall.IP_PKTINFO, 1); err != nil { 25 | return err 26 | } 27 | // Calling File() above results in the connection becoming blocking, we must fix that. 28 | // See https://github.com/miekg/dns/issues/279 29 | err = syscall.SetNonblock(int(file.Fd()), true) 30 | if err != nil { 31 | return err 32 | } 33 | return nil 34 | } 35 | 36 | // setUDPSocketOptions6 prepares the v6 socket for sessions. 37 | func setUDPSocketOptions6(conn *net.UDPConn) error { 38 | file, err := conn.File() 39 | if err != nil { 40 | return err 41 | } 42 | if err := syscall.SetsockoptInt(int(file.Fd()), syscall.IPPROTO_IPV6, syscall.IPV6_RECVPKTINFO, 1); err != nil { 43 | return err 44 | } 45 | err = syscall.SetNonblock(int(file.Fd()), true) 46 | if err != nil { 47 | return err 48 | } 49 | return nil 50 | } 51 | 52 | // getUDPSocketOption6Only return true if the socket is v6 only and false when it is v4/v6 combined 53 | // (dualstack). 54 | func getUDPSocketOptions6Only(conn *net.UDPConn) (bool, error) { 55 | file, err := conn.File() 56 | if err != nil { 57 | return false, err 58 | } 59 | // dual stack. See http://stackoverflow.com/questions/1618240/how-to-support-both-ipv4-and-ipv6-connections 60 | v6only, err := syscall.GetsockoptInt(int(file.Fd()), syscall.IPPROTO_IPV6, syscall.IPV6_V6ONLY) 61 | if err != nil { 62 | return false, err 63 | } 64 | return v6only == 1, nil 65 | } 66 | 67 | func getUDPSocketName(conn *net.UDPConn) (syscall.Sockaddr, error) { 68 | file, err := conn.File() 69 | if err != nil { 70 | return nil, err 71 | } 72 | return syscall.Getsockname(int(file.Fd())) 73 | } 74 | -------------------------------------------------------------------------------- /vendor/github.com/miekg/dns/udp_other.go: -------------------------------------------------------------------------------- 1 | // +build !linux,!plan9 2 | 3 | package dns 4 | 5 | import ( 6 | "net" 7 | "syscall" 8 | ) 9 | 10 | // These do nothing. See udp_linux.go for an example of how to implement this. 11 | 12 | // We tried to adhire to some kind of naming scheme. 13 | 14 | func setUDPSocketOptions4(conn *net.UDPConn) error { return nil } 15 | func setUDPSocketOptions6(conn *net.UDPConn) error { return nil } 16 | func getUDPSocketOptions6Only(conn *net.UDPConn) (bool, error) { return false, nil } 17 | func getUDPSocketName(conn *net.UDPConn) (syscall.Sockaddr, error) { return nil, nil } 18 | -------------------------------------------------------------------------------- /vendor/github.com/miekg/dns/udp_plan9.go: -------------------------------------------------------------------------------- 1 | package dns 2 | 3 | import ( 4 | "net" 5 | ) 6 | 7 | func setUDPSocketOptions(conn *net.UDPConn) error { return nil } 8 | 9 | // SessionUDP holds the remote address and the associated 10 | // out-of-band data. 11 | type SessionUDP struct { 12 | raddr *net.UDPAddr 13 | context []byte 14 | } 15 | 16 | // RemoteAddr returns the remote network address. 17 | func (s *SessionUDP) RemoteAddr() net.Addr { return s.raddr } 18 | 19 | // ReadFromSessionUDP acts just like net.UDPConn.ReadFrom(), but returns a session object instead of a 20 | // net.UDPAddr. 21 | func ReadFromSessionUDP(conn *net.UDPConn, b []byte) (int, *SessionUDP, error) { 22 | oob := make([]byte, 40) 23 | n, oobn, _, raddr, err := conn.ReadMsgUDP(b, oob) 24 | if err != nil { 25 | return n, nil, err 26 | } 27 | return n, &SessionUDP{raddr, oob[:oobn]}, err 28 | } 29 | 30 | // WriteToSessionUDP acts just like net.UDPConn.WritetTo(), but uses a *SessionUDP instead of a net.Addr. 31 | func WriteToSessionUDP(conn *net.UDPConn, b []byte, session *SessionUDP) (int, error) { 32 | n, _, err := conn.WriteMsgUDP(b, session.context, session.raddr) 33 | return n, err 34 | } 35 | -------------------------------------------------------------------------------- /vendor/github.com/miekg/dns/udp_windows.go: -------------------------------------------------------------------------------- 1 | // +build windows 2 | 3 | package dns 4 | 5 | import "net" 6 | 7 | type SessionUDP struct { 8 | raddr *net.UDPAddr 9 | } 10 | 11 | // ReadFromSessionUDP acts just like net.UDPConn.ReadFrom(), but returns a session object instead of a 12 | // net.UDPAddr. 13 | func ReadFromSessionUDP(conn *net.UDPConn, b []byte) (int, *SessionUDP, error) { 14 | n, raddr, err := conn.ReadFrom(b) 15 | if err != nil { 16 | return n, nil, err 17 | } 18 | session := &SessionUDP{raddr.(*net.UDPAddr)} 19 | return n, session, err 20 | } 21 | 22 | // WriteToSessionUDP acts just like net.UDPConn.WritetTo(), but uses a *SessionUDP instead of a net.Addr. 23 | func WriteToSessionUDP(conn *net.UDPConn, b []byte, session *SessionUDP) (int, error) { 24 | n, err := conn.WriteTo(b, session.raddr) 25 | return n, err 26 | } 27 | 28 | func (s *SessionUDP) RemoteAddr() net.Addr { return s.raddr } 29 | 30 | // setUDPSocketOptions sets the UDP socket options. 31 | // This function is implemented on a per platform basis. See udp_*.go for more details 32 | func setUDPSocketOptions(conn *net.UDPConn) error { 33 | return nil 34 | } 35 | -------------------------------------------------------------------------------- /vendor/github.com/minio/cli/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (C) 2013 Jeremy Saenz 2 | All Rights Reserved. 3 | 4 | MIT LICENSE 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy of 7 | this software and associated documentation files (the "Software"), to deal in 8 | the Software without restriction, including without limitation the rights to 9 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 10 | the Software, and to permit persons to whom the Software is furnished to do so, 11 | subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in all 14 | copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 18 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 19 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 20 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /vendor/github.com/minio/cli/bool.go: -------------------------------------------------------------------------------- 1 | package cli 2 | 3 | import ( 4 | "flag" 5 | "fmt" 6 | "os" 7 | "strconv" 8 | "strings" 9 | ) 10 | 11 | // BoolFlag - a flag of bool type 12 | type BoolFlag struct { 13 | Name string 14 | Usage string 15 | EnvVar string 16 | Hide bool 17 | } 18 | 19 | // String - 20 | func (f BoolFlag) String() string { 21 | return withEnvHint(f.EnvVar, fmt.Sprintf("%s\t%v", prefixedNames(f.Name), f.Usage)) 22 | } 23 | 24 | // Apply - 25 | func (f BoolFlag) Apply(set *flag.FlagSet) { 26 | val := false 27 | if f.EnvVar != "" { 28 | for _, envVar := range strings.Split(f.EnvVar, ",") { 29 | envVar = strings.TrimSpace(envVar) 30 | if envVal := os.Getenv(envVar); envVal != "" { 31 | envValBool, err := strconv.ParseBool(envVal) 32 | if err == nil { 33 | val = envValBool 34 | } 35 | break 36 | } 37 | } 38 | } 39 | 40 | eachName(f.Name, func(name string) { 41 | set.Bool(name, val, f.Usage) 42 | }) 43 | } 44 | 45 | func (f BoolFlag) getName() string { 46 | return f.Name 47 | } 48 | 49 | func (f BoolFlag) isNotHidden() bool { 50 | return !f.Hide 51 | } 52 | 53 | // BoolTFlag - a flag of bool environment type 54 | type BoolTFlag struct { 55 | Name string 56 | Usage string 57 | EnvVar string 58 | Hide bool 59 | } 60 | 61 | // String - 62 | func (f BoolTFlag) String() string { 63 | return withEnvHint(f.EnvVar, fmt.Sprintf("%s\t%v", prefixedNames(f.Name), f.Usage)) 64 | } 65 | 66 | // Apply - 67 | func (f BoolTFlag) Apply(set *flag.FlagSet) { 68 | val := true 69 | if f.EnvVar != "" { 70 | for _, envVar := range strings.Split(f.EnvVar, ",") { 71 | envVar = strings.TrimSpace(envVar) 72 | if envVal := os.Getenv(envVar); envVal != "" { 73 | envValBool, err := strconv.ParseBool(envVal) 74 | if err == nil { 75 | val = envValBool 76 | break 77 | } 78 | } 79 | } 80 | } 81 | 82 | eachName(f.Name, func(name string) { 83 | set.Bool(name, val, f.Usage) 84 | }) 85 | } 86 | 87 | func (f BoolTFlag) getName() string { 88 | return f.Name 89 | } 90 | 91 | func (f BoolTFlag) isNotHidden() bool { 92 | return !f.Hide 93 | } 94 | -------------------------------------------------------------------------------- /vendor/github.com/minio/cli/cli.go: -------------------------------------------------------------------------------- 1 | // Package cli provides a minimal framework for creating and organizing command line 2 | // Go applications. cli is designed to be easy to understand and write, the most simple 3 | // cli application can be written as follows: 4 | // func main() { 5 | // cli.NewApp().Run(os.Args) 6 | // } 7 | // 8 | // Of course this application does not do much, so let's make this an actual application: 9 | // func main() { 10 | // app := cli.NewApp() 11 | // app.Name = "greet" 12 | // app.Usage = "say a greeting" 13 | // app.Action = func(c *cli.Context) { 14 | // println("Greetings") 15 | // } 16 | // 17 | // app.Run(os.Args) 18 | // } 19 | package cli 20 | -------------------------------------------------------------------------------- /vendor/github.com/minio/cli/duration.go: -------------------------------------------------------------------------------- 1 | package cli 2 | 3 | import ( 4 | "flag" 5 | "fmt" 6 | "os" 7 | "strings" 8 | "time" 9 | ) 10 | 11 | // DurationFlag - a flag of time.Duration type 12 | type DurationFlag struct { 13 | Name string 14 | Value time.Duration 15 | Usage string 16 | EnvVar string 17 | Hide bool 18 | } 19 | 20 | // String - 21 | func (f DurationFlag) String() string { 22 | return withEnvHint(f.EnvVar, fmt.Sprintf("%s \"%v\"\t%v", prefixedNames(f.Name), f.Value, f.Usage)) 23 | } 24 | 25 | // Apply - 26 | func (f DurationFlag) Apply(set *flag.FlagSet) { 27 | if f.EnvVar != "" { 28 | for _, envVar := range strings.Split(f.EnvVar, ",") { 29 | envVar = strings.TrimSpace(envVar) 30 | if envVal := os.Getenv(envVar); envVal != "" { 31 | envValDuration, err := time.ParseDuration(envVal) 32 | if err == nil { 33 | f.Value = envValDuration 34 | break 35 | } 36 | } 37 | } 38 | } 39 | 40 | eachName(f.Name, func(name string) { 41 | set.Duration(name, f.Value, f.Usage) 42 | }) 43 | } 44 | 45 | func (f DurationFlag) getName() string { 46 | return f.Name 47 | } 48 | 49 | func (f DurationFlag) isNotHidden() bool { 50 | return !f.Hide 51 | } 52 | -------------------------------------------------------------------------------- /vendor/github.com/minio/cli/float64.go: -------------------------------------------------------------------------------- 1 | package cli 2 | 3 | import ( 4 | "flag" 5 | "fmt" 6 | "os" 7 | "strconv" 8 | "strings" 9 | ) 10 | 11 | // Float64Flag - a flag of floating number type 12 | type Float64Flag struct { 13 | Name string 14 | Value float64 15 | Usage string 16 | EnvVar string 17 | Hide bool 18 | } 19 | 20 | // String - 21 | func (f Float64Flag) String() string { 22 | return withEnvHint(f.EnvVar, fmt.Sprintf("%s \"%v\"\t%v", prefixedNames(f.Name), f.Value, f.Usage)) 23 | } 24 | 25 | // Apply - 26 | func (f Float64Flag) Apply(set *flag.FlagSet) { 27 | if f.EnvVar != "" { 28 | for _, envVar := range strings.Split(f.EnvVar, ",") { 29 | envVar = strings.TrimSpace(envVar) 30 | if envVal := os.Getenv(envVar); envVal != "" { 31 | envValFloat, err := strconv.ParseFloat(envVal, 10) 32 | if err == nil { 33 | f.Value = float64(envValFloat) 34 | } 35 | } 36 | } 37 | } 38 | 39 | eachName(f.Name, func(name string) { 40 | set.Float64(name, f.Value, f.Usage) 41 | }) 42 | } 43 | 44 | func (f Float64Flag) getName() string { 45 | return f.Name 46 | } 47 | 48 | func (f Float64Flag) isNotHidden() bool { 49 | return !f.Hide 50 | } 51 | -------------------------------------------------------------------------------- /vendor/github.com/minio/cli/int.go: -------------------------------------------------------------------------------- 1 | package cli 2 | 3 | import ( 4 | "flag" 5 | "fmt" 6 | "os" 7 | "strconv" 8 | "strings" 9 | ) 10 | 11 | // IntFlag - a flag of integer type 12 | type IntFlag struct { 13 | Name string 14 | Value int 15 | Usage string 16 | EnvVar string 17 | Hide bool 18 | } 19 | 20 | // String - 21 | func (f IntFlag) String() string { 22 | return withEnvHint(f.EnvVar, fmt.Sprintf("%s \"%v\"\t%v", prefixedNames(f.Name), f.Value, f.Usage)) 23 | } 24 | 25 | // Apply - 26 | func (f IntFlag) Apply(set *flag.FlagSet) { 27 | if f.EnvVar != "" { 28 | for _, envVar := range strings.Split(f.EnvVar, ",") { 29 | envVar = strings.TrimSpace(envVar) 30 | if envVal := os.Getenv(envVar); envVal != "" { 31 | envValInt, err := strconv.ParseInt(envVal, 0, 64) 32 | if err == nil { 33 | f.Value = int(envValInt) 34 | break 35 | } 36 | } 37 | } 38 | } 39 | 40 | eachName(f.Name, func(name string) { 41 | set.Int(name, f.Value, f.Usage) 42 | }) 43 | } 44 | 45 | func (f IntFlag) getName() string { 46 | return f.Name 47 | } 48 | 49 | func (f IntFlag) isNotHidden() bool { 50 | return !f.Hide 51 | } 52 | -------------------------------------------------------------------------------- /vendor/github.com/minio/cli/intslice.go: -------------------------------------------------------------------------------- 1 | package cli 2 | 3 | import ( 4 | "flag" 5 | "fmt" 6 | "os" 7 | "strconv" 8 | "strings" 9 | ) 10 | 11 | // IntSlice - a type of integer slice 12 | type IntSlice []int 13 | 14 | // Set - 15 | func (f *IntSlice) Set(value string) error { 16 | tmp, err := strconv.Atoi(value) 17 | if err != nil { 18 | return err 19 | } 20 | *f = append(*f, tmp) 21 | return nil 22 | } 23 | 24 | // String - 25 | func (f *IntSlice) String() string { 26 | return fmt.Sprintf("%d", *f) 27 | } 28 | 29 | // Value - 30 | func (f *IntSlice) Value() []int { 31 | return *f 32 | } 33 | 34 | // IntSliceFlag - a type of integer slice flag 35 | type IntSliceFlag struct { 36 | Name string 37 | Value *IntSlice 38 | Usage string 39 | EnvVar string 40 | Hide bool 41 | } 42 | 43 | // String - 44 | func (f IntSliceFlag) String() string { 45 | firstName := strings.Trim(strings.Split(f.Name, ",")[0], " ") 46 | pref := prefixFor(firstName) 47 | return withEnvHint(f.EnvVar, fmt.Sprintf("%s [%v]\t%v", prefixedNames(f.Name), pref+firstName+" option "+pref+firstName+" option", f.Usage)) 48 | } 49 | 50 | // Apply - 51 | func (f IntSliceFlag) Apply(set *flag.FlagSet) { 52 | if f.EnvVar != "" { 53 | for _, envVar := range strings.Split(f.EnvVar, ",") { 54 | envVar = strings.TrimSpace(envVar) 55 | if envVal := os.Getenv(envVar); envVal != "" { 56 | newVal := &IntSlice{} 57 | for _, s := range strings.Split(envVal, ",") { 58 | s = strings.TrimSpace(s) 59 | err := newVal.Set(s) 60 | if err != nil { 61 | fmt.Fprintf(os.Stderr, err.Error()) 62 | } 63 | } 64 | f.Value = newVal 65 | break 66 | } 67 | } 68 | } 69 | 70 | eachName(f.Name, func(name string) { 71 | set.Var(f.Value, name, f.Usage) 72 | }) 73 | } 74 | 75 | func (f IntSliceFlag) getName() string { 76 | return f.Name 77 | } 78 | 79 | func (f IntSliceFlag) isNotHidden() bool { 80 | return !f.Hide 81 | } 82 | -------------------------------------------------------------------------------- /vendor/github.com/minio/cli/string.go: -------------------------------------------------------------------------------- 1 | package cli 2 | 3 | import ( 4 | "flag" 5 | "fmt" 6 | "os" 7 | "strings" 8 | ) 9 | 10 | // StringFlag - a string flag type 11 | type StringFlag struct { 12 | Name string 13 | Value string 14 | Usage string 15 | EnvVar string 16 | Hide bool 17 | } 18 | 19 | func (f StringFlag) String() string { 20 | var fmtString string 21 | fmtString = "%s %v\t%v" 22 | 23 | if len(f.Value) > 0 { 24 | fmtString = "%s \"%v\"\t%v" 25 | } else { 26 | fmtString = "%s %v\t%v" 27 | } 28 | return withEnvHint(f.EnvVar, fmt.Sprintf(fmtString, prefixedNames(f.Name), f.Value, f.Usage)) 29 | } 30 | 31 | // Apply - 32 | func (f StringFlag) Apply(set *flag.FlagSet) { 33 | if f.EnvVar != "" { 34 | for _, envVar := range strings.Split(f.EnvVar, ",") { 35 | envVar = strings.TrimSpace(envVar) 36 | if envVal := os.Getenv(envVar); envVal != "" { 37 | f.Value = envVal 38 | break 39 | } 40 | } 41 | } 42 | 43 | eachName(f.Name, func(name string) { 44 | set.String(name, f.Value, f.Usage) 45 | }) 46 | } 47 | 48 | func (f StringFlag) getName() string { 49 | return f.Name 50 | } 51 | 52 | func (f StringFlag) isNotHidden() bool { 53 | return !f.Hide 54 | } 55 | -------------------------------------------------------------------------------- /vendor/github.com/minio/cli/stringslice.go: -------------------------------------------------------------------------------- 1 | package cli 2 | 3 | import ( 4 | "flag" 5 | "fmt" 6 | "os" 7 | "strings" 8 | ) 9 | 10 | // StringSlice - type 11 | type StringSlice []string 12 | 13 | // Set - 14 | func (f *StringSlice) Set(value string) error { 15 | *f = append(*f, value) 16 | return nil 17 | } 18 | 19 | // String - 20 | func (f *StringSlice) String() string { 21 | return fmt.Sprintf("%s", *f) 22 | } 23 | 24 | // Value - 25 | func (f *StringSlice) Value() []string { 26 | return *f 27 | } 28 | 29 | // StringSliceFlag - a string slice flag type 30 | type StringSliceFlag struct { 31 | Name string 32 | Value *StringSlice 33 | Usage string 34 | EnvVar string 35 | Hide bool 36 | } 37 | 38 | // String - 39 | func (f StringSliceFlag) String() string { 40 | firstName := strings.Trim(strings.Split(f.Name, ",")[0], " ") 41 | pref := prefixFor(firstName) 42 | return withEnvHint(f.EnvVar, fmt.Sprintf("%s [%v]\t%v", prefixedNames(f.Name), pref+firstName+" option "+pref+firstName+" option", f.Usage)) 43 | } 44 | 45 | // Apply - 46 | func (f StringSliceFlag) Apply(set *flag.FlagSet) { 47 | if f.EnvVar != "" { 48 | for _, envVar := range strings.Split(f.EnvVar, ",") { 49 | envVar = strings.TrimSpace(envVar) 50 | if envVal := os.Getenv(envVar); envVal != "" { 51 | newVal := &StringSlice{} 52 | for _, s := range strings.Split(envVal, ",") { 53 | s = strings.TrimSpace(s) 54 | newVal.Set(s) 55 | } 56 | f.Value = newVal 57 | break 58 | } 59 | } 60 | } 61 | 62 | eachName(f.Name, func(name string) { 63 | set.Var(f.Value, name, f.Usage) 64 | }) 65 | } 66 | 67 | func (f StringSliceFlag) getName() string { 68 | return f.Name 69 | } 70 | 71 | func (f StringSliceFlag) isNotHidden() bool { 72 | return !f.Hide 73 | } 74 | -------------------------------------------------------------------------------- /vendor/github.com/op/go-logging/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | ## 2.0.0-rc1 (2016-02-11) 4 | 5 | Time flies and it has been three years since this package was first released. 6 | There have been a couple of API changes I have wanted to do for some time but 7 | I've tried to maintain backwards compatibility. Some inconsistencies in the 8 | API have started to show, proper vendor support in Go out of the box and 9 | the fact that `go vet` will give warnings -- I have decided to bump the major 10 | version. 11 | 12 | * Make eg. `Info` and `Infof` do different things. You want to change all calls 13 | to `Info` with a string format go to `Infof` etc. In many cases, `go vet` will 14 | guide you. 15 | * `Id` in `Record` is now called `ID` 16 | 17 | ## 1.0.0 (2013-02-21) 18 | 19 | Initial release 20 | -------------------------------------------------------------------------------- /vendor/github.com/op/go-logging/CONTRIBUTORS: -------------------------------------------------------------------------------- 1 | Alec Thomas 2 | Guilhem Lettron 3 | Ivan Daniluk 4 | Nimi Wariboko Jr 5 | Róbert Selvek 6 | -------------------------------------------------------------------------------- /vendor/github.com/op/go-logging/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2013 Örjan Persson. 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/github.com/op/go-logging/backend.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013, Örjan Persson. 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 logging 6 | 7 | // defaultBackend is the backend used for all logging calls. 8 | var defaultBackend LeveledBackend 9 | 10 | // Backend is the interface which a log backend need to implement to be able to 11 | // be used as a logging backend. 12 | type Backend interface { 13 | Log(Level, int, *Record) error 14 | } 15 | 16 | // SetBackend replaces the backend currently set with the given new logging 17 | // backend. 18 | func SetBackend(backends ...Backend) LeveledBackend { 19 | var backend Backend 20 | if len(backends) == 1 { 21 | backend = backends[0] 22 | } else { 23 | backend = MultiLogger(backends...) 24 | } 25 | 26 | defaultBackend = AddModuleLevel(backend) 27 | return defaultBackend 28 | } 29 | 30 | // SetLevel sets the logging level for the specified module. The module 31 | // corresponds to the string specified in GetLogger. 32 | func SetLevel(level Level, module string) { 33 | defaultBackend.SetLevel(level, module) 34 | } 35 | 36 | // GetLevel returns the logging level for the specified module. 37 | func GetLevel(module string) Level { 38 | return defaultBackend.GetLevel(module) 39 | } 40 | -------------------------------------------------------------------------------- /vendor/github.com/op/go-logging/multi.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013, Örjan Persson. 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 logging 6 | 7 | // TODO remove Level stuff from the multi logger. Do one thing. 8 | 9 | // multiLogger is a log multiplexer which can be used to utilize multiple log 10 | // backends at once. 11 | type multiLogger struct { 12 | backends []LeveledBackend 13 | } 14 | 15 | // MultiLogger creates a logger which contain multiple loggers. 16 | func MultiLogger(backends ...Backend) LeveledBackend { 17 | var leveledBackends []LeveledBackend 18 | for _, backend := range backends { 19 | leveledBackends = append(leveledBackends, AddModuleLevel(backend)) 20 | } 21 | return &multiLogger{leveledBackends} 22 | } 23 | 24 | // Log passes the log record to all backends. 25 | func (b *multiLogger) Log(level Level, calldepth int, rec *Record) (err error) { 26 | for _, backend := range b.backends { 27 | if backend.IsEnabledFor(level, rec.Module) { 28 | // Shallow copy of the record for the formatted cache on Record and get the 29 | // record formatter from the backend. 30 | r2 := *rec 31 | if e := backend.Log(level, calldepth+1, &r2); e != nil { 32 | err = e 33 | } 34 | } 35 | } 36 | return 37 | } 38 | 39 | // GetLevel returns the highest level enabled by all backends. 40 | func (b *multiLogger) GetLevel(module string) Level { 41 | var level Level 42 | for _, backend := range b.backends { 43 | if backendLevel := backend.GetLevel(module); backendLevel > level { 44 | level = backendLevel 45 | } 46 | } 47 | return level 48 | } 49 | 50 | // SetLevel propagates the same level to all backends. 51 | func (b *multiLogger) SetLevel(level Level, module string) { 52 | for _, backend := range b.backends { 53 | backend.SetLevel(level, module) 54 | } 55 | } 56 | 57 | // IsEnabledFor returns true if any of the backends are enabled for it. 58 | func (b *multiLogger) IsEnabledFor(level Level, module string) bool { 59 | for _, backend := range b.backends { 60 | if backend.IsEnabledFor(level, module) { 61 | return true 62 | } 63 | } 64 | return false 65 | } 66 | -------------------------------------------------------------------------------- /vendor/github.com/op/go-logging/syslog.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013, Örjan Persson. 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 !windows,!plan9 6 | 7 | package logging 8 | 9 | import "log/syslog" 10 | 11 | // SyslogBackend is a simple logger to syslog backend. It automatically maps 12 | // the internal log levels to appropriate syslog log levels. 13 | type SyslogBackend struct { 14 | Writer *syslog.Writer 15 | } 16 | 17 | // NewSyslogBackend connects to the syslog daemon using UNIX sockets with the 18 | // given prefix. If prefix is not given, the prefix will be derived from the 19 | // launched command. 20 | func NewSyslogBackend(prefix string) (b *SyslogBackend, err error) { 21 | var w *syslog.Writer 22 | w, err = syslog.New(syslog.LOG_CRIT, prefix) 23 | return &SyslogBackend{w}, err 24 | } 25 | 26 | // NewSyslogBackendPriority is the same as NewSyslogBackend, but with custom 27 | // syslog priority, like syslog.LOG_LOCAL3|syslog.LOG_DEBUG etc. 28 | func NewSyslogBackendPriority(prefix string, priority syslog.Priority) (b *SyslogBackend, err error) { 29 | var w *syslog.Writer 30 | w, err = syslog.New(priority, prefix) 31 | return &SyslogBackend{w}, err 32 | } 33 | 34 | // Log implements the Backend interface. 35 | func (b *SyslogBackend) Log(level Level, calldepth int, rec *Record) error { 36 | line := rec.Formatted(calldepth + 1) 37 | switch level { 38 | case CRITICAL: 39 | return b.Writer.Crit(line) 40 | case ERROR: 41 | return b.Writer.Err(line) 42 | case WARNING: 43 | return b.Writer.Warning(line) 44 | case NOTICE: 45 | return b.Writer.Notice(line) 46 | case INFO: 47 | return b.Writer.Info(line) 48 | case DEBUG: 49 | return b.Writer.Debug(line) 50 | default: 51 | } 52 | panic("unhandled log level") 53 | } 54 | -------------------------------------------------------------------------------- /vendor/github.com/op/go-logging/syslog_fallback.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013, Örjan Persson. 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 windows plan9 6 | 7 | package logging 8 | 9 | import ( 10 | "fmt" 11 | ) 12 | 13 | type Priority int 14 | 15 | type SyslogBackend struct { 16 | } 17 | 18 | func NewSyslogBackend(prefix string) (b *SyslogBackend, err error) { 19 | return nil, fmt.Errorf("Platform does not support syslog") 20 | } 21 | 22 | func NewSyslogBackendPriority(prefix string, priority Priority) (b *SyslogBackend, err error) { 23 | return nil, fmt.Errorf("Platform does not support syslog") 24 | } 25 | 26 | func (b *SyslogBackend) Log(level Level, calldepth int, rec *Record) error { 27 | return fmt.Errorf("Platform does not support syslog") 28 | } 29 | -------------------------------------------------------------------------------- /vendor/github.com/pkg/profile/AUTHORS: -------------------------------------------------------------------------------- 1 | Dave Cheney 2 | -------------------------------------------------------------------------------- /vendor/github.com/pkg/profile/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2013 Dave Cheney. 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 | 14 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 15 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 16 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 17 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 18 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 19 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 20 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 24 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | -------------------------------------------------------------------------------- /vendor/github.com/pkg/profile/README.md: -------------------------------------------------------------------------------- 1 | profile 2 | ======= 3 | 4 | Simple profiling support package for Go 5 | 6 | [![Build Status](https://travis-ci.org/pkg/profile.svg?branch=master)](https://travis-ci.org/pkg/profile) [![GoDoc](http://godoc.org/github.com/pkg/profile?status.svg)](http://godoc.org/github.com/pkg/profile) 7 | 8 | 9 | installation 10 | ------------ 11 | 12 | go get github.com/pkg/profile 13 | 14 | usage 15 | ----- 16 | 17 | Enabling profiling in your application is as simple as one line at the top of your main function 18 | 19 | ```go 20 | import "github.com/pkg/profile" 21 | 22 | func main() { 23 | defer profile.Start().Stop() 24 | ... 25 | } 26 | ``` 27 | 28 | options 29 | ------- 30 | 31 | What to profile is controlled by config value passed to profile.Start. 32 | By default CPU profiling is enabled. 33 | 34 | ```go 35 | import "github.com/pkg/profile" 36 | 37 | func main() { 38 | // p.Stop() must be called before the program exits to 39 | // ensure profiling information is written to disk. 40 | p := profile.Start(profile.MemProfile, profile.ProfilePath("."), profile.NoShutdownHook) 41 | ... 42 | } 43 | ``` 44 | 45 | Several convenience package level values are provided for cpu, memory, and block (contention) profiling. 46 | 47 | For more complex options, consult the [documentation](http://godoc.org/github.com/pkg/profile). 48 | 49 | contributing 50 | ------------ 51 | 52 | We welcome pull requests, bug fixes and issue reports. 53 | 54 | Before proposing a change, please discuss it first by raising an issue. 55 | -------------------------------------------------------------------------------- /vendor/github.com/pkg/profile/trace.go: -------------------------------------------------------------------------------- 1 | // +build go1.7 2 | 3 | package profile 4 | 5 | import "runtime/trace" 6 | 7 | var startTrace = trace.Start 8 | var stopTrace = trace.Stop 9 | -------------------------------------------------------------------------------- /vendor/github.com/pkg/profile/trace16.go: -------------------------------------------------------------------------------- 1 | // +build !go1.7 2 | 3 | package profile 4 | 5 | import "io" 6 | 7 | // mock trace support for Go 1.6 and earlier. 8 | 9 | func startTrace(w io.Writer) error { return nil } 10 | func stopTrace() {} 11 | -------------------------------------------------------------------------------- /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/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/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/internal/netreflect/socket.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 netreflect implements run-time reflection for the 6 | // facilities of net package. 7 | package netreflect 8 | 9 | import ( 10 | "errors" 11 | "net" 12 | ) 13 | 14 | var ( 15 | errInvalidType = errors.New("invalid type") 16 | errOpNoSupport = errors.New("operation not supported") 17 | ) 18 | 19 | // SocketOf returns the socket descriptor of c. 20 | func SocketOf(c net.Conn) (uintptr, error) { 21 | switch c.(type) { 22 | case *net.TCPConn, *net.UDPConn, *net.IPConn, *net.UnixConn: 23 | return socketOf(c) 24 | default: 25 | return 0, errInvalidType 26 | } 27 | } 28 | 29 | // PacketSocketOf returns the socket descriptor of c. 30 | func PacketSocketOf(c net.PacketConn) (uintptr, error) { 31 | switch c.(type) { 32 | case *net.UDPConn, *net.IPConn, *net.UnixConn: 33 | return socketOf(c.(net.Conn)) 34 | default: 35 | return 0, errInvalidType 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/netreflect/socket_posix.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 | // +build darwin dragonfly freebsd linux netbsd openbsd solaris windows 6 | 7 | package netreflect 8 | 9 | import ( 10 | "net" 11 | "reflect" 12 | "runtime" 13 | ) 14 | 15 | func socketOf(c net.Conn) (uintptr, error) { 16 | v := reflect.ValueOf(c) 17 | switch e := v.Elem(); e.Kind() { 18 | case reflect.Struct: 19 | fd := e.FieldByName("conn").FieldByName("fd") 20 | switch e := fd.Elem(); e.Kind() { 21 | case reflect.Struct: 22 | sysfd := e.FieldByName("sysfd") 23 | if runtime.GOOS == "windows" { 24 | return uintptr(sysfd.Uint()), nil 25 | } 26 | return uintptr(sysfd.Int()), nil 27 | } 28 | } 29 | return 0, errInvalidType 30 | } 31 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/internal/netreflect/socket_stub.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 | // +build !darwin,!dragonfly,!freebsd,!linux,!netbsd,!openbsd,!solaris,!windows 6 | 7 | package netreflect 8 | 9 | import "net" 10 | 11 | func socketOf(c net.Conn) (uintptr, error) { return 0, errOpNoSupport } 12 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/ipv4/bpfopt_linux.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 ipv4 6 | 7 | import ( 8 | "os" 9 | "unsafe" 10 | 11 | "golang.org/x/net/bpf" 12 | "golang.org/x/net/internal/netreflect" 13 | ) 14 | 15 | // SetBPF attaches a BPF program to the connection. 16 | // 17 | // Only supported on Linux. 18 | func (c *dgramOpt) SetBPF(filter []bpf.RawInstruction) error { 19 | s, err := netreflect.PacketSocketOf(c.PacketConn) 20 | if err != nil { 21 | return err 22 | } 23 | prog := sockFProg{ 24 | Len: uint16(len(filter)), 25 | Filter: (*sockFilter)(unsafe.Pointer(&filter[0])), 26 | } 27 | return os.NewSyscallError("setsockopt", setsockopt(s, sysSOL_SOCKET, sysSO_ATTACH_FILTER, unsafe.Pointer(&prog), uint32(unsafe.Sizeof(prog)))) 28 | } 29 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/ipv4/bpfopt_stub.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 | // +build !linux 6 | 7 | package ipv4 8 | 9 | import "golang.org/x/net/bpf" 10 | 11 | // SetBPF attaches a BPF program to the connection. 12 | // 13 | // Only supported on Linux. 14 | func (c *dgramOpt) SetBPF(filter []bpf.RawInstruction) error { 15 | return errOpNoSupport 16 | } 17 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/ipv4/control.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 | "fmt" 9 | "net" 10 | "sync" 11 | ) 12 | 13 | type rawOpt struct { 14 | sync.RWMutex 15 | cflags ControlFlags 16 | } 17 | 18 | func (c *rawOpt) set(f ControlFlags) { c.cflags |= f } 19 | func (c *rawOpt) clear(f ControlFlags) { c.cflags &^= f } 20 | func (c *rawOpt) isset(f ControlFlags) bool { return c.cflags&f != 0 } 21 | 22 | type ControlFlags uint 23 | 24 | const ( 25 | FlagTTL ControlFlags = 1 << iota // pass the TTL on the received packet 26 | FlagSrc // pass the source address on the received packet 27 | FlagDst // pass the destination address on the received packet 28 | FlagInterface // pass the interface index on the received packet 29 | ) 30 | 31 | // A ControlMessage represents per packet basis IP-level socket options. 32 | type ControlMessage struct { 33 | // Receiving socket options: SetControlMessage allows to 34 | // receive the options from the protocol stack using ReadFrom 35 | // method of PacketConn or RawConn. 36 | // 37 | // Specifying socket options: ControlMessage for WriteTo 38 | // method of PacketConn or RawConn allows to send the options 39 | // to the protocol stack. 40 | // 41 | TTL int // time-to-live, receiving only 42 | Src net.IP // source address, specifying only 43 | Dst net.IP // destination address, receiving only 44 | IfIndex int // interface index, must be 1 <= value when specifying 45 | } 46 | 47 | func (cm *ControlMessage) String() string { 48 | if cm == nil { 49 | return "" 50 | } 51 | return fmt.Sprintf("ttl=%d src=%v dst=%v ifindex=%d", cm.TTL, cm.Src, cm.Dst, cm.IfIndex) 52 | } 53 | 54 | // Ancillary data socket options 55 | const ( 56 | ctlTTL = iota // header field 57 | ctlSrc // header field 58 | ctlDst // header field 59 | ctlInterface // inbound or outbound interface 60 | ctlPacketInfo // inbound or outbound packet path 61 | ctlMax 62 | ) 63 | 64 | // A ctlOpt represents a binding for ancillary data socket option. 65 | type ctlOpt struct { 66 | name int // option name, must be equal or greater than 1 67 | length int // option length 68 | marshal func([]byte, *ControlMessage) []byte 69 | parse func(*ControlMessage, []byte) 70 | } 71 | -------------------------------------------------------------------------------- /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 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 | ) 16 | 17 | func marshalDst(b []byte, cm *ControlMessage) []byte { 18 | m := (*syscall.Cmsghdr)(unsafe.Pointer(&b[0])) 19 | m.Level = iana.ProtocolIP 20 | m.Type = sysIP_RECVDSTADDR 21 | m.SetLen(syscall.CmsgLen(net.IPv4len)) 22 | return b[syscall.CmsgSpace(net.IPv4len):] 23 | } 24 | 25 | func parseDst(cm *ControlMessage, b []byte) { 26 | cm.Dst = b[:net.IPv4len] 27 | } 28 | 29 | func marshalInterface(b []byte, cm *ControlMessage) []byte { 30 | m := (*syscall.Cmsghdr)(unsafe.Pointer(&b[0])) 31 | m.Level = iana.ProtocolIP 32 | m.Type = sysIP_RECVIF 33 | m.SetLen(syscall.CmsgLen(syscall.SizeofSockaddrDatalink)) 34 | return b[syscall.CmsgSpace(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/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 | "syscall" 11 | "unsafe" 12 | 13 | "golang.org/x/net/internal/iana" 14 | ) 15 | 16 | func marshalPacketInfo(b []byte, cm *ControlMessage) []byte { 17 | m := (*syscall.Cmsghdr)(unsafe.Pointer(&b[0])) 18 | m.Level = iana.ProtocolIP 19 | m.Type = sysIP_PKTINFO 20 | m.SetLen(syscall.CmsgLen(sizeofInetPktinfo)) 21 | if cm != nil { 22 | pi := (*inetPktinfo)(unsafe.Pointer(&b[syscall.CmsgLen(0)])) 23 | if ip := cm.Src.To4(); ip != nil { 24 | copy(pi.Spec_dst[:], ip) 25 | } 26 | if cm.IfIndex > 0 { 27 | pi.setIfindex(cm.IfIndex) 28 | } 29 | } 30 | return b[syscall.CmsgSpace(sizeofInetPktinfo):] 31 | } 32 | 33 | func parsePacketInfo(cm *ControlMessage, b []byte) { 34 | pi := (*inetPktinfo)(unsafe.Pointer(&b[0])) 35 | cm.IfIndex = int(pi.Ifindex) 36 | cm.Dst = pi.Addr[:] 37 | } 38 | -------------------------------------------------------------------------------- /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 nacl plan9 6 | 7 | package ipv4 8 | 9 | func setControlMessage(s uintptr, opt *rawOpt, cf ControlFlags, on bool) error { 10 | return errOpNoSupport 11 | } 12 | 13 | func newControlMessage(opt *rawOpt) []byte { 14 | return nil 15 | } 16 | 17 | func parseControlMessage(b []byte) (*ControlMessage, error) { 18 | return nil, errOpNoSupport 19 | } 20 | 21 | func marshalControlMessage(cm *ControlMessage) []byte { 22 | return nil 23 | } 24 | -------------------------------------------------------------------------------- /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 "syscall" 8 | 9 | func setControlMessage(s uintptr, opt *rawOpt, cf ControlFlags, on bool) error { 10 | // TODO(mikio): implement this 11 | return syscall.EWINDOWS 12 | } 13 | 14 | func newControlMessage(opt *rawOpt) []byte { 15 | // TODO(mikio): implement this 16 | return nil 17 | } 18 | 19 | func parseControlMessage(b []byte) (*ControlMessage, error) { 20 | // TODO(mikio): implement this 21 | return nil, syscall.EWINDOWS 22 | } 23 | 24 | func marshalControlMessage(cm *ControlMessage) []byte { 25 | // TODO(mikio): implement this 26 | return nil 27 | } 28 | -------------------------------------------------------------------------------- /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/defs_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 | // +build ignore 6 | 7 | // +godefs map struct_in_addr [4]byte /* in_addr */ 8 | 9 | package ipv4 10 | 11 | /* 12 | #include 13 | 14 | #include 15 | */ 16 | import "C" 17 | 18 | const ( 19 | sysIP_OPTIONS = C.IP_OPTIONS 20 | sysIP_HDRINCL = C.IP_HDRINCL 21 | sysIP_TOS = C.IP_TOS 22 | sysIP_TTL = C.IP_TTL 23 | sysIP_RECVOPTS = C.IP_RECVOPTS 24 | sysIP_RECVRETOPTS = C.IP_RECVRETOPTS 25 | sysIP_RECVDSTADDR = C.IP_RECVDSTADDR 26 | sysIP_SENDSRCADDR = C.IP_SENDSRCADDR 27 | sysIP_RETOPTS = C.IP_RETOPTS 28 | sysIP_RECVIF = C.IP_RECVIF 29 | sysIP_ONESBCAST = C.IP_ONESBCAST 30 | sysIP_BINDANY = C.IP_BINDANY 31 | sysIP_RECVTTL = C.IP_RECVTTL 32 | sysIP_MINTTL = C.IP_MINTTL 33 | sysIP_DONTFRAG = C.IP_DONTFRAG 34 | sysIP_RECVTOS = C.IP_RECVTOS 35 | 36 | sysIP_MULTICAST_IF = C.IP_MULTICAST_IF 37 | sysIP_MULTICAST_TTL = C.IP_MULTICAST_TTL 38 | sysIP_MULTICAST_LOOP = C.IP_MULTICAST_LOOP 39 | sysIP_ADD_MEMBERSHIP = C.IP_ADD_MEMBERSHIP 40 | sysIP_DROP_MEMBERSHIP = C.IP_DROP_MEMBERSHIP 41 | sysIP_MULTICAST_VIF = C.IP_MULTICAST_VIF 42 | sysIP_ADD_SOURCE_MEMBERSHIP = C.IP_ADD_SOURCE_MEMBERSHIP 43 | sysIP_DROP_SOURCE_MEMBERSHIP = C.IP_DROP_SOURCE_MEMBERSHIP 44 | sysIP_BLOCK_SOURCE = C.IP_BLOCK_SOURCE 45 | sysIP_UNBLOCK_SOURCE = C.IP_UNBLOCK_SOURCE 46 | sysMCAST_JOIN_GROUP = C.MCAST_JOIN_GROUP 47 | sysMCAST_LEAVE_GROUP = C.MCAST_LEAVE_GROUP 48 | sysMCAST_JOIN_SOURCE_GROUP = C.MCAST_JOIN_SOURCE_GROUP 49 | sysMCAST_LEAVE_SOURCE_GROUP = C.MCAST_LEAVE_SOURCE_GROUP 50 | sysMCAST_BLOCK_SOURCE = C.MCAST_BLOCK_SOURCE 51 | sysMCAST_UNBLOCK_SOURCE = C.MCAST_UNBLOCK_SOURCE 52 | 53 | sizeofSockaddrStorage = C.sizeof_struct_sockaddr_storage 54 | sizeofSockaddrInet = C.sizeof_struct_sockaddr_in 55 | 56 | sizeofIPMreq = C.sizeof_struct_ip_mreq 57 | sizeofIPMreqn = C.sizeof_struct_ip_mreqn 58 | sizeofIPMreqSource = C.sizeof_struct_ip_mreq_source 59 | sizeofGroupReq = C.sizeof_struct_group_req 60 | sizeofGroupSourceReq = C.sizeof_struct_group_source_req 61 | ) 62 | 63 | type sockaddrStorage C.struct_sockaddr_storage 64 | 65 | type sockaddrInet C.struct_sockaddr_in 66 | 67 | type ipMreq C.struct_ip_mreq 68 | 69 | type ipMreqn C.struct_ip_mreqn 70 | 71 | type ipMreqSource C.struct_ip_mreq_source 72 | 73 | type groupReq C.struct_group_req 74 | 75 | type groupSourceReq C.struct_group_source_req 76 | -------------------------------------------------------------------------------- /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/ipv4/genericopt_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 darwin dragonfly freebsd linux netbsd openbsd solaris windows 6 | 7 | package ipv4 8 | 9 | import ( 10 | "syscall" 11 | 12 | "golang.org/x/net/internal/netreflect" 13 | ) 14 | 15 | // TOS returns the type-of-service field value for outgoing packets. 16 | func (c *genericOpt) TOS() (int, error) { 17 | if !c.ok() { 18 | return 0, syscall.EINVAL 19 | } 20 | s, err := netreflect.SocketOf(c.Conn) 21 | if err != nil { 22 | return 0, err 23 | } 24 | return getInt(s, &sockOpts[ssoTOS]) 25 | } 26 | 27 | // SetTOS sets the type-of-service field value for future outgoing 28 | // packets. 29 | func (c *genericOpt) SetTOS(tos int) error { 30 | if !c.ok() { 31 | return syscall.EINVAL 32 | } 33 | s, err := netreflect.SocketOf(c.Conn) 34 | if err != nil { 35 | return err 36 | } 37 | return setInt(s, &sockOpts[ssoTOS], tos) 38 | } 39 | 40 | // TTL returns the time-to-live field value for outgoing packets. 41 | func (c *genericOpt) TTL() (int, error) { 42 | if !c.ok() { 43 | return 0, syscall.EINVAL 44 | } 45 | s, err := netreflect.SocketOf(c.Conn) 46 | if err != nil { 47 | return 0, err 48 | } 49 | return getInt(s, &sockOpts[ssoTTL]) 50 | } 51 | 52 | // SetTTL sets the time-to-live field value for future outgoing 53 | // packets. 54 | func (c *genericOpt) SetTTL(ttl int) error { 55 | if !c.ok() { 56 | return syscall.EINVAL 57 | } 58 | s, err := netreflect.SocketOf(c.Conn) 59 | if err != nil { 60 | return err 61 | } 62 | return setInt(s, &sockOpts[ssoTTL], ttl) 63 | } 64 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/ipv4/genericopt_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 nacl plan9 6 | 7 | package ipv4 8 | 9 | // TOS returns the type-of-service field value for outgoing packets. 10 | func (c *genericOpt) TOS() (int, error) { 11 | return 0, errOpNoSupport 12 | } 13 | 14 | // SetTOS sets the type-of-service field value for future outgoing 15 | // packets. 16 | func (c *genericOpt) SetTOS(tos int) error { 17 | return errOpNoSupport 18 | } 19 | 20 | // TTL returns the time-to-live field value for outgoing packets. 21 | func (c *genericOpt) TTL() (int, error) { 22 | return 0, errOpNoSupport 23 | } 24 | 25 | // SetTTL sets the time-to-live field value for future outgoing 26 | // packets. 27 | func (c *genericOpt) SetTTL(ttl int) error { 28 | return errOpNoSupport 29 | } 30 | -------------------------------------------------------------------------------- /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 | "encoding/binary" 9 | "errors" 10 | "net" 11 | "unsafe" 12 | ) 13 | 14 | var ( 15 | errMissingAddress = errors.New("missing address") 16 | errMissingHeader = errors.New("missing header") 17 | errHeaderTooShort = errors.New("header too short") 18 | errBufferTooShort = errors.New("buffer too short") 19 | errInvalidConnType = errors.New("invalid conn type") 20 | errOpNoSupport = errors.New("operation not supported") 21 | errNoSuchInterface = errors.New("no such interface") 22 | errNoSuchMulticastInterface = errors.New("no such multicast interface") 23 | 24 | // See http://www.freebsd.org/doc/en/books/porters-handbook/freebsd-versions.html. 25 | freebsdVersion uint32 26 | 27 | nativeEndian binary.ByteOrder 28 | ) 29 | 30 | func init() { 31 | i := uint32(1) 32 | b := (*[4]byte)(unsafe.Pointer(&i)) 33 | if b[0] == 1 { 34 | nativeEndian = binary.LittleEndian 35 | } else { 36 | nativeEndian = binary.BigEndian 37 | } 38 | } 39 | 40 | func boolint(b bool) int { 41 | if b { 42 | return 1 43 | } 44 | return 0 45 | } 46 | 47 | func netAddrToIP4(a net.Addr) net.IP { 48 | switch v := a.(type) { 49 | case *net.UDPAddr: 50 | if ip := v.IP.To4(); ip != nil { 51 | return ip 52 | } 53 | case *net.IPAddr: 54 | if ip := v.IP.To4(); ip != nil { 55 | return ip 56 | } 57 | } 58 | return nil 59 | } 60 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/ipv4/iana.go: -------------------------------------------------------------------------------- 1 | // go generate gen.go 2 | // GENERATED BY THE COMMAND ABOVE; DO NOT EDIT 3 | 4 | package ipv4 5 | 6 | // Internet Control Message Protocol (ICMP) Parameters, Updated: 2013-04-19 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 | ) 20 | 21 | // Internet Control Message Protocol (ICMP) Parameters, Updated: 2013-04-19 22 | var icmpTypes = map[ICMPType]string{ 23 | 0: "echo reply", 24 | 3: "destination unreachable", 25 | 5: "redirect", 26 | 8: "echo", 27 | 9: "router advertisement", 28 | 10: "router solicitation", 29 | 11: "time exceeded", 30 | 12: "parameter problem", 31 | 13: "timestamp", 32 | 14: "timestamp reply", 33 | 40: "photuris", 34 | } 35 | -------------------------------------------------------------------------------- /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 2460 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/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/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/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 "net" 8 | 9 | // A payloadHandler represents the IPv4 datagram payload handler. 10 | type payloadHandler struct { 11 | net.PacketConn 12 | rawOpt 13 | } 14 | 15 | func (c *payloadHandler) ok() bool { return c != nil && c.PacketConn != nil } 16 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/ipv4/payload_cmsg.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 !plan9,!windows 6 | 7 | package ipv4 8 | 9 | import ( 10 | "net" 11 | "syscall" 12 | ) 13 | 14 | // ReadFrom reads a payload of the received IPv4 datagram, from the 15 | // endpoint c, copying the payload into b. It returns the number of 16 | // bytes copied into b, the control message cm and the source address 17 | // src of the received datagram. 18 | func (c *payloadHandler) ReadFrom(b []byte) (n int, cm *ControlMessage, src net.Addr, err error) { 19 | if !c.ok() { 20 | return 0, nil, nil, syscall.EINVAL 21 | } 22 | oob := newControlMessage(&c.rawOpt) 23 | var oobn int 24 | switch c := c.PacketConn.(type) { 25 | case *net.UDPConn: 26 | if n, oobn, _, src, err = c.ReadMsgUDP(b, oob); err != nil { 27 | return 0, nil, nil, err 28 | } 29 | case *net.IPConn: 30 | if sockOpts[ssoStripHeader].name > 0 { 31 | if n, oobn, _, src, err = c.ReadMsgIP(b, oob); err != nil { 32 | return 0, nil, nil, err 33 | } 34 | } else { 35 | nb := make([]byte, maxHeaderLen+len(b)) 36 | if n, oobn, _, src, err = c.ReadMsgIP(nb, oob); err != nil { 37 | return 0, nil, nil, err 38 | } 39 | hdrlen := int(nb[0]&0x0f) << 2 40 | copy(b, nb[hdrlen:]) 41 | n -= hdrlen 42 | } 43 | default: 44 | return 0, nil, nil, errInvalidConnType 45 | } 46 | if cm, err = parseControlMessage(oob[:oobn]); err != nil { 47 | return 0, nil, nil, err 48 | } 49 | if cm != nil { 50 | cm.Src = netAddrToIP4(src) 51 | } 52 | return 53 | } 54 | 55 | // WriteTo writes a payload of the IPv4 datagram, to the destination 56 | // address dst through the endpoint c, copying the payload from b. It 57 | // returns the number of bytes written. The control message cm allows 58 | // the datagram path and the outgoing interface to be specified. 59 | // Currently only Darwin and Linux support this. The cm may be nil if 60 | // control of the outgoing datagram is not required. 61 | func (c *payloadHandler) WriteTo(b []byte, cm *ControlMessage, dst net.Addr) (n int, err error) { 62 | if !c.ok() { 63 | return 0, syscall.EINVAL 64 | } 65 | oob := marshalControlMessage(cm) 66 | if dst == nil { 67 | return 0, errMissingAddress 68 | } 69 | switch c := c.PacketConn.(type) { 70 | case *net.UDPConn: 71 | n, _, err = c.WriteMsgUDP(b, oob, dst.(*net.UDPAddr)) 72 | case *net.IPConn: 73 | n, _, err = c.WriteMsgIP(b, oob, dst.(*net.IPAddr)) 74 | default: 75 | return 0, errInvalidConnType 76 | } 77 | if err != nil { 78 | return 0, err 79 | } 80 | return 81 | } 82 | -------------------------------------------------------------------------------- /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 plan9 windows 6 | 7 | package ipv4 8 | 9 | import ( 10 | "net" 11 | "syscall" 12 | ) 13 | 14 | // ReadFrom reads a payload of the received IPv4 datagram, from the 15 | // endpoint c, copying the payload into b. It returns the number of 16 | // bytes copied into b, the control message cm and the source address 17 | // src of the received datagram. 18 | func (c *payloadHandler) ReadFrom(b []byte) (n int, cm *ControlMessage, src net.Addr, err error) { 19 | if !c.ok() { 20 | return 0, nil, nil, syscall.EINVAL 21 | } 22 | if n, src, err = c.PacketConn.ReadFrom(b); err != nil { 23 | return 0, nil, nil, err 24 | } 25 | return 26 | } 27 | 28 | // WriteTo writes a payload of the IPv4 datagram, to the destination 29 | // address dst through the endpoint c, copying the payload from b. It 30 | // returns the number of bytes written. The control message cm allows 31 | // the datagram path and the outgoing interface to be specified. 32 | // Currently only Darwin and Linux support this. The cm may be nil if 33 | // control of the outgoing datagram is not required. 34 | func (c *payloadHandler) WriteTo(b []byte, cm *ControlMessage, dst net.Addr) (n int, err error) { 35 | if !c.ok() { 36 | return 0, syscall.EINVAL 37 | } 38 | if dst == nil { 39 | return 0, errMissingAddress 40 | } 41 | return c.PacketConn.WriteTo(b, dst) 42 | } 43 | -------------------------------------------------------------------------------- /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 | // Sticky socket options 8 | const ( 9 | ssoTOS = iota // header field for unicast packet 10 | ssoTTL // header field for unicast packet 11 | ssoMulticastTTL // header field for multicast packet 12 | ssoMulticastInterface // outbound interface for multicast packet 13 | ssoMulticastLoopback // loopback for multicast packet 14 | ssoReceiveTTL // header field on received packet 15 | ssoReceiveDst // header field on received packet 16 | ssoReceiveInterface // inbound interface on received packet 17 | ssoPacketInfo // incbound or outbound packet path 18 | ssoHeaderPrepend // ipv4 header prepend 19 | ssoStripHeader // strip ipv4 header 20 | ssoICMPFilter // icmp filter 21 | ssoJoinGroup // any-source multicast 22 | ssoLeaveGroup // any-source multicast 23 | ssoJoinSourceGroup // source-specific multicast 24 | ssoLeaveSourceGroup // source-specific multicast 25 | ssoBlockSourceGroup // any-source or source-specific multicast 26 | ssoUnblockSourceGroup // any-source or source-specific multicast 27 | ssoMax 28 | ) 29 | 30 | // Sticky socket option value types 31 | const ( 32 | ssoTypeByte = iota + 1 33 | ssoTypeInt 34 | ssoTypeInterface 35 | ssoTypeICMPFilter 36 | ssoTypeIPMreq 37 | ssoTypeIPMreqn 38 | ssoTypeGroupReq 39 | ssoTypeGroupSourceReq 40 | ) 41 | 42 | // A sockOpt represents a binding for sticky socket option. 43 | type sockOpt struct { 44 | name int // option name, must be equal or greater than 1 45 | typ int // option value type, must be equal or greater than 1 46 | } 47 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/ipv4/sockopt_asmreq.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 darwin dragonfly freebsd netbsd openbsd solaris windows 6 | 7 | package ipv4 8 | 9 | import "net" 10 | 11 | func setIPMreqInterface(mreq *ipMreq, ifi *net.Interface) error { 12 | if ifi == nil { 13 | return nil 14 | } 15 | ifat, err := ifi.Addrs() 16 | if err != nil { 17 | return err 18 | } 19 | for _, ifa := range ifat { 20 | switch ifa := ifa.(type) { 21 | case *net.IPAddr: 22 | if ip := ifa.IP.To4(); ip != nil { 23 | copy(mreq.Interface[:], ip) 24 | return nil 25 | } 26 | case *net.IPNet: 27 | if ip := ifa.IP.To4(); ip != nil { 28 | copy(mreq.Interface[:], ip) 29 | return nil 30 | } 31 | } 32 | } 33 | return errNoSuchInterface 34 | } 35 | 36 | func netIP4ToInterface(ip net.IP) (*net.Interface, error) { 37 | ift, err := net.Interfaces() 38 | if err != nil { 39 | return nil, err 40 | } 41 | for _, ifi := range ift { 42 | ifat, err := ifi.Addrs() 43 | if err != nil { 44 | return nil, err 45 | } 46 | for _, ifa := range ifat { 47 | switch ifa := ifa.(type) { 48 | case *net.IPAddr: 49 | if ip.Equal(ifa.IP) { 50 | return &ifi, nil 51 | } 52 | case *net.IPNet: 53 | if ip.Equal(ifa.IP) { 54 | return &ifi, nil 55 | } 56 | } 57 | } 58 | } 59 | return nil, errNoSuchInterface 60 | } 61 | 62 | func netInterfaceToIP4(ifi *net.Interface) (net.IP, error) { 63 | if ifi == nil { 64 | return net.IPv4zero.To4(), nil 65 | } 66 | ifat, err := ifi.Addrs() 67 | if err != nil { 68 | return nil, err 69 | } 70 | for _, ifa := range ifat { 71 | switch ifa := ifa.(type) { 72 | case *net.IPAddr: 73 | if ip := ifa.IP.To4(); ip != nil { 74 | return ip, nil 75 | } 76 | case *net.IPNet: 77 | if ip := ifa.IP.To4(); ip != nil { 78 | return ip, nil 79 | } 80 | } 81 | } 82 | return nil, errNoSuchInterface 83 | } 84 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/ipv4/sockopt_asmreq_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 darwin dragonfly freebsd netbsd openbsd solaris windows 6 | 7 | package ipv4 8 | 9 | import ( 10 | "net" 11 | "os" 12 | "unsafe" 13 | 14 | "golang.org/x/net/internal/iana" 15 | ) 16 | 17 | func setsockoptIPMreq(s uintptr, name int, ifi *net.Interface, grp net.IP) error { 18 | mreq := ipMreq{Multiaddr: [4]byte{grp[0], grp[1], grp[2], grp[3]}} 19 | if err := setIPMreqInterface(&mreq, ifi); err != nil { 20 | return err 21 | } 22 | return os.NewSyscallError("setsockopt", setsockopt(s, iana.ProtocolIP, name, unsafe.Pointer(&mreq), sizeofIPMreq)) 23 | } 24 | 25 | func getsockoptInterface(s uintptr, name int) (*net.Interface, error) { 26 | var b [4]byte 27 | l := uint32(4) 28 | if err := getsockopt(s, iana.ProtocolIP, name, unsafe.Pointer(&b[0]), &l); err != nil { 29 | return nil, os.NewSyscallError("getsockopt", err) 30 | } 31 | ifi, err := netIP4ToInterface(net.IPv4(b[0], b[1], b[2], b[3])) 32 | if err != nil { 33 | return nil, err 34 | } 35 | return ifi, nil 36 | } 37 | 38 | func setsockoptInterface(s uintptr, name int, ifi *net.Interface) error { 39 | ip, err := netInterfaceToIP4(ifi) 40 | if err != nil { 41 | return err 42 | } 43 | var b [4]byte 44 | copy(b[:], ip) 45 | return os.NewSyscallError("setsockopt", setsockopt(s, iana.ProtocolIP, name, unsafe.Pointer(&b[0]), uint32(4))) 46 | } 47 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/ipv4/sockopt_asmreq_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 !darwin,!dragonfly,!freebsd,!netbsd,!openbsd,!solaris,!windows 6 | 7 | package ipv4 8 | 9 | import "net" 10 | 11 | func setsockoptIPMreq(s uintptr, name int, ifi *net.Interface, grp net.IP) error { 12 | return errOpNoSupport 13 | } 14 | 15 | func getsockoptInterface(s uintptr, name int) (*net.Interface, error) { 16 | return nil, errOpNoSupport 17 | } 18 | 19 | func setsockoptInterface(s uintptr, name int, ifi *net.Interface) error { 20 | return errOpNoSupport 21 | } 22 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/ipv4/sockopt_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 "net" 10 | 11 | func getsockoptIPMreqn(s uintptr, name int) (*net.Interface, error) { 12 | return nil, errOpNoSupport 13 | } 14 | 15 | func setsockoptIPMreqn(s uintptr, name int, ifi *net.Interface, grp net.IP) error { 16 | return errOpNoSupport 17 | } 18 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/ipv4/sockopt_asmreqn_unix.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 | "os" 12 | "unsafe" 13 | 14 | "golang.org/x/net/internal/iana" 15 | ) 16 | 17 | func getsockoptIPMreqn(s uintptr, name int) (*net.Interface, error) { 18 | var mreqn ipMreqn 19 | l := uint32(sizeofIPMreqn) 20 | if err := getsockopt(s, iana.ProtocolIP, name, unsafe.Pointer(&mreqn), &l); err != nil { 21 | return nil, os.NewSyscallError("getsockopt", err) 22 | } 23 | if mreqn.Ifindex == 0 { 24 | return nil, nil 25 | } 26 | ifi, err := net.InterfaceByIndex(int(mreqn.Ifindex)) 27 | if err != nil { 28 | return nil, err 29 | } 30 | return ifi, nil 31 | } 32 | 33 | func setsockoptIPMreqn(s uintptr, name int, ifi *net.Interface, grp net.IP) error { 34 | var mreqn ipMreqn 35 | if ifi != nil { 36 | mreqn.Ifindex = int32(ifi.Index) 37 | } 38 | if grp != nil { 39 | mreqn.Multiaddr = [4]byte{grp[0], grp[1], grp[2], grp[3]} 40 | } 41 | return os.NewSyscallError("setsockopt", setsockopt(s, iana.ProtocolIP, name, unsafe.Pointer(&mreqn), sizeofIPMreqn)) 42 | } 43 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/ipv4/sockopt_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 "net" 10 | 11 | func setsockoptGroupReq(s uintptr, name int, ifi *net.Interface, grp net.IP) error { 12 | return errOpNoSupport 13 | } 14 | 15 | func setsockoptGroupSourceReq(s uintptr, name int, ifi *net.Interface, grp, src net.IP) error { 16 | return errOpNoSupport 17 | } 18 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/ipv4/sockopt_ssmreq_unix.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 | "os" 12 | "unsafe" 13 | 14 | "golang.org/x/net/internal/iana" 15 | ) 16 | 17 | var freebsd32o64 bool 18 | 19 | func setsockoptGroupReq(s uintptr, name int, ifi *net.Interface, grp net.IP) error { 20 | var gr groupReq 21 | if ifi != nil { 22 | gr.Interface = uint32(ifi.Index) 23 | } 24 | gr.setGroup(grp) 25 | var p unsafe.Pointer 26 | var l uint32 27 | if freebsd32o64 { 28 | var d [sizeofGroupReq + 4]byte 29 | s := (*[sizeofGroupReq]byte)(unsafe.Pointer(&gr)) 30 | copy(d[:4], s[:4]) 31 | copy(d[8:], s[4:]) 32 | p = unsafe.Pointer(&d[0]) 33 | l = sizeofGroupReq + 4 34 | } else { 35 | p = unsafe.Pointer(&gr) 36 | l = sizeofGroupReq 37 | } 38 | return os.NewSyscallError("setsockopt", setsockopt(s, iana.ProtocolIP, name, p, l)) 39 | } 40 | 41 | func setsockoptGroupSourceReq(s uintptr, name int, ifi *net.Interface, grp, src net.IP) error { 42 | var gsr groupSourceReq 43 | if ifi != nil { 44 | gsr.Interface = uint32(ifi.Index) 45 | } 46 | gsr.setSourceGroup(grp, src) 47 | var p unsafe.Pointer 48 | var l uint32 49 | if freebsd32o64 { 50 | var d [sizeofGroupSourceReq + 4]byte 51 | s := (*[sizeofGroupSourceReq]byte)(unsafe.Pointer(&gsr)) 52 | copy(d[:4], s[:4]) 53 | copy(d[8:], s[4:]) 54 | p = unsafe.Pointer(&d[0]) 55 | l = sizeofGroupSourceReq + 4 56 | } else { 57 | p = unsafe.Pointer(&gsr) 58 | l = sizeofGroupSourceReq 59 | } 60 | return os.NewSyscallError("setsockopt", setsockopt(s, iana.ProtocolIP, name, p, l)) 61 | } 62 | -------------------------------------------------------------------------------- /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 nacl plan9 6 | 7 | package ipv4 8 | 9 | func setInt(s uintptr, opt *sockOpt, v int) error { 10 | return errOpNoSupport 11 | } 12 | -------------------------------------------------------------------------------- /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 dragonfly netbsd 6 | 7 | package ipv4 8 | 9 | import ( 10 | "net" 11 | "syscall" 12 | ) 13 | 14 | var ( 15 | ctlOpts = [ctlMax]ctlOpt{ 16 | ctlTTL: {sysIP_RECVTTL, 1, marshalTTL, parseTTL}, 17 | ctlDst: {sysIP_RECVDSTADDR, net.IPv4len, marshalDst, parseDst}, 18 | ctlInterface: {sysIP_RECVIF, syscall.SizeofSockaddrDatalink, marshalInterface, parseInterface}, 19 | } 20 | 21 | sockOpts = [ssoMax]sockOpt{ 22 | ssoTOS: {sysIP_TOS, ssoTypeInt}, 23 | ssoTTL: {sysIP_TTL, ssoTypeInt}, 24 | ssoMulticastTTL: {sysIP_MULTICAST_TTL, ssoTypeByte}, 25 | ssoMulticastInterface: {sysIP_MULTICAST_IF, ssoTypeInterface}, 26 | ssoMulticastLoopback: {sysIP_MULTICAST_LOOP, ssoTypeInt}, 27 | ssoReceiveTTL: {sysIP_RECVTTL, ssoTypeInt}, 28 | ssoReceiveDst: {sysIP_RECVDSTADDR, ssoTypeInt}, 29 | ssoReceiveInterface: {sysIP_RECVIF, ssoTypeInt}, 30 | ssoHeaderPrepend: {sysIP_HDRINCL, ssoTypeInt}, 31 | ssoJoinGroup: {sysIP_ADD_MEMBERSHIP, ssoTypeIPMreq}, 32 | ssoLeaveGroup: {sysIP_DROP_MEMBERSHIP, ssoTypeIPMreq}, 33 | } 34 | ) 35 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/ipv4/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 ipv4 6 | 7 | import ( 8 | "net" 9 | "runtime" 10 | "strings" 11 | "syscall" 12 | "unsafe" 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 = [ssoMax]sockOpt{ 23 | ssoTOS: {sysIP_TOS, ssoTypeInt}, 24 | ssoTTL: {sysIP_TTL, ssoTypeInt}, 25 | ssoMulticastTTL: {sysIP_MULTICAST_TTL, ssoTypeByte}, 26 | ssoMulticastInterface: {sysIP_MULTICAST_IF, ssoTypeInterface}, 27 | ssoMulticastLoopback: {sysIP_MULTICAST_LOOP, ssoTypeInt}, 28 | ssoReceiveTTL: {sysIP_RECVTTL, ssoTypeInt}, 29 | ssoReceiveDst: {sysIP_RECVDSTADDR, ssoTypeInt}, 30 | ssoReceiveInterface: {sysIP_RECVIF, ssoTypeInt}, 31 | ssoHeaderPrepend: {sysIP_HDRINCL, ssoTypeInt}, 32 | ssoJoinGroup: {sysMCAST_JOIN_GROUP, ssoTypeGroupReq}, 33 | ssoLeaveGroup: {sysMCAST_LEAVE_GROUP, ssoTypeGroupReq}, 34 | ssoJoinSourceGroup: {sysMCAST_JOIN_SOURCE_GROUP, ssoTypeGroupSourceReq}, 35 | ssoLeaveSourceGroup: {sysMCAST_LEAVE_SOURCE_GROUP, ssoTypeGroupSourceReq}, 36 | ssoBlockSourceGroup: {sysMCAST_BLOCK_SOURCE, ssoTypeGroupSourceReq}, 37 | ssoUnblockSourceGroup: {sysMCAST_UNBLOCK_SOURCE, ssoTypeGroupSourceReq}, 38 | } 39 | ) 40 | 41 | func init() { 42 | freebsdVersion, _ = syscall.SysctlUint32("kern.osreldate") 43 | if freebsdVersion >= 1000000 { 44 | sockOpts[ssoMulticastInterface].typ = ssoTypeIPMreqn 45 | } 46 | if runtime.GOOS == "freebsd" && runtime.GOARCH == "386" { 47 | archs, _ := syscall.Sysctl("kern.supported_archs") 48 | for _, s := range strings.Fields(archs) { 49 | if s == "amd64" { 50 | freebsd32o64 = true 51 | break 52 | } 53 | } 54 | } 55 | } 56 | 57 | func (gr *groupReq) setGroup(grp net.IP) { 58 | sa := (*sockaddrInet)(unsafe.Pointer(&gr.Group)) 59 | sa.Len = sizeofSockaddrInet 60 | sa.Family = syscall.AF_INET 61 | copy(sa.Addr[:], grp) 62 | } 63 | 64 | func (gsr *groupSourceReq) setSourceGroup(grp, src net.IP) { 65 | sa := (*sockaddrInet)(unsafe.Pointer(&gsr.Group)) 66 | sa.Len = sizeofSockaddrInet 67 | sa.Family = syscall.AF_INET 68 | copy(sa.Addr[:], grp) 69 | sa = (*sockaddrInet)(unsafe.Pointer(&gsr.Source)) 70 | sa.Len = sizeofSockaddrInet 71 | sa.Family = syscall.AF_INET 72 | copy(sa.Addr[:], src) 73 | } 74 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/ipv4/sys_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 | import ( 8 | "net" 9 | "syscall" 10 | "unsafe" 11 | ) 12 | 13 | var ( 14 | ctlOpts = [ctlMax]ctlOpt{ 15 | ctlTTL: {sysIP_TTL, 1, marshalTTL, parseTTL}, 16 | ctlPacketInfo: {sysIP_PKTINFO, sizeofInetPktinfo, marshalPacketInfo, parsePacketInfo}, 17 | } 18 | 19 | sockOpts = [ssoMax]sockOpt{ 20 | ssoTOS: {sysIP_TOS, ssoTypeInt}, 21 | ssoTTL: {sysIP_TTL, ssoTypeInt}, 22 | ssoMulticastTTL: {sysIP_MULTICAST_TTL, ssoTypeInt}, 23 | ssoMulticastInterface: {sysIP_MULTICAST_IF, ssoTypeIPMreqn}, 24 | ssoMulticastLoopback: {sysIP_MULTICAST_LOOP, ssoTypeInt}, 25 | ssoReceiveTTL: {sysIP_RECVTTL, ssoTypeInt}, 26 | ssoPacketInfo: {sysIP_PKTINFO, ssoTypeInt}, 27 | ssoHeaderPrepend: {sysIP_HDRINCL, ssoTypeInt}, 28 | ssoICMPFilter: {sysICMP_FILTER, ssoTypeICMPFilter}, 29 | ssoJoinGroup: {sysMCAST_JOIN_GROUP, ssoTypeGroupReq}, 30 | ssoLeaveGroup: {sysMCAST_LEAVE_GROUP, ssoTypeGroupReq}, 31 | ssoJoinSourceGroup: {sysMCAST_JOIN_SOURCE_GROUP, ssoTypeGroupSourceReq}, 32 | ssoLeaveSourceGroup: {sysMCAST_LEAVE_SOURCE_GROUP, ssoTypeGroupSourceReq}, 33 | ssoBlockSourceGroup: {sysMCAST_BLOCK_SOURCE, ssoTypeGroupSourceReq}, 34 | ssoUnblockSourceGroup: {sysMCAST_UNBLOCK_SOURCE, ssoTypeGroupSourceReq}, 35 | } 36 | ) 37 | 38 | func (pi *inetPktinfo) setIfindex(i int) { 39 | pi.Ifindex = int32(i) 40 | } 41 | 42 | func (gr *groupReq) setGroup(grp net.IP) { 43 | sa := (*sockaddrInet)(unsafe.Pointer(&gr.Group)) 44 | sa.Family = syscall.AF_INET 45 | copy(sa.Addr[:], grp) 46 | } 47 | 48 | func (gsr *groupSourceReq) setSourceGroup(grp, src net.IP) { 49 | sa := (*sockaddrInet)(unsafe.Pointer(&gsr.Group)) 50 | sa.Family = syscall.AF_INET 51 | copy(sa.Addr[:], grp) 52 | sa = (*sockaddrInet)(unsafe.Pointer(&gsr.Source)) 53 | sa.Family = syscall.AF_INET 54 | copy(sa.Addr[:], src) 55 | } 56 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/ipv4/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 | // +build go1.2 6 | 7 | TEXT ·socketcall(SB),4,$0-36 8 | JMP syscall·socketcall(SB) 9 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/ipv4/sys_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 | package ipv4 6 | 7 | import ( 8 | "net" 9 | "syscall" 10 | ) 11 | 12 | var ( 13 | ctlOpts = [ctlMax]ctlOpt{ 14 | ctlTTL: {sysIP_RECVTTL, 1, marshalTTL, parseTTL}, 15 | ctlDst: {sysIP_RECVDSTADDR, net.IPv4len, marshalDst, parseDst}, 16 | ctlInterface: {sysIP_RECVIF, syscall.SizeofSockaddrDatalink, marshalInterface, parseInterface}, 17 | } 18 | 19 | sockOpts = [ssoMax]sockOpt{ 20 | ssoTOS: {sysIP_TOS, ssoTypeInt}, 21 | ssoTTL: {sysIP_TTL, ssoTypeInt}, 22 | ssoMulticastTTL: {sysIP_MULTICAST_TTL, ssoTypeByte}, 23 | ssoMulticastInterface: {sysIP_MULTICAST_IF, ssoTypeInterface}, 24 | ssoMulticastLoopback: {sysIP_MULTICAST_LOOP, ssoTypeByte}, 25 | ssoReceiveTTL: {sysIP_RECVTTL, ssoTypeInt}, 26 | ssoReceiveDst: {sysIP_RECVDSTADDR, ssoTypeInt}, 27 | ssoReceiveInterface: {sysIP_RECVIF, ssoTypeInt}, 28 | ssoHeaderPrepend: {sysIP_HDRINCL, ssoTypeInt}, 29 | ssoJoinGroup: {sysIP_ADD_MEMBERSHIP, ssoTypeIPMreq}, 30 | ssoLeaveGroup: {sysIP_DROP_MEMBERSHIP, ssoTypeIPMreq}, 31 | } 32 | ) 33 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/ipv4/sys_solaris.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 ipv4 6 | 7 | import ( 8 | "net" 9 | "syscall" 10 | "unsafe" 11 | ) 12 | 13 | var ( 14 | ctlOpts = [ctlMax]ctlOpt{ 15 | ctlTTL: {sysIP_RECVTTL, 4, marshalTTL, parseTTL}, 16 | ctlPacketInfo: {sysIP_PKTINFO, sizeofInetPktinfo, marshalPacketInfo, parsePacketInfo}, 17 | } 18 | 19 | sockOpts = [ssoMax]sockOpt{ 20 | ssoTOS: {sysIP_TOS, ssoTypeInt}, 21 | ssoTTL: {sysIP_TTL, ssoTypeInt}, 22 | ssoMulticastTTL: {sysIP_MULTICAST_TTL, ssoTypeByte}, 23 | ssoMulticastInterface: {sysIP_MULTICAST_IF, ssoTypeInterface}, 24 | ssoMulticastLoopback: {sysIP_MULTICAST_LOOP, ssoTypeByte}, 25 | ssoReceiveTTL: {sysIP_RECVTTL, ssoTypeInt}, 26 | ssoPacketInfo: {sysIP_RECVPKTINFO, ssoTypeInt}, 27 | ssoHeaderPrepend: {sysIP_HDRINCL, ssoTypeInt}, 28 | ssoJoinGroup: {sysMCAST_JOIN_GROUP, ssoTypeGroupReq}, 29 | ssoLeaveGroup: {sysMCAST_LEAVE_GROUP, ssoTypeGroupReq}, 30 | ssoJoinSourceGroup: {sysMCAST_JOIN_SOURCE_GROUP, ssoTypeGroupSourceReq}, 31 | ssoLeaveSourceGroup: {sysMCAST_LEAVE_SOURCE_GROUP, ssoTypeGroupSourceReq}, 32 | ssoBlockSourceGroup: {sysMCAST_BLOCK_SOURCE, ssoTypeGroupSourceReq}, 33 | ssoUnblockSourceGroup: {sysMCAST_UNBLOCK_SOURCE, ssoTypeGroupSourceReq}, 34 | } 35 | ) 36 | 37 | func (pi *inetPktinfo) setIfindex(i int) { 38 | pi.Ifindex = uint32(i) 39 | } 40 | 41 | func (gr *groupReq) setGroup(grp net.IP) { 42 | sa := (*sockaddrInet)(unsafe.Pointer(uintptr(unsafe.Pointer(gr)) + 4)) 43 | sa.Family = syscall.AF_INET 44 | copy(sa.Addr[:], grp) 45 | } 46 | 47 | func (gsr *groupSourceReq) setSourceGroup(grp, src net.IP) { 48 | sa := (*sockaddrInet)(unsafe.Pointer(uintptr(unsafe.Pointer(gsr)) + 4)) 49 | sa.Family = syscall.AF_INET 50 | copy(sa.Addr[:], grp) 51 | sa = (*sockaddrInet)(unsafe.Pointer(uintptr(unsafe.Pointer(gsr)) + 260)) 52 | sa.Family = syscall.AF_INET 53 | copy(sa.Addr[:], src) 54 | } 55 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/ipv4/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 | -------------------------------------------------------------------------------- /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 nacl plan9 6 | 7 | package ipv4 8 | 9 | var ( 10 | ctlOpts = [ctlMax]ctlOpt{} 11 | 12 | sockOpts = [ssoMax]sockOpt{} 13 | ) 14 | -------------------------------------------------------------------------------- /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 | const ( 8 | // See ws2tcpip.h. 9 | sysIP_OPTIONS = 0x1 10 | sysIP_HDRINCL = 0x2 11 | sysIP_TOS = 0x3 12 | sysIP_TTL = 0x4 13 | sysIP_MULTICAST_IF = 0x9 14 | sysIP_MULTICAST_TTL = 0xa 15 | sysIP_MULTICAST_LOOP = 0xb 16 | sysIP_ADD_MEMBERSHIP = 0xc 17 | sysIP_DROP_MEMBERSHIP = 0xd 18 | sysIP_DONTFRAGMENT = 0xe 19 | sysIP_ADD_SOURCE_MEMBERSHIP = 0xf 20 | sysIP_DROP_SOURCE_MEMBERSHIP = 0x10 21 | sysIP_PKTINFO = 0x13 22 | 23 | sizeofInetPktinfo = 0x8 24 | sizeofIPMreq = 0x8 25 | sizeofIPMreqSource = 0xc 26 | ) 27 | 28 | type inetPktinfo struct { 29 | Addr [4]byte 30 | Ifindex int32 31 | } 32 | 33 | type ipMreq struct { 34 | Multiaddr [4]byte 35 | Interface [4]byte 36 | } 37 | 38 | type ipMreqSource struct { 39 | Multiaddr [4]byte 40 | Sourceaddr [4]byte 41 | Interface [4]byte 42 | } 43 | 44 | // See http://msdn.microsoft.com/en-us/library/windows/desktop/ms738586(v=vs.85).aspx 45 | var ( 46 | ctlOpts = [ctlMax]ctlOpt{} 47 | 48 | sockOpts = [ssoMax]sockOpt{ 49 | ssoTOS: {sysIP_TOS, ssoTypeInt}, 50 | ssoTTL: {sysIP_TTL, ssoTypeInt}, 51 | ssoMulticastTTL: {sysIP_MULTICAST_TTL, ssoTypeInt}, 52 | ssoMulticastInterface: {sysIP_MULTICAST_IF, ssoTypeInterface}, 53 | ssoMulticastLoopback: {sysIP_MULTICAST_LOOP, ssoTypeInt}, 54 | ssoJoinGroup: {sysIP_ADD_MEMBERSHIP, ssoTypeIPMreq}, 55 | ssoLeaveGroup: {sysIP_DROP_MEMBERSHIP, ssoTypeIPMreq}, 56 | } 57 | ) 58 | 59 | func (pi *inetPktinfo) setIfindex(i int) { 60 | pi.Ifindex = int32(i) 61 | } 62 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/ipv4/syscall_linux_386.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 | "syscall" 9 | "unsafe" 10 | ) 11 | 12 | const ( 13 | sysGETSOCKOPT = 0xf 14 | sysSETSOCKOPT = 0xe 15 | ) 16 | 17 | func socketcall(call int, a0, a1, a2, a3, a4, a5 uintptr) (int, syscall.Errno) 18 | 19 | func getsockopt(s uintptr, level, name int, v unsafe.Pointer, l *uint32) error { 20 | if _, errno := socketcall(sysGETSOCKOPT, s, uintptr(level), uintptr(name), uintptr(v), uintptr(unsafe.Pointer(l)), 0); errno != 0 { 21 | return error(errno) 22 | } 23 | return nil 24 | } 25 | 26 | func setsockopt(s uintptr, level, name int, v unsafe.Pointer, l uint32) error { 27 | if _, errno := socketcall(sysSETSOCKOPT, s, uintptr(level), uintptr(name), uintptr(v), uintptr(l), 0); errno != 0 { 28 | return error(errno) 29 | } 30 | return nil 31 | } 32 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/ipv4/syscall_solaris.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 | // +build solaris 6 | 7 | package ipv4 8 | 9 | import ( 10 | "syscall" 11 | "unsafe" 12 | ) 13 | 14 | //go:cgo_import_dynamic libc___xnet_getsockopt __xnet_getsockopt "libsocket.so" 15 | //go:cgo_import_dynamic libc_setsockopt setsockopt "libsocket.so" 16 | 17 | //go:linkname procGetsockopt libc___xnet_getsockopt 18 | //go:linkname procSetsockopt libc_setsockopt 19 | 20 | var ( 21 | procGetsockopt uintptr 22 | procSetsockopt uintptr 23 | ) 24 | 25 | func sysvicall6(trap, nargs, a1, a2, a3, a4, a5, a6 uintptr) (uintptr, uintptr, syscall.Errno) 26 | 27 | func getsockopt(s uintptr, level, name int, v unsafe.Pointer, l *uint32) error { 28 | _, _, errno := sysvicall6(uintptr(unsafe.Pointer(&procGetsockopt)), 5, s, uintptr(level), uintptr(name), uintptr(v), uintptr(unsafe.Pointer(l)), 0) 29 | if errno != 0 { 30 | return error(errno) 31 | } 32 | return nil 33 | } 34 | 35 | func setsockopt(s uintptr, level, name int, v unsafe.Pointer, l uint32) error { 36 | if _, _, errno := sysvicall6(uintptr(unsafe.Pointer(&procSetsockopt)), 5, s, uintptr(level), uintptr(name), uintptr(v), uintptr(l), 0); errno != 0 { 37 | return error(errno) 38 | } 39 | return nil 40 | } 41 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/ipv4/syscall_unix.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 dragonfly freebsd linux,!386 netbsd openbsd 6 | 7 | package ipv4 8 | 9 | import ( 10 | "syscall" 11 | "unsafe" 12 | ) 13 | 14 | func getsockopt(s uintptr, level, name int, v unsafe.Pointer, l *uint32) error { 15 | if _, _, errno := syscall.Syscall6(syscall.SYS_GETSOCKOPT, s, uintptr(level), uintptr(name), uintptr(v), uintptr(unsafe.Pointer(l)), 0); errno != 0 { 16 | return error(errno) 17 | } 18 | return nil 19 | } 20 | 21 | func setsockopt(s uintptr, level, name int, v unsafe.Pointer, l uint32) error { 22 | if _, _, errno := syscall.Syscall6(syscall.SYS_SETSOCKOPT, s, uintptr(level), uintptr(name), uintptr(v), uintptr(l), 0); errno != 0 { 23 | return error(errno) 24 | } 25 | return nil 26 | } 27 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/ipv4/syscall_windows.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 ipv4 6 | 7 | import ( 8 | "syscall" 9 | "unsafe" 10 | ) 11 | 12 | func getsockopt(s uintptr, level, name int, v unsafe.Pointer, l *uint32) error { 13 | return syscall.Getsockopt(syscall.Handle(s), int32(level), int32(name), (*byte)(v), (*int32)(unsafe.Pointer(l))) 14 | } 15 | 16 | func setsockopt(s uintptr, level, name int, v unsafe.Pointer, l uint32) error { 17 | return syscall.Setsockopt(syscall.Handle(s), int32(level), int32(name), (*byte)(v), int32(l)) 18 | } 19 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/ipv4/zsys_darwin.go: -------------------------------------------------------------------------------- 1 | // Created by cgo -godefs - DO NOT EDIT 2 | // cgo -godefs defs_darwin.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_STRIPHDR = 0x17 17 | sysIP_RECVTTL = 0x18 18 | sysIP_BOUND_IF = 0x19 19 | sysIP_PKTINFO = 0x1a 20 | sysIP_RECVPKTINFO = 0x1a 21 | 22 | sysIP_MULTICAST_IF = 0x9 23 | sysIP_MULTICAST_TTL = 0xa 24 | sysIP_MULTICAST_LOOP = 0xb 25 | sysIP_ADD_MEMBERSHIP = 0xc 26 | sysIP_DROP_MEMBERSHIP = 0xd 27 | sysIP_MULTICAST_VIF = 0xe 28 | sysIP_MULTICAST_IFINDEX = 0x42 29 | sysIP_ADD_SOURCE_MEMBERSHIP = 0x46 30 | sysIP_DROP_SOURCE_MEMBERSHIP = 0x47 31 | sysIP_BLOCK_SOURCE = 0x48 32 | sysIP_UNBLOCK_SOURCE = 0x49 33 | sysMCAST_JOIN_GROUP = 0x50 34 | sysMCAST_LEAVE_GROUP = 0x51 35 | sysMCAST_JOIN_SOURCE_GROUP = 0x52 36 | sysMCAST_LEAVE_SOURCE_GROUP = 0x53 37 | sysMCAST_BLOCK_SOURCE = 0x54 38 | sysMCAST_UNBLOCK_SOURCE = 0x55 39 | 40 | sizeofSockaddrStorage = 0x80 41 | sizeofSockaddrInet = 0x10 42 | sizeofInetPktinfo = 0xc 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 inetPktinfo struct { 68 | Ifindex uint32 69 | Spec_dst [4]byte /* in_addr */ 70 | Addr [4]byte /* in_addr */ 71 | } 72 | 73 | type ipMreq struct { 74 | Multiaddr [4]byte /* in_addr */ 75 | Interface [4]byte /* in_addr */ 76 | } 77 | 78 | type ipMreqn struct { 79 | Multiaddr [4]byte /* in_addr */ 80 | Address [4]byte /* in_addr */ 81 | Ifindex int32 82 | } 83 | 84 | type ipMreqSource struct { 85 | Multiaddr [4]byte /* in_addr */ 86 | Sourceaddr [4]byte /* in_addr */ 87 | Interface [4]byte /* in_addr */ 88 | } 89 | 90 | type groupReq struct { 91 | Interface uint32 92 | Pad_cgo_0 [128]byte 93 | } 94 | 95 | type groupSourceReq struct { 96 | Interface uint32 97 | Pad_cgo_0 [128]byte 98 | Pad_cgo_1 [128]byte 99 | } 100 | -------------------------------------------------------------------------------- /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 | // +build dragonfly 5 | 6 | package ipv4 7 | 8 | const ( 9 | sysIP_OPTIONS = 0x1 10 | sysIP_HDRINCL = 0x2 11 | sysIP_TOS = 0x3 12 | sysIP_TTL = 0x4 13 | sysIP_RECVOPTS = 0x5 14 | sysIP_RECVRETOPTS = 0x6 15 | sysIP_RECVDSTADDR = 0x7 16 | sysIP_RETOPTS = 0x8 17 | sysIP_RECVIF = 0x14 18 | sysIP_RECVTTL = 0x41 19 | 20 | sysIP_MULTICAST_IF = 0x9 21 | sysIP_MULTICAST_TTL = 0xa 22 | sysIP_MULTICAST_LOOP = 0xb 23 | sysIP_MULTICAST_VIF = 0xe 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/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/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/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/sys/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/sys/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/sys/unix/asm.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 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | TEXT ·use(SB),NOSPLIT,$0 10 | RET 11 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_darwin_386.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 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 !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for 386, Darwin 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-28 17 | JMP syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-40 20 | JMP syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-52 23 | JMP syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28 26 | JMP syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 29 | JMP syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_darwin_amd64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 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 !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for AMD64, Darwin 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-56 17 | JMP syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 20 | JMP syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-104 23 | JMP syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 26 | JMP syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 29 | JMP syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_darwin_arm.s: -------------------------------------------------------------------------------- 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 | // +build !gccgo 6 | // +build arm,darwin 7 | 8 | #include "textflag.h" 9 | 10 | // 11 | // System call support for ARM, Darwin 12 | // 13 | 14 | // Just jump to package syscall's implementation for all these functions. 15 | // The runtime may know about them. 16 | 17 | TEXT ·Syscall(SB),NOSPLIT,$0-28 18 | B syscall·Syscall(SB) 19 | 20 | TEXT ·Syscall6(SB),NOSPLIT,$0-40 21 | B syscall·Syscall6(SB) 22 | 23 | TEXT ·Syscall9(SB),NOSPLIT,$0-52 24 | B syscall·Syscall9(SB) 25 | 26 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28 27 | B syscall·RawSyscall(SB) 28 | 29 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 30 | B syscall·RawSyscall6(SB) 31 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_darwin_arm64.s: -------------------------------------------------------------------------------- 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 | // +build !gccgo 6 | // +build arm64,darwin 7 | 8 | #include "textflag.h" 9 | 10 | // 11 | // System call support for AMD64, Darwin 12 | // 13 | 14 | // Just jump to package syscall's implementation for all these functions. 15 | // The runtime may know about them. 16 | 17 | TEXT ·Syscall(SB),NOSPLIT,$0-56 18 | B syscall·Syscall(SB) 19 | 20 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 21 | B syscall·Syscall6(SB) 22 | 23 | TEXT ·Syscall9(SB),NOSPLIT,$0-104 24 | B syscall·Syscall9(SB) 25 | 26 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 27 | B syscall·RawSyscall(SB) 28 | 29 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 30 | B syscall·RawSyscall6(SB) 31 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_dragonfly_amd64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 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 !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for AMD64, DragonFly 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-64 17 | JMP syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-88 20 | JMP syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-112 23 | JMP syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-64 26 | JMP syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-88 29 | JMP syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_freebsd_386.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 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 !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for 386, FreeBSD 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-28 17 | JMP syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-40 20 | JMP syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-52 23 | JMP syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28 26 | JMP syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 29 | JMP syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_freebsd_amd64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 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 !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for AMD64, FreeBSD 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-56 17 | JMP syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 20 | JMP syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-104 23 | JMP syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 26 | JMP syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 29 | JMP syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_freebsd_arm.s: -------------------------------------------------------------------------------- 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 !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for ARM, FreeBSD 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-28 17 | B syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-40 20 | B syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-52 23 | B syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28 26 | B syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 29 | B syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_linux_386.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 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 !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System calls for 386, Linux 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-28 17 | JMP syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-40 20 | JMP syscall·Syscall6(SB) 21 | 22 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28 23 | JMP syscall·RawSyscall(SB) 24 | 25 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 26 | JMP syscall·RawSyscall6(SB) 27 | 28 | TEXT ·socketcall(SB),NOSPLIT,$0-36 29 | JMP syscall·socketcall(SB) 30 | 31 | TEXT ·rawsocketcall(SB),NOSPLIT,$0-36 32 | JMP syscall·rawsocketcall(SB) 33 | 34 | TEXT ·seek(SB),NOSPLIT,$0-28 35 | JMP syscall·seek(SB) 36 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_linux_amd64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 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 !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System calls for AMD64, Linux 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-56 17 | JMP syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 20 | JMP syscall·Syscall6(SB) 21 | 22 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 23 | JMP syscall·RawSyscall(SB) 24 | 25 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 26 | JMP syscall·RawSyscall6(SB) 27 | 28 | TEXT ·gettimeofday(SB),NOSPLIT,$0-16 29 | JMP syscall·gettimeofday(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_linux_arm.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 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 !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System calls for arm, Linux 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-28 17 | B syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-40 20 | B syscall·Syscall6(SB) 21 | 22 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28 23 | B syscall·RawSyscall(SB) 24 | 25 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 26 | B syscall·RawSyscall6(SB) 27 | 28 | TEXT ·seek(SB),NOSPLIT,$0-32 29 | B syscall·seek(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_linux_arm64.s: -------------------------------------------------------------------------------- 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 | // +build linux 6 | // +build arm64 7 | // +build !gccgo 8 | 9 | #include "textflag.h" 10 | 11 | // Just jump to package syscall's implementation for all these functions. 12 | // The runtime may know about them. 13 | 14 | TEXT ·Syscall(SB),NOSPLIT,$0-56 15 | B syscall·Syscall(SB) 16 | 17 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 18 | B syscall·Syscall6(SB) 19 | 20 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 21 | B syscall·RawSyscall(SB) 22 | 23 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 24 | B syscall·RawSyscall6(SB) 25 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_linux_mips64x.s: -------------------------------------------------------------------------------- 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 | // +build linux 6 | // +build mips64 mips64le 7 | // +build !gccgo 8 | 9 | #include "textflag.h" 10 | 11 | // 12 | // System calls for mips64, Linux 13 | // 14 | 15 | // Just jump to package syscall's implementation for all these functions. 16 | // The runtime may know about them. 17 | 18 | TEXT ·Syscall(SB),NOSPLIT,$0-56 19 | JMP syscall·Syscall(SB) 20 | 21 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 22 | JMP syscall·Syscall6(SB) 23 | 24 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 25 | JMP syscall·RawSyscall(SB) 26 | 27 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 28 | JMP syscall·RawSyscall6(SB) 29 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_linux_ppc64x.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 | // +build linux 6 | // +build ppc64 ppc64le 7 | // +build !gccgo 8 | 9 | #include "textflag.h" 10 | 11 | // 12 | // System calls for ppc64, Linux 13 | // 14 | 15 | // Just jump to package syscall's implementation for all these functions. 16 | // The runtime may know about them. 17 | 18 | TEXT ·Syscall(SB),NOSPLIT,$0-56 19 | BR syscall·Syscall(SB) 20 | 21 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 22 | BR syscall·Syscall6(SB) 23 | 24 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 25 | BR syscall·RawSyscall(SB) 26 | 27 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 28 | BR syscall·RawSyscall6(SB) 29 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_linux_s390x.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 | // +build s390x 6 | // +build linux 7 | // +build !gccgo 8 | 9 | #include "textflag.h" 10 | 11 | // 12 | // System calls for s390x, Linux 13 | // 14 | 15 | // Just jump to package syscall's implementation for all these functions. 16 | // The runtime may know about them. 17 | 18 | TEXT ·Syscall(SB),NOSPLIT,$0-56 19 | BR syscall·Syscall(SB) 20 | 21 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 22 | BR syscall·Syscall6(SB) 23 | 24 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 25 | BR syscall·RawSyscall(SB) 26 | 27 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 28 | BR syscall·RawSyscall6(SB) 29 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_netbsd_386.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 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 !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for 386, NetBSD 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-28 17 | JMP syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-40 20 | JMP syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-52 23 | JMP syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28 26 | JMP syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 29 | JMP syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_netbsd_amd64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 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 !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for AMD64, NetBSD 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-56 17 | JMP syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 20 | JMP syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-104 23 | JMP syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 26 | JMP syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 29 | JMP syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_netbsd_arm.s: -------------------------------------------------------------------------------- 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 !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for ARM, NetBSD 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-28 17 | B syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-40 20 | B syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-52 23 | B syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28 26 | B syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 29 | B syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_openbsd_386.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 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 !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for 386, OpenBSD 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-28 17 | JMP syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-40 20 | JMP syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-52 23 | JMP syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28 26 | JMP syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 29 | JMP syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_openbsd_amd64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 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 !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for AMD64, OpenBSD 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-56 17 | JMP syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 20 | JMP syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-104 23 | JMP syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 26 | JMP syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 29 | JMP syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_solaris_amd64.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 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System calls for amd64, Solaris are implemented in runtime/syscall_solaris.go 11 | // 12 | 13 | TEXT ·sysvicall6(SB),NOSPLIT,$0-64 14 | JMP syscall·sysvicall6(SB) 15 | 16 | TEXT ·rawSysvicall6(SB),NOSPLIT,$0-64 17 | JMP syscall·rawSysvicall6(SB) 18 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/bluetooth_linux.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 | // Bluetooth sockets and messages 6 | 7 | package unix 8 | 9 | // Bluetooth Protocols 10 | const ( 11 | BTPROTO_L2CAP = 0 12 | BTPROTO_HCI = 1 13 | BTPROTO_SCO = 2 14 | BTPROTO_RFCOMM = 3 15 | BTPROTO_BNEP = 4 16 | BTPROTO_CMTP = 5 17 | BTPROTO_HIDP = 6 18 | BTPROTO_AVDTP = 7 19 | ) 20 | 21 | const ( 22 | HCI_CHANNEL_RAW = 0 23 | HCI_CHANNEL_USER = 1 24 | HCI_CHANNEL_MONITOR = 2 25 | HCI_CHANNEL_CONTROL = 3 26 | ) 27 | 28 | // Socketoption Level 29 | const ( 30 | SOL_BLUETOOTH = 0x112 31 | SOL_HCI = 0x0 32 | SOL_L2CAP = 0x6 33 | SOL_RFCOMM = 0x12 34 | SOL_SCO = 0x11 35 | ) 36 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/constants.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 | // +build darwin dragonfly freebsd linux netbsd openbsd solaris 6 | 7 | package unix 8 | 9 | const ( 10 | R_OK = 0x4 11 | W_OK = 0x2 12 | X_OK = 0x1 13 | ) 14 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/env_unix.go: -------------------------------------------------------------------------------- 1 | // Copyright 2010 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 dragonfly freebsd linux netbsd openbsd solaris 6 | 7 | // Unix environment variables. 8 | 9 | package unix 10 | 11 | import "syscall" 12 | 13 | func Getenv(key string) (value string, found bool) { 14 | return syscall.Getenv(key) 15 | } 16 | 17 | func Setenv(key, value string) error { 18 | return syscall.Setenv(key, value) 19 | } 20 | 21 | func Clearenv() { 22 | syscall.Clearenv() 23 | } 24 | 25 | func Environ() []string { 26 | return syscall.Environ() 27 | } 28 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/env_unset.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 go1.4 6 | 7 | package unix 8 | 9 | import "syscall" 10 | 11 | func Unsetenv(key string) error { 12 | // This was added in Go 1.4. 13 | return syscall.Unsetenv(key) 14 | } 15 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/flock.go: -------------------------------------------------------------------------------- 1 | // +build linux darwin freebsd openbsd netbsd dragonfly 2 | 3 | // Copyright 2014 The Go Authors. All rights reserved. 4 | // Use of this source code is governed by a BSD-style 5 | // license that can be found in the LICENSE file. 6 | 7 | // +build darwin dragonfly freebsd linux netbsd openbsd 8 | 9 | package unix 10 | 11 | import "unsafe" 12 | 13 | // fcntl64Syscall is usually SYS_FCNTL, but is overridden on 32-bit Linux 14 | // systems by flock_linux_32bit.go to be SYS_FCNTL64. 15 | var fcntl64Syscall uintptr = SYS_FCNTL 16 | 17 | // FcntlFlock performs a fcntl syscall for the F_GETLK, F_SETLK or F_SETLKW command. 18 | func FcntlFlock(fd uintptr, cmd int, lk *Flock_t) error { 19 | _, _, errno := Syscall(fcntl64Syscall, fd, uintptr(cmd), uintptr(unsafe.Pointer(lk))) 20 | if errno == 0 { 21 | return nil 22 | } 23 | return errno 24 | } 25 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/flock_linux_32bit.go: -------------------------------------------------------------------------------- 1 | // +build linux,386 linux,arm 2 | 3 | // Copyright 2014 The Go Authors. All rights reserved. 4 | // Use of this source code is governed by a BSD-style 5 | // license that can be found in the LICENSE file. 6 | 7 | package unix 8 | 9 | func init() { 10 | // On 32-bit Linux systems, the fcntl syscall that matches Go's 11 | // Flock_t type is SYS_FCNTL64, not SYS_FCNTL. 12 | fcntl64Syscall = SYS_FCNTL64 13 | } 14 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/gccgo.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 | // +build gccgo 6 | 7 | package unix 8 | 9 | import "syscall" 10 | 11 | // We can't use the gc-syntax .s files for gccgo. On the plus side 12 | // much of the functionality can be written directly in Go. 13 | 14 | //extern gccgoRealSyscall 15 | func realSyscall(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r, errno uintptr) 16 | 17 | func Syscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.Errno) { 18 | syscall.Entersyscall() 19 | r, errno := realSyscall(trap, a1, a2, a3, 0, 0, 0, 0, 0, 0) 20 | syscall.Exitsyscall() 21 | return r, 0, syscall.Errno(errno) 22 | } 23 | 24 | func Syscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err syscall.Errno) { 25 | syscall.Entersyscall() 26 | r, errno := realSyscall(trap, a1, a2, a3, a4, a5, a6, 0, 0, 0) 27 | syscall.Exitsyscall() 28 | return r, 0, syscall.Errno(errno) 29 | } 30 | 31 | func Syscall9(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) { 32 | syscall.Entersyscall() 33 | r, errno := realSyscall(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9) 34 | syscall.Exitsyscall() 35 | return r, 0, syscall.Errno(errno) 36 | } 37 | 38 | func RawSyscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.Errno) { 39 | r, errno := realSyscall(trap, a1, a2, a3, 0, 0, 0, 0, 0, 0) 40 | return r, 0, syscall.Errno(errno) 41 | } 42 | 43 | func RawSyscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err syscall.Errno) { 44 | r, errno := realSyscall(trap, a1, a2, a3, a4, a5, a6, 0, 0, 0) 45 | return r, 0, syscall.Errno(errno) 46 | } 47 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/gccgo_c.c: -------------------------------------------------------------------------------- 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 | // +build gccgo 6 | 7 | #include 8 | #include 9 | #include 10 | 11 | #define _STRINGIFY2_(x) #x 12 | #define _STRINGIFY_(x) _STRINGIFY2_(x) 13 | #define GOSYM_PREFIX _STRINGIFY_(__USER_LABEL_PREFIX__) 14 | 15 | // Call syscall from C code because the gccgo support for calling from 16 | // Go to C does not support varargs functions. 17 | 18 | struct ret { 19 | uintptr_t r; 20 | uintptr_t err; 21 | }; 22 | 23 | struct ret 24 | gccgoRealSyscall(uintptr_t trap, uintptr_t a1, uintptr_t a2, uintptr_t a3, uintptr_t a4, uintptr_t a5, uintptr_t a6, uintptr_t a7, uintptr_t a8, uintptr_t a9) 25 | { 26 | struct ret r; 27 | 28 | errno = 0; 29 | r.r = syscall(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9); 30 | r.err = errno; 31 | return r; 32 | } 33 | 34 | // Define the use function in C so that it is not inlined. 35 | 36 | extern void use(void *) __asm__ (GOSYM_PREFIX GOPKGPATH ".use") __attribute__((noinline)); 37 | 38 | void 39 | use(void *p __attribute__ ((unused))) 40 | { 41 | } 42 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/gccgo_linux_amd64.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 | // +build gccgo,linux,amd64 6 | 7 | package unix 8 | 9 | import "syscall" 10 | 11 | //extern gettimeofday 12 | func realGettimeofday(*Timeval, *byte) int32 13 | 14 | func gettimeofday(tv *Timeval) (err syscall.Errno) { 15 | r := realGettimeofday(tv, nil) 16 | if r < 0 { 17 | return syscall.GetErrno() 18 | } 19 | return 0 20 | } 21 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/gccgo_linux_sparc64.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 | // +build gccgo,linux,sparc64 6 | 7 | package unix 8 | 9 | import "syscall" 10 | 11 | //extern sysconf 12 | func realSysconf(name int) int64 13 | 14 | func sysconf(name int) (n int64, err syscall.Errno) { 15 | r := realSysconf(name) 16 | if r < 0 { 17 | return 0, syscall.GetErrno() 18 | } 19 | return r, 0 20 | } 21 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/mkpost.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 | // +build ignore 6 | 7 | // mkpost processes the output of cgo -godefs to 8 | // modify the generated types. It is used to clean up 9 | // the sys API in an architecture specific manner. 10 | // 11 | // mkpost is run after cgo -godefs by mkall.sh. 12 | package main 13 | 14 | import ( 15 | "fmt" 16 | "go/format" 17 | "io/ioutil" 18 | "log" 19 | "os" 20 | "regexp" 21 | ) 22 | 23 | func main() { 24 | b, err := ioutil.ReadAll(os.Stdin) 25 | if err != nil { 26 | log.Fatal(err) 27 | } 28 | s := string(b) 29 | 30 | goarch := os.Getenv("GOARCH") 31 | goos := os.Getenv("GOOS") 32 | if goarch == "s390x" && goos == "linux" { 33 | // Export the types of PtraceRegs fields. 34 | re := regexp.MustCompile("ptrace(Psw|Fpregs|Per)") 35 | s = re.ReplaceAllString(s, "Ptrace$1") 36 | 37 | // Replace padding fields inserted by cgo with blank identifiers. 38 | re = regexp.MustCompile("Pad_cgo[A-Za-z0-9_]*") 39 | s = re.ReplaceAllString(s, "_") 40 | 41 | // Replace other unwanted fields with blank identifiers. 42 | re = regexp.MustCompile("X_[A-Za-z0-9_]*") 43 | s = re.ReplaceAllString(s, "_") 44 | 45 | // Replace the control_regs union with a blank identifier for now. 46 | re = regexp.MustCompile("(Control_regs)\\s+\\[0\\]uint64") 47 | s = re.ReplaceAllString(s, "_ [0]uint64") 48 | } 49 | 50 | // gofmt 51 | b, err = format.Source([]byte(s)) 52 | if err != nil { 53 | log.Fatal(err) 54 | } 55 | 56 | // Append this command to the header to show where the new file 57 | // came from. 58 | re := regexp.MustCompile("(cgo -godefs [a-zA-Z0-9_]+\\.go.*)") 59 | b = re.ReplaceAll(b, []byte("$1 | go run mkpost.go")) 60 | 61 | fmt.Printf("%s", b) 62 | } 63 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/mksysnum_darwin.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | # Copyright 2009 The Go Authors. All rights reserved. 3 | # Use of this source code is governed by a BSD-style 4 | # license that can be found in the LICENSE file. 5 | # 6 | # Generate system call table for Darwin from sys/syscall.h 7 | 8 | use strict; 9 | 10 | if($ENV{'GOARCH'} eq "" || $ENV{'GOOS'} eq "") { 11 | print STDERR "GOARCH or GOOS not defined in environment\n"; 12 | exit 1; 13 | } 14 | 15 | my $command = "mksysnum_darwin.pl " . join(' ', @ARGV); 16 | 17 | print <){ 29 | if(/^#define\s+SYS_(\w+)\s+([0-9]+)/){ 30 | my $name = $1; 31 | my $num = $2; 32 | $name =~ y/a-z/A-Z/; 33 | print " SYS_$name = $num;" 34 | } 35 | } 36 | 37 | print <){ 30 | if(/^([0-9]+)\s+STD\s+({ \S+\s+(\w+).*)$/){ 31 | my $num = $1; 32 | my $proto = $2; 33 | my $name = "SYS_$3"; 34 | $name =~ y/a-z/A-Z/; 35 | 36 | # There are multiple entries for enosys and nosys, so comment them out. 37 | if($name =~ /^SYS_E?NOSYS$/){ 38 | $name = "// $name"; 39 | } 40 | if($name eq 'SYS_SYS_EXIT'){ 41 | $name = 'SYS_EXIT'; 42 | } 43 | 44 | print " $name = $num; // $proto\n"; 45 | } 46 | } 47 | 48 | print <){ 30 | if(/^([0-9]+)\s+\S+\s+STD\s+({ \S+\s+(\w+).*)$/){ 31 | my $num = $1; 32 | my $proto = $2; 33 | my $name = "SYS_$3"; 34 | $name =~ y/a-z/A-Z/; 35 | 36 | # There are multiple entries for enosys and nosys, so comment them out. 37 | if($name =~ /^SYS_E?NOSYS$/){ 38 | $name = "// $name"; 39 | } 40 | if($name eq 'SYS_SYS_EXIT'){ 41 | $name = 'SYS_EXIT'; 42 | } 43 | if($name =~ /^SYS_CAP_+/ || $name =~ /^SYS___CAP_+/){ 44 | next 45 | } 46 | 47 | print " $name = $num; // $proto\n"; 48 | 49 | # We keep Capsicum syscall numbers for FreeBSD 50 | # 9-STABLE here because we are not sure whether they 51 | # are mature and stable. 52 | if($num == 513){ 53 | print " SYS_CAP_NEW = 514 // { int cap_new(int fd, uint64_t rights); }\n"; 54 | print " SYS_CAP_GETRIGHTS = 515 // { int cap_getrights(int fd, \\\n"; 55 | print " SYS_CAP_ENTER = 516 // { int cap_enter(void); }\n"; 56 | print " SYS_CAP_GETMODE = 517 // { int cap_getmode(u_int *modep); }\n"; 57 | } 58 | } 59 | } 60 | 61 | print < 999){ 29 | # ignore deprecated syscalls that are no longer implemented 30 | # https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/include/uapi/asm-generic/unistd.h?id=refs/heads/master#n716 31 | return; 32 | } 33 | $name =~ y/a-z/A-Z/; 34 | print " SYS_$name = $num;\n"; 35 | } 36 | 37 | my $prev; 38 | open(GCC, "gcc -E -dD $ARGV[0] |") || die "can't run gcc"; 39 | while(){ 40 | if(/^#define __NR_syscalls\s+/) { 41 | # ignore redefinitions of __NR_syscalls 42 | } 43 | elsif(/^#define __NR_(\w+)\s+([0-9]+)/){ 44 | $prev = $2; 45 | fmt($1, $2); 46 | } 47 | elsif(/^#define __NR3264_(\w+)\s+([0-9]+)/){ 48 | $prev = $2; 49 | fmt($1, $2); 50 | } 51 | elsif(/^#define __NR_(\w+)\s+\(\w+\+\s*([0-9]+)\)/){ 52 | fmt($1, $prev+$2) 53 | } 54 | } 55 | 56 | print <){ 31 | if($line =~ /^(.*)\\$/) { 32 | # Handle continuation 33 | $line = $1; 34 | $_ =~ s/^\s+//; 35 | $line .= $_; 36 | } else { 37 | # New line 38 | $line = $_; 39 | } 40 | next if $line =~ /\\$/; 41 | if($line =~ /^([0-9]+)\s+((STD)|(NOERR))\s+(RUMP\s+)?({\s+\S+\s*\*?\s*\|(\S+)\|(\S*)\|(\w+).*\s+})(\s+(\S+))?$/) { 42 | my $num = $1; 43 | my $proto = $6; 44 | my $compat = $8; 45 | my $name = "$7_$9"; 46 | 47 | $name = "$7_$11" if $11 ne ''; 48 | $name =~ y/a-z/A-Z/; 49 | 50 | if($compat eq '' || $compat eq '30' || $compat eq '50') { 51 | print " $name = $num; // $proto\n"; 52 | } 53 | } 54 | } 55 | 56 | print <){ 30 | if(/^([0-9]+)\s+STD\s+(NOLOCK\s+)?({ \S+\s+\*?(\w+).*)$/){ 31 | my $num = $1; 32 | my $proto = $3; 33 | my $name = $4; 34 | $name =~ y/a-z/A-Z/; 35 | 36 | # There are multiple entries for enosys and nosys, so comment them out. 37 | if($name =~ /^SYS_E?NOSYS$/){ 38 | $name = "// $name"; 39 | } 40 | if($name eq 'SYS_SYS_EXIT'){ 41 | $name = 'SYS_EXIT'; 42 | } 43 | 44 | print " $name = $num; // $proto\n"; 45 | } 46 | } 47 | 48 | print <= 10 { 20 | buf[i] = byte(val%10 + '0') 21 | i-- 22 | val /= 10 23 | } 24 | buf[i] = byte(val + '0') 25 | return string(buf[i:]) 26 | } 27 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_darwin_386.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 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 386,darwin 6 | 7 | package unix 8 | 9 | import ( 10 | "syscall" 11 | "unsafe" 12 | ) 13 | 14 | func Getpagesize() int { return 4096 } 15 | 16 | func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) } 17 | 18 | func NsecToTimespec(nsec int64) (ts Timespec) { 19 | ts.Sec = int32(nsec / 1e9) 20 | ts.Nsec = int32(nsec % 1e9) 21 | return 22 | } 23 | 24 | func NsecToTimeval(nsec int64) (tv Timeval) { 25 | nsec += 999 // round up to microsecond 26 | tv.Usec = int32(nsec % 1e9 / 1e3) 27 | tv.Sec = int32(nsec / 1e9) 28 | return 29 | } 30 | 31 | //sysnb gettimeofday(tp *Timeval) (sec int32, usec int32, err error) 32 | func Gettimeofday(tv *Timeval) (err error) { 33 | // The tv passed to gettimeofday must be non-nil 34 | // but is otherwise unused. The answers come back 35 | // in the two registers. 36 | sec, usec, err := gettimeofday(tv) 37 | tv.Sec = int32(sec) 38 | tv.Usec = int32(usec) 39 | return err 40 | } 41 | 42 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 43 | k.Ident = uint32(fd) 44 | k.Filter = int16(mode) 45 | k.Flags = uint16(flags) 46 | } 47 | 48 | func (iov *Iovec) SetLen(length int) { 49 | iov.Len = uint32(length) 50 | } 51 | 52 | func (msghdr *Msghdr) SetControllen(length int) { 53 | msghdr.Controllen = uint32(length) 54 | } 55 | 56 | func (cmsg *Cmsghdr) SetLen(length int) { 57 | cmsg.Len = uint32(length) 58 | } 59 | 60 | func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) { 61 | var length = uint64(count) 62 | 63 | _, _, e1 := Syscall9(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr(*offset>>32), uintptr(unsafe.Pointer(&length)), 0, 0, 0, 0) 64 | 65 | written = int(length) 66 | 67 | if e1 != 0 { 68 | err = e1 69 | } 70 | return 71 | } 72 | 73 | func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) 74 | 75 | // SYS___SYSCTL is used by syscall_bsd.go for all BSDs, but in modern versions 76 | // of darwin/386 the syscall is called sysctl instead of __sysctl. 77 | const SYS___SYSCTL = SYS_SYSCTL 78 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_darwin_amd64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 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,darwin 6 | 7 | package unix 8 | 9 | import ( 10 | "syscall" 11 | "unsafe" 12 | ) 13 | 14 | //sys Fchmodat(dirfd int, path string, mode uint32, flags int) (err error) 15 | 16 | func Getpagesize() int { return 4096 } 17 | 18 | func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) } 19 | 20 | func NsecToTimespec(nsec int64) (ts Timespec) { 21 | ts.Sec = nsec / 1e9 22 | ts.Nsec = nsec % 1e9 23 | return 24 | } 25 | 26 | func NsecToTimeval(nsec int64) (tv Timeval) { 27 | nsec += 999 // round up to microsecond 28 | tv.Usec = int32(nsec % 1e9 / 1e3) 29 | tv.Sec = int64(nsec / 1e9) 30 | return 31 | } 32 | 33 | //sysnb gettimeofday(tp *Timeval) (sec int64, usec int32, err error) 34 | func Gettimeofday(tv *Timeval) (err error) { 35 | // The tv passed to gettimeofday must be non-nil 36 | // but is otherwise unused. The answers come back 37 | // in the two registers. 38 | sec, usec, err := gettimeofday(tv) 39 | tv.Sec = sec 40 | tv.Usec = usec 41 | return err 42 | } 43 | 44 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 45 | k.Ident = uint64(fd) 46 | k.Filter = int16(mode) 47 | k.Flags = uint16(flags) 48 | } 49 | 50 | func (iov *Iovec) SetLen(length int) { 51 | iov.Len = uint64(length) 52 | } 53 | 54 | func (msghdr *Msghdr) SetControllen(length int) { 55 | msghdr.Controllen = uint32(length) 56 | } 57 | 58 | func (cmsg *Cmsghdr) SetLen(length int) { 59 | cmsg.Len = uint32(length) 60 | } 61 | 62 | func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) { 63 | var length = uint64(count) 64 | 65 | _, _, e1 := Syscall6(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr(unsafe.Pointer(&length)), 0, 0) 66 | 67 | written = int(length) 68 | 69 | if e1 != 0 { 70 | err = e1 71 | } 72 | return 73 | } 74 | 75 | func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) 76 | 77 | // SYS___SYSCTL is used by syscall_bsd.go for all BSDs, but in modern versions 78 | // of darwin/amd64 the syscall is called sysctl instead of __sysctl. 79 | const SYS___SYSCTL = SYS_SYSCTL 80 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_darwin_arm.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 unix 6 | 7 | import ( 8 | "syscall" 9 | "unsafe" 10 | ) 11 | 12 | func Getpagesize() int { return 4096 } 13 | 14 | func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) } 15 | 16 | func NsecToTimespec(nsec int64) (ts Timespec) { 17 | ts.Sec = int32(nsec / 1e9) 18 | ts.Nsec = int32(nsec % 1e9) 19 | return 20 | } 21 | 22 | func NsecToTimeval(nsec int64) (tv Timeval) { 23 | nsec += 999 // round up to microsecond 24 | tv.Usec = int32(nsec % 1e9 / 1e3) 25 | tv.Sec = int32(nsec / 1e9) 26 | return 27 | } 28 | 29 | //sysnb gettimeofday(tp *Timeval) (sec int32, usec int32, err error) 30 | func Gettimeofday(tv *Timeval) (err error) { 31 | // The tv passed to gettimeofday must be non-nil 32 | // but is otherwise unused. The answers come back 33 | // in the two registers. 34 | sec, usec, err := gettimeofday(tv) 35 | tv.Sec = int32(sec) 36 | tv.Usec = int32(usec) 37 | return err 38 | } 39 | 40 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 41 | k.Ident = uint32(fd) 42 | k.Filter = int16(mode) 43 | k.Flags = uint16(flags) 44 | } 45 | 46 | func (iov *Iovec) SetLen(length int) { 47 | iov.Len = uint32(length) 48 | } 49 | 50 | func (msghdr *Msghdr) SetControllen(length int) { 51 | msghdr.Controllen = uint32(length) 52 | } 53 | 54 | func (cmsg *Cmsghdr) SetLen(length int) { 55 | cmsg.Len = uint32(length) 56 | } 57 | 58 | func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) { 59 | var length = uint64(count) 60 | 61 | _, _, e1 := Syscall9(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr(*offset>>32), uintptr(unsafe.Pointer(&length)), 0, 0, 0, 0) 62 | 63 | written = int(length) 64 | 65 | if e1 != 0 { 66 | err = e1 67 | } 68 | return 69 | } 70 | 71 | func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) // sic 72 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_darwin_arm64.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 | // +build arm64,darwin 6 | 7 | package unix 8 | 9 | import ( 10 | "syscall" 11 | "unsafe" 12 | ) 13 | 14 | func Getpagesize() int { return 16384 } 15 | 16 | func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) } 17 | 18 | func NsecToTimespec(nsec int64) (ts Timespec) { 19 | ts.Sec = nsec / 1e9 20 | ts.Nsec = nsec % 1e9 21 | return 22 | } 23 | 24 | func NsecToTimeval(nsec int64) (tv Timeval) { 25 | nsec += 999 // round up to microsecond 26 | tv.Usec = int32(nsec % 1e9 / 1e3) 27 | tv.Sec = int64(nsec / 1e9) 28 | return 29 | } 30 | 31 | //sysnb gettimeofday(tp *Timeval) (sec int64, usec int32, err error) 32 | func Gettimeofday(tv *Timeval) (err error) { 33 | // The tv passed to gettimeofday must be non-nil 34 | // but is otherwise unused. The answers come back 35 | // in the two registers. 36 | sec, usec, err := gettimeofday(tv) 37 | tv.Sec = sec 38 | tv.Usec = usec 39 | return err 40 | } 41 | 42 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 43 | k.Ident = uint64(fd) 44 | k.Filter = int16(mode) 45 | k.Flags = uint16(flags) 46 | } 47 | 48 | func (iov *Iovec) SetLen(length int) { 49 | iov.Len = uint64(length) 50 | } 51 | 52 | func (msghdr *Msghdr) SetControllen(length int) { 53 | msghdr.Controllen = uint32(length) 54 | } 55 | 56 | func (cmsg *Cmsghdr) SetLen(length int) { 57 | cmsg.Len = uint32(length) 58 | } 59 | 60 | func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) { 61 | var length = uint64(count) 62 | 63 | _, _, e1 := Syscall6(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr(unsafe.Pointer(&length)), 0, 0) 64 | 65 | written = int(length) 66 | 67 | if e1 != 0 { 68 | err = e1 69 | } 70 | return 71 | } 72 | 73 | func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) // sic 74 | 75 | // SYS___SYSCTL is used by syscall_bsd.go for all BSDs, but in modern versions 76 | // of darwin/arm64 the syscall is called sysctl instead of __sysctl. 77 | const SYS___SYSCTL = SYS_SYSCTL 78 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_dragonfly_amd64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 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,dragonfly 6 | 7 | package unix 8 | 9 | import ( 10 | "syscall" 11 | "unsafe" 12 | ) 13 | 14 | func Getpagesize() int { return 4096 } 15 | 16 | func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) } 17 | 18 | func NsecToTimespec(nsec int64) (ts Timespec) { 19 | ts.Sec = nsec / 1e9 20 | ts.Nsec = nsec % 1e9 21 | return 22 | } 23 | 24 | func NsecToTimeval(nsec int64) (tv Timeval) { 25 | nsec += 999 // round up to microsecond 26 | tv.Usec = nsec % 1e9 / 1e3 27 | tv.Sec = int64(nsec / 1e9) 28 | return 29 | } 30 | 31 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 32 | k.Ident = uint64(fd) 33 | k.Filter = int16(mode) 34 | k.Flags = uint16(flags) 35 | } 36 | 37 | func (iov *Iovec) SetLen(length int) { 38 | iov.Len = uint64(length) 39 | } 40 | 41 | func (msghdr *Msghdr) SetControllen(length int) { 42 | msghdr.Controllen = uint32(length) 43 | } 44 | 45 | func (cmsg *Cmsghdr) SetLen(length int) { 46 | cmsg.Len = uint32(length) 47 | } 48 | 49 | func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) { 50 | var writtenOut uint64 = 0 51 | _, _, e1 := Syscall9(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr(count), 0, uintptr(unsafe.Pointer(&writtenOut)), 0, 0, 0) 52 | 53 | written = int(writtenOut) 54 | 55 | if e1 != 0 { 56 | err = e1 57 | } 58 | return 59 | } 60 | 61 | func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) 62 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_freebsd_386.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 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 386,freebsd 6 | 7 | package unix 8 | 9 | import ( 10 | "syscall" 11 | "unsafe" 12 | ) 13 | 14 | func Getpagesize() int { return 4096 } 15 | 16 | func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) } 17 | 18 | func NsecToTimespec(nsec int64) (ts Timespec) { 19 | ts.Sec = int32(nsec / 1e9) 20 | ts.Nsec = int32(nsec % 1e9) 21 | return 22 | } 23 | 24 | func NsecToTimeval(nsec int64) (tv Timeval) { 25 | nsec += 999 // round up to microsecond 26 | tv.Usec = int32(nsec % 1e9 / 1e3) 27 | tv.Sec = int32(nsec / 1e9) 28 | return 29 | } 30 | 31 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 32 | k.Ident = uint32(fd) 33 | k.Filter = int16(mode) 34 | k.Flags = uint16(flags) 35 | } 36 | 37 | func (iov *Iovec) SetLen(length int) { 38 | iov.Len = uint32(length) 39 | } 40 | 41 | func (msghdr *Msghdr) SetControllen(length int) { 42 | msghdr.Controllen = uint32(length) 43 | } 44 | 45 | func (cmsg *Cmsghdr) SetLen(length int) { 46 | cmsg.Len = uint32(length) 47 | } 48 | 49 | func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) { 50 | var writtenOut uint64 = 0 51 | _, _, e1 := Syscall9(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr((*offset)>>32), uintptr(count), 0, uintptr(unsafe.Pointer(&writtenOut)), 0, 0) 52 | 53 | written = int(writtenOut) 54 | 55 | if e1 != 0 { 56 | err = e1 57 | } 58 | return 59 | } 60 | 61 | func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) 62 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_freebsd_amd64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 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,freebsd 6 | 7 | package unix 8 | 9 | import ( 10 | "syscall" 11 | "unsafe" 12 | ) 13 | 14 | func Getpagesize() int { return 4096 } 15 | 16 | func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) } 17 | 18 | func NsecToTimespec(nsec int64) (ts Timespec) { 19 | ts.Sec = nsec / 1e9 20 | ts.Nsec = nsec % 1e9 21 | return 22 | } 23 | 24 | func NsecToTimeval(nsec int64) (tv Timeval) { 25 | nsec += 999 // round up to microsecond 26 | tv.Usec = nsec % 1e9 / 1e3 27 | tv.Sec = int64(nsec / 1e9) 28 | return 29 | } 30 | 31 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 32 | k.Ident = uint64(fd) 33 | k.Filter = int16(mode) 34 | k.Flags = uint16(flags) 35 | } 36 | 37 | func (iov *Iovec) SetLen(length int) { 38 | iov.Len = uint64(length) 39 | } 40 | 41 | func (msghdr *Msghdr) SetControllen(length int) { 42 | msghdr.Controllen = uint32(length) 43 | } 44 | 45 | func (cmsg *Cmsghdr) SetLen(length int) { 46 | cmsg.Len = uint32(length) 47 | } 48 | 49 | func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) { 50 | var writtenOut uint64 = 0 51 | _, _, e1 := Syscall9(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr(count), 0, uintptr(unsafe.Pointer(&writtenOut)), 0, 0, 0) 52 | 53 | written = int(writtenOut) 54 | 55 | if e1 != 0 { 56 | err = e1 57 | } 58 | return 59 | } 60 | 61 | func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) 62 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_freebsd_arm.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 arm,freebsd 6 | 7 | package unix 8 | 9 | import ( 10 | "syscall" 11 | "unsafe" 12 | ) 13 | 14 | func Getpagesize() int { return 4096 } 15 | 16 | func TimespecToNsec(ts Timespec) int64 { return ts.Sec*1e9 + int64(ts.Nsec) } 17 | 18 | func NsecToTimespec(nsec int64) (ts Timespec) { 19 | ts.Sec = nsec / 1e9 20 | ts.Nsec = int32(nsec % 1e9) 21 | return 22 | } 23 | 24 | func NsecToTimeval(nsec int64) (tv Timeval) { 25 | nsec += 999 // round up to microsecond 26 | tv.Usec = int32(nsec % 1e9 / 1e3) 27 | tv.Sec = nsec / 1e9 28 | return 29 | } 30 | 31 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 32 | k.Ident = uint32(fd) 33 | k.Filter = int16(mode) 34 | k.Flags = uint16(flags) 35 | } 36 | 37 | func (iov *Iovec) SetLen(length int) { 38 | iov.Len = uint32(length) 39 | } 40 | 41 | func (msghdr *Msghdr) SetControllen(length int) { 42 | msghdr.Controllen = uint32(length) 43 | } 44 | 45 | func (cmsg *Cmsghdr) SetLen(length int) { 46 | cmsg.Len = uint32(length) 47 | } 48 | 49 | func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) { 50 | var writtenOut uint64 = 0 51 | _, _, e1 := Syscall9(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr((*offset)>>32), uintptr(count), 0, uintptr(unsafe.Pointer(&writtenOut)), 0, 0) 52 | 53 | written = int(writtenOut) 54 | 55 | if e1 != 0 { 56 | err = e1 57 | } 58 | return 59 | } 60 | 61 | func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) 62 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_netbsd_386.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 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 386,netbsd 6 | 7 | package unix 8 | 9 | func Getpagesize() int { return 4096 } 10 | 11 | func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) } 12 | 13 | func NsecToTimespec(nsec int64) (ts Timespec) { 14 | ts.Sec = int64(nsec / 1e9) 15 | ts.Nsec = int32(nsec % 1e9) 16 | return 17 | } 18 | 19 | func NsecToTimeval(nsec int64) (tv Timeval) { 20 | nsec += 999 // round up to microsecond 21 | tv.Usec = int32(nsec % 1e9 / 1e3) 22 | tv.Sec = int64(nsec / 1e9) 23 | return 24 | } 25 | 26 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 27 | k.Ident = uint32(fd) 28 | k.Filter = uint32(mode) 29 | k.Flags = uint32(flags) 30 | } 31 | 32 | func (iov *Iovec) SetLen(length int) { 33 | iov.Len = uint32(length) 34 | } 35 | 36 | func (msghdr *Msghdr) SetControllen(length int) { 37 | msghdr.Controllen = uint32(length) 38 | } 39 | 40 | func (cmsg *Cmsghdr) SetLen(length int) { 41 | cmsg.Len = uint32(length) 42 | } 43 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_netbsd_amd64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 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,netbsd 6 | 7 | package unix 8 | 9 | func Getpagesize() int { return 4096 } 10 | 11 | func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) } 12 | 13 | func NsecToTimespec(nsec int64) (ts Timespec) { 14 | ts.Sec = int64(nsec / 1e9) 15 | ts.Nsec = int64(nsec % 1e9) 16 | return 17 | } 18 | 19 | func NsecToTimeval(nsec int64) (tv Timeval) { 20 | nsec += 999 // round up to microsecond 21 | tv.Usec = int32(nsec % 1e9 / 1e3) 22 | tv.Sec = int64(nsec / 1e9) 23 | return 24 | } 25 | 26 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 27 | k.Ident = uint64(fd) 28 | k.Filter = uint32(mode) 29 | k.Flags = uint32(flags) 30 | } 31 | 32 | func (iov *Iovec) SetLen(length int) { 33 | iov.Len = uint64(length) 34 | } 35 | 36 | func (msghdr *Msghdr) SetControllen(length int) { 37 | msghdr.Controllen = uint32(length) 38 | } 39 | 40 | func (cmsg *Cmsghdr) SetLen(length int) { 41 | cmsg.Len = uint32(length) 42 | } 43 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_netbsd_arm.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 arm,netbsd 6 | 7 | package unix 8 | 9 | func Getpagesize() int { return 4096 } 10 | 11 | func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) } 12 | 13 | func NsecToTimespec(nsec int64) (ts Timespec) { 14 | ts.Sec = int64(nsec / 1e9) 15 | ts.Nsec = int32(nsec % 1e9) 16 | return 17 | } 18 | 19 | func NsecToTimeval(nsec int64) (tv Timeval) { 20 | nsec += 999 // round up to microsecond 21 | tv.Usec = int32(nsec % 1e9 / 1e3) 22 | tv.Sec = int64(nsec / 1e9) 23 | return 24 | } 25 | 26 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 27 | k.Ident = uint32(fd) 28 | k.Filter = uint32(mode) 29 | k.Flags = uint32(flags) 30 | } 31 | 32 | func (iov *Iovec) SetLen(length int) { 33 | iov.Len = uint32(length) 34 | } 35 | 36 | func (msghdr *Msghdr) SetControllen(length int) { 37 | msghdr.Controllen = uint32(length) 38 | } 39 | 40 | func (cmsg *Cmsghdr) SetLen(length int) { 41 | cmsg.Len = uint32(length) 42 | } 43 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_no_getwd.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 dragonfly freebsd netbsd openbsd 6 | 7 | package unix 8 | 9 | const ImplementsGetwd = false 10 | 11 | func Getwd() (string, error) { return "", ENOTSUP } 12 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_openbsd_386.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 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 386,openbsd 6 | 7 | package unix 8 | 9 | func Getpagesize() int { return 4096 } 10 | 11 | func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) } 12 | 13 | func NsecToTimespec(nsec int64) (ts Timespec) { 14 | ts.Sec = int64(nsec / 1e9) 15 | ts.Nsec = int32(nsec % 1e9) 16 | return 17 | } 18 | 19 | func NsecToTimeval(nsec int64) (tv Timeval) { 20 | nsec += 999 // round up to microsecond 21 | tv.Usec = int32(nsec % 1e9 / 1e3) 22 | tv.Sec = int64(nsec / 1e9) 23 | return 24 | } 25 | 26 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 27 | k.Ident = uint32(fd) 28 | k.Filter = int16(mode) 29 | k.Flags = uint16(flags) 30 | } 31 | 32 | func (iov *Iovec) SetLen(length int) { 33 | iov.Len = uint32(length) 34 | } 35 | 36 | func (msghdr *Msghdr) SetControllen(length int) { 37 | msghdr.Controllen = uint32(length) 38 | } 39 | 40 | func (cmsg *Cmsghdr) SetLen(length int) { 41 | cmsg.Len = uint32(length) 42 | } 43 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_openbsd_amd64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 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,openbsd 6 | 7 | package unix 8 | 9 | func Getpagesize() int { return 4096 } 10 | 11 | func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) } 12 | 13 | func NsecToTimespec(nsec int64) (ts Timespec) { 14 | ts.Sec = nsec / 1e9 15 | ts.Nsec = nsec % 1e9 16 | return 17 | } 18 | 19 | func NsecToTimeval(nsec int64) (tv Timeval) { 20 | nsec += 999 // round up to microsecond 21 | tv.Usec = nsec % 1e9 / 1e3 22 | tv.Sec = nsec / 1e9 23 | return 24 | } 25 | 26 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 27 | k.Ident = uint64(fd) 28 | k.Filter = int16(mode) 29 | k.Flags = uint16(flags) 30 | } 31 | 32 | func (iov *Iovec) SetLen(length int) { 33 | iov.Len = uint64(length) 34 | } 35 | 36 | func (msghdr *Msghdr) SetControllen(length int) { 37 | msghdr.Controllen = uint32(length) 38 | } 39 | 40 | func (cmsg *Cmsghdr) SetLen(length int) { 41 | cmsg.Len = uint32(length) 42 | } 43 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_solaris_amd64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 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,solaris 6 | 7 | package unix 8 | 9 | func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) } 10 | 11 | func NsecToTimespec(nsec int64) (ts Timespec) { 12 | ts.Sec = nsec / 1e9 13 | ts.Nsec = nsec % 1e9 14 | return 15 | } 16 | 17 | func NsecToTimeval(nsec int64) (tv Timeval) { 18 | nsec += 999 // round up to microsecond 19 | tv.Usec = nsec % 1e9 / 1e3 20 | tv.Sec = int64(nsec / 1e9) 21 | return 22 | } 23 | 24 | func (iov *Iovec) SetLen(length int) { 25 | iov.Len = uint64(length) 26 | } 27 | 28 | func (cmsg *Cmsghdr) SetLen(length int) { 29 | cmsg.Len = uint32(length) 30 | } 31 | 32 | func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) { 33 | // TODO(aram): implement this, see issue 5847. 34 | panic("unimplemented") 35 | } 36 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/zsysnum_solaris_amd64.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 amd64,solaris 6 | 7 | package unix 8 | 9 | // TODO(aram): remove these before Go 1.3. 10 | const ( 11 | SYS_EXECVE = 59 12 | SYS_FCNTL = 62 13 | ) 14 | --------------------------------------------------------------------------------