summaryrefslogtreecommitdiff
path: root/go/golang/gocache/48
diff options
context:
space:
mode:
Diffstat (limited to 'go/golang/gocache/48')
-rw-r--r--go/golang/gocache/48/48046a9e1371aed1d708d9a7f8915353d688ba92664232f8905a3679ac4a05d6-a1
-rw-r--r--go/golang/gocache/48/486059282305d878bc3b40d4da5d5009fa872137f964209349faee26262e0fe9-d333
-rw-r--r--go/golang/gocache/48/48dcffd6203ee541a43fb13c5d947b744abd96043f264561e19caefe279967a8-d1
-rw-r--r--go/golang/gocache/48/48ed50666fbc221bde0e8e4ffbfea7f080474261caef79ea4943171088b44191-a1
-rw-r--r--go/golang/gocache/48/48f04b727e5f54882855cd2297da600230f6811c55878c6d4c6e8849d20c09c4-dbin0 -> 296334 bytes
5 files changed, 336 insertions, 0 deletions
diff --git a/go/golang/gocache/48/48046a9e1371aed1d708d9a7f8915353d688ba92664232f8905a3679ac4a05d6-a b/go/golang/gocache/48/48046a9e1371aed1d708d9a7f8915353d688ba92664232f8905a3679ac4a05d6-a
new file mode 100644
index 00000000..10759667
--- /dev/null
+++ b/go/golang/gocache/48/48046a9e1371aed1d708d9a7f8915353d688ba92664232f8905a3679ac4a05d6-a
@@ -0,0 +1 @@
+v1 48046a9e1371aed1d708d9a7f8915353d688ba92664232f8905a3679ac4a05d6 e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 0 1548273524091220181
diff --git a/go/golang/gocache/48/486059282305d878bc3b40d4da5d5009fa872137f964209349faee26262e0fe9-d b/go/golang/gocache/48/486059282305d878bc3b40d4da5d5009fa872137f964209349faee26262e0fe9-d
new file mode 100644
index 00000000..a18c4ad9
--- /dev/null
+++ b/go/golang/gocache/48/486059282305d878bc3b40d4da5d5009fa872137f964209349faee26262e0fe9-d
@@ -0,0 +1,333 @@
+// Code generated by cmd/cgo; DO NOT EDIT.
+
+//line /workdir/go/src/net/cgo_unix.go:1:1
+// Copyright 2011 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// +build cgo,!netgo
+// +build darwin dragonfly freebsd linux netbsd openbsd solaris
+
+package net
+
+/*
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <netdb.h>
+#include <unistd.h>
+#include <string.h>
+*/
+import _ "unsafe"
+
+import (
+ "context"
+ "syscall"
+ "unsafe"
+)
+
+// An addrinfoErrno represents a getaddrinfo, getnameinfo-specific
+// error number. It's a signed number and a zero value is a non-error
+// by convention.
+type addrinfoErrno int
+
+func (eai addrinfoErrno) Error() string { return (_Cfunc_GoString)((_Cfunc_gai_strerror)(_Ctype_int(eai))) }
+func (eai addrinfoErrno) Temporary() bool { return eai == (_Ciconst_EAI_AGAIN) }
+func (eai addrinfoErrno) Timeout() bool { return false }
+
+type portLookupResult struct {
+ port int
+ err error
+}
+
+type ipLookupResult struct {
+ addrs []IPAddr
+ cname string
+ err error
+}
+
+type reverseLookupResult struct {
+ names []string
+ err error
+}
+
+func cgoLookupHost(ctx context.Context, name string) (hosts []string, err error, completed bool) {
+ addrs, err, completed := cgoLookupIP(ctx, name)
+ for _, addr := range addrs {
+ hosts = append(hosts, addr.String())
+ }
+ return
+}
+
+func cgoLookupPort(ctx context.Context, network, service string) (port int, err error, completed bool) {
+ var hints _Ctype_struct_addrinfo
+ switch network {
+ case "": // no hints
+ case "tcp", "tcp4", "tcp6":
+ hints.ai_socktype = (_Ciconst_SOCK_STREAM)
+ hints.ai_protocol = (_Ciconst_IPPROTO_TCP)
+ case "udp", "udp4", "udp6":
+ hints.ai_socktype = (_Ciconst_SOCK_DGRAM)
+ hints.ai_protocol = (_Ciconst_IPPROTO_UDP)
+ default:
+ return 0, &DNSError{Err: "unknown network", Name: network + "/" + service}, true
+ }
+ if len(network) >= 4 {
+ switch network[3] {
+ case '4':
+ hints.ai_family = (_Ciconst_AF_INET)
+ case '6':
+ hints.ai_family = (_Ciconst_AF_INET6)
+ }
+ }
+ if ctx.Done() == nil {
+ port, err := cgoLookupServicePort(&hints, network, service)
+ return port, err, true
+ }
+ result := make(chan portLookupResult, 1)
+ go cgoPortLookup(result, &hints, network, service)
+ select {
+ case r := <-result:
+ return r.port, r.err, true
+ case <-ctx.Done():
+ // Since there isn't a portable way to cancel the lookup,
+ // we just let it finish and write to the buffered channel.
+ return 0, mapErr(ctx.Err()), false
+ }
+}
+
+func cgoLookupServicePort(hints *_Ctype_struct_addrinfo, network, service string) (port int, err error) {
+ cservice := make([]byte, len(service)+1)
+ copy(cservice, service)
+ // Lowercase the C service name.
+ for i, b := range cservice[:len(service)] {
+ cservice[i] = lowerASCII(b)
+ }
+ var res *_Ctype_struct_addrinfo
+ gerrno, err := func(_cgo0 *_Ctype_char, _cgo1 *_Ctype_char, _cgo2 *_Ctype_struct_addrinfo, _cgo3 **_Ctype_struct_addrinfo) (_Ctype_int, error) {; _cgoCheckPointer(_cgo2); _cgoCheckPointer(_cgo3, true); return (_C2func_getaddrinfo)(_cgo0, _cgo1, _cgo2, _cgo3);}(nil, (*_Ctype_char)(unsafe.Pointer(&cservice[0])), hints, &res)
+ if gerrno != 0 {
+ switch gerrno {
+ case (_Ciconst_EAI_SYSTEM):
+ if err == nil { // see golang.org/issue/6232
+ err = syscall.EMFILE
+ }
+ default:
+ err = addrinfoErrno(gerrno)
+ }
+ return 0, &DNSError{Err: err.Error(), Name: network + "/" + service}
+ }
+ defer func(_cgo0 *_Ctype_struct_addrinfo) {; _cgoCheckPointer(_cgo0); (_Cfunc_freeaddrinfo)(_cgo0);}(res)
+
+ for r := res; r != nil; r = r.ai_next {
+ switch r.ai_family {
+ case (_Ciconst_AF_INET):
+ sa := (*syscall.RawSockaddrInet4)(unsafe.Pointer(r.ai_addr))
+ p := (*[2]byte)(unsafe.Pointer(&sa.Port))
+ return int(p[0])<<8 | int(p[1]), nil
+ case (_Ciconst_AF_INET6):
+ sa := (*syscall.RawSockaddrInet6)(unsafe.Pointer(r.ai_addr))
+ p := (*[2]byte)(unsafe.Pointer(&sa.Port))
+ return int(p[0])<<8 | int(p[1]), nil
+ }
+ }
+ return 0, &DNSError{Err: "unknown port", Name: network + "/" + service}
+}
+
+func cgoPortLookup(result chan<- portLookupResult, hints *_Ctype_struct_addrinfo, network, service string) {
+ port, err := cgoLookupServicePort(hints, network, service)
+ result <- portLookupResult{port, err}
+}
+
+func cgoLookupIPCNAME(name string) (addrs []IPAddr, cname string, err error) {
+ acquireThread()
+ defer releaseThread()
+
+ var hints _Ctype_struct_addrinfo
+ hints.ai_flags = cgoAddrInfoFlags
+ hints.ai_socktype = (_Ciconst_SOCK_STREAM)
+
+ h := make([]byte, len(name)+1)
+ copy(h, name)
+ var res *_Ctype_struct_addrinfo
+ gerrno, err := func(_cgo0 *_Ctype_char, _cgo1 *_Ctype_char, _cgo2 *_Ctype_struct_addrinfo, _cgo3 **_Ctype_struct_addrinfo) (_Ctype_int, error) {; _cgoCheckPointer(_cgo2, true); _cgoCheckPointer(_cgo3, true); return (_C2func_getaddrinfo)(_cgo0, _cgo1, _cgo2, _cgo3);}((*_Ctype_char)(unsafe.Pointer(&h[0])), nil, &hints, &res)
+ if gerrno != 0 {
+ switch gerrno {
+ case (_Ciconst_EAI_SYSTEM):
+ if err == nil {
+ // err should not be nil, but sometimes getaddrinfo returns
+ // gerrno == C.EAI_SYSTEM with err == nil on Linux.
+ // The report claims that it happens when we have too many
+ // open files, so use syscall.EMFILE (too many open files in system).
+ // Most system calls would return ENFILE (too many open files),
+ // so at the least EMFILE should be easy to recognize if this
+ // comes up again. golang.org/issue/6232.
+ err = syscall.EMFILE
+ }
+ case (_Ciconst_EAI_NONAME):
+ err = errNoSuchHost
+ default:
+ err = addrinfoErrno(gerrno)
+ }
+ return nil, "", &DNSError{Err: err.Error(), Name: name}
+ }
+ defer func(_cgo0 *_Ctype_struct_addrinfo) {; _cgoCheckPointer(_cgo0); (_Cfunc_freeaddrinfo)(_cgo0);}(res)
+
+ if res != nil {
+ cname = (_Cfunc_GoString)(res.ai_canonname)
+ if cname == "" {
+ cname = name
+ }
+ if len(cname) > 0 && cname[len(cname)-1] != '.' {
+ cname += "."
+ }
+ }
+ for r := res; r != nil; r = r.ai_next {
+ // We only asked for SOCK_STREAM, but check anyhow.
+ if r.ai_socktype != (_Ciconst_SOCK_STREAM) {
+ continue
+ }
+ switch r.ai_family {
+ case (_Ciconst_AF_INET):
+ sa := (*syscall.RawSockaddrInet4)(unsafe.Pointer(r.ai_addr))
+ addr := IPAddr{IP: copyIP(sa.Addr[:])}
+ addrs = append(addrs, addr)
+ case (_Ciconst_AF_INET6):
+ sa := (*syscall.RawSockaddrInet6)(unsafe.Pointer(r.ai_addr))
+ addr := IPAddr{IP: copyIP(sa.Addr[:]), Zone: zoneCache.name(int(sa.Scope_id))}
+ addrs = append(addrs, addr)
+ }
+ }
+ return addrs, cname, nil
+}
+
+func cgoIPLookup(result chan<- ipLookupResult, name string) {
+ addrs, cname, err := cgoLookupIPCNAME(name)
+ result <- ipLookupResult{addrs, cname, err}
+}
+
+func cgoLookupIP(ctx context.Context, name string) (addrs []IPAddr, err error, completed bool) {
+ if ctx.Done() == nil {
+ addrs, _, err = cgoLookupIPCNAME(name)
+ return addrs, err, true
+ }
+ result := make(chan ipLookupResult, 1)
+ go cgoIPLookup(result, name)
+ select {
+ case r := <-result:
+ return r.addrs, r.err, true
+ case <-ctx.Done():
+ return nil, mapErr(ctx.Err()), false
+ }
+}
+
+func cgoLookupCNAME(ctx context.Context, name string) (cname string, err error, completed bool) {
+ if ctx.Done() == nil {
+ _, cname, err = cgoLookupIPCNAME(name)
+ return cname, err, true
+ }
+ result := make(chan ipLookupResult, 1)
+ go cgoIPLookup(result, name)
+ select {
+ case r := <-result:
+ return r.cname, r.err, true
+ case <-ctx.Done():
+ return "", mapErr(ctx.Err()), false
+ }
+}
+
+// These are roughly enough for the following:
+//
+// Source Encoding Maximum length of single name entry
+// Unicast DNS ASCII or <=253 + a NUL terminator
+// Unicode in RFC 5892 252 * total number of labels + delimiters + a NUL terminator
+// Multicast DNS UTF-8 in RFC 5198 or <=253 + a NUL terminator
+// the same as unicast DNS ASCII <=253 + a NUL terminator
+// Local database various depends on implementation
+const (
+ nameinfoLen = 64
+ maxNameinfoLen = 4096
+)
+
+func cgoLookupPTR(ctx context.Context, addr string) (names []string, err error, completed bool) {
+ var zone string
+ ip := parseIPv4(addr)
+ if ip == nil {
+ ip, zone = parseIPv6Zone(addr)
+ }
+ if ip == nil {
+ return nil, &DNSError{Err: "invalid address", Name: addr}, true
+ }
+ sa, salen := cgoSockaddr(ip, zone)
+ if sa == nil {
+ return nil, &DNSError{Err: "invalid address " + ip.String(), Name: addr}, true
+ }
+ if ctx.Done() == nil {
+ names, err := cgoLookupAddrPTR(addr, sa, salen)
+ return names, err, true
+ }
+ result := make(chan reverseLookupResult, 1)
+ go cgoReverseLookup(result, addr, sa, salen)
+ select {
+ case r := <-result:
+ return r.names, r.err, true
+ case <-ctx.Done():
+ return nil, mapErr(ctx.Err()), false
+ }
+}
+
+func cgoLookupAddrPTR(addr string, sa *_Ctype_struct_sockaddr, salen _Ctype_socklen_t) (names []string, err error) {
+ acquireThread()
+ defer releaseThread()
+
+ var gerrno int
+ var b []byte
+ for l := nameinfoLen; l <= maxNameinfoLen; l *= 2 {
+ b = make([]byte, l)
+ gerrno, err = cgoNameinfoPTR(b, sa, salen)
+ if gerrno == 0 || gerrno != (_Ciconst_EAI_OVERFLOW) {
+ break
+ }
+ }
+ if gerrno != 0 {
+ switch gerrno {
+ case (_Ciconst_EAI_SYSTEM):
+ if err == nil { // see golang.org/issue/6232
+ err = syscall.EMFILE
+ }
+ default:
+ err = addrinfoErrno(gerrno)
+ }
+ return nil, &DNSError{Err: err.Error(), Name: addr}
+ }
+ for i := 0; i < len(b); i++ {
+ if b[i] == 0 {
+ b = b[:i]
+ break
+ }
+ }
+ return []string{absDomainName(b)}, nil
+}
+
+func cgoReverseLookup(result chan<- reverseLookupResult, addr string, sa *_Ctype_struct_sockaddr, salen _Ctype_socklen_t) {
+ names, err := cgoLookupAddrPTR(addr, sa, salen)
+ result <- reverseLookupResult{names, err}
+}
+
+func cgoSockaddr(ip IP, zone string) (*_Ctype_struct_sockaddr, _Ctype_socklen_t) {
+ if ip4 := ip.To4(); ip4 != nil {
+ return cgoSockaddrInet4(ip4), _Ctype_socklen_t(syscall.SizeofSockaddrInet4)
+ }
+ if ip6 := ip.To16(); ip6 != nil {
+ return cgoSockaddrInet6(ip6, zoneCache.index(zone)), _Ctype_socklen_t(syscall.SizeofSockaddrInet6)
+ }
+ return nil, 0
+}
+
+func copyIP(x IP) IP {
+ if len(x) < 16 {
+ return x.To16()
+ }
+ y := make(IP, len(x))
+ copy(y, x)
+ return y
+}
diff --git a/go/golang/gocache/48/48dcffd6203ee541a43fb13c5d947b744abd96043f264561e19caefe279967a8-d b/go/golang/gocache/48/48dcffd6203ee541a43fb13c5d947b744abd96043f264561e19caefe279967a8-d
new file mode 100644
index 00000000..9b19c5e7
--- /dev/null
+++ b/go/golang/gocache/48/48dcffd6203ee541a43fb13c5d947b744abd96043f264561e19caefe279967a8-d
@@ -0,0 +1 @@
+./utf16.go
diff --git a/go/golang/gocache/48/48ed50666fbc221bde0e8e4ffbfea7f080474261caef79ea4943171088b44191-a b/go/golang/gocache/48/48ed50666fbc221bde0e8e4ffbfea7f080474261caef79ea4943171088b44191-a
new file mode 100644
index 00000000..c61d3531
--- /dev/null
+++ b/go/golang/gocache/48/48ed50666fbc221bde0e8e4ffbfea7f080474261caef79ea4943171088b44191-a
@@ -0,0 +1 @@
+v1 48ed50666fbc221bde0e8e4ffbfea7f080474261caef79ea4943171088b44191 e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 0 1548273525037992906
diff --git a/go/golang/gocache/48/48f04b727e5f54882855cd2297da600230f6811c55878c6d4c6e8849d20c09c4-d b/go/golang/gocache/48/48f04b727e5f54882855cd2297da600230f6811c55878c6d4c6e8849d20c09c4-d
new file mode 100644
index 00000000..9ea68669
--- /dev/null
+++ b/go/golang/gocache/48/48f04b727e5f54882855cd2297da600230f6811c55878c6d4c6e8849d20c09c4-d
Binary files differ