├── README.md ├── doc └── Docker 扁平化网络插件.docx ├── logo.jpg ├── oam-docker-ipam ├── Godeps │ ├── Godeps.json │ ├── Readme │ └── _workspace │ │ ├── .gitignore │ │ └── src │ │ ├── github.com │ │ ├── Microsoft │ │ │ └── go-winio │ │ │ │ ├── .gitignore │ │ │ │ ├── LICENSE │ │ │ │ ├── README.md │ │ │ │ ├── backup.go │ │ │ │ ├── file.go │ │ │ │ ├── fileinfo.go │ │ │ │ ├── pipe.go │ │ │ │ ├── privilege.go │ │ │ │ ├── reparse.go │ │ │ │ ├── sd.go │ │ │ │ ├── syscall.go │ │ │ │ └── zsyscall.go │ │ ├── Sirupsen │ │ │ └── logrus │ │ │ │ ├── .gitignore │ │ │ │ ├── .travis.yml │ │ │ │ ├── CHANGELOG.md │ │ │ │ ├── LICENSE │ │ │ │ ├── README.md │ │ │ │ ├── doc.go │ │ │ │ ├── entry.go │ │ │ │ ├── exported.go │ │ │ │ ├── formatter.go │ │ │ │ ├── hooks.go │ │ │ │ ├── json_formatter.go │ │ │ │ ├── logger.go │ │ │ │ ├── logrus.go │ │ │ │ ├── terminal_bsd.go │ │ │ │ ├── terminal_linux.go │ │ │ │ ├── terminal_notwindows.go │ │ │ │ ├── terminal_solaris.go │ │ │ │ ├── terminal_windows.go │ │ │ │ ├── text_formatter.go │ │ │ │ └── writer.go │ │ ├── codegangsta │ │ │ └── cli │ │ │ │ ├── .travis.yml │ │ │ │ ├── LICENSE │ │ │ │ ├── README.md │ │ │ │ ├── app.go │ │ │ │ ├── appveyor.yml │ │ │ │ ├── category.go │ │ │ │ ├── cli.go │ │ │ │ ├── command.go │ │ │ │ ├── context.go │ │ │ │ ├── flag.go │ │ │ │ └── help.go │ │ ├── coreos │ │ │ ├── etcd │ │ │ │ ├── LICENSE │ │ │ │ ├── NOTICE │ │ │ │ ├── client │ │ │ │ │ ├── README.md │ │ │ │ │ ├── auth_role.go │ │ │ │ │ ├── auth_user.go │ │ │ │ │ ├── cancelreq.go │ │ │ │ │ ├── client.go │ │ │ │ │ ├── cluster_error.go │ │ │ │ │ ├── curl.go │ │ │ │ │ ├── discover.go │ │ │ │ │ ├── doc.go │ │ │ │ │ ├── keys.generated.go │ │ │ │ │ ├── keys.go │ │ │ │ │ ├── members.go │ │ │ │ │ ├── srv.go │ │ │ │ │ └── util.go │ │ │ │ └── pkg │ │ │ │ │ ├── pathutil │ │ │ │ │ └── path.go │ │ │ │ │ └── types │ │ │ │ │ ├── doc.go │ │ │ │ │ ├── id.go │ │ │ │ │ ├── set.go │ │ │ │ │ ├── slice.go │ │ │ │ │ ├── urls.go │ │ │ │ │ └── urlsmap.go │ │ │ └── go-systemd │ │ │ │ ├── LICENSE │ │ │ │ ├── activation │ │ │ │ ├── files.go │ │ │ │ ├── listeners.go │ │ │ │ └── packetconns.go │ │ │ │ └── util │ │ │ │ └── util.go │ │ ├── docker │ │ │ ├── go-connections │ │ │ │ ├── LICENSE │ │ │ │ └── sockets │ │ │ │ │ ├── README.md │ │ │ │ │ ├── inmem_socket.go │ │ │ │ │ ├── proxy.go │ │ │ │ │ ├── sockets.go │ │ │ │ │ ├── sockets_unix.go │ │ │ │ │ ├── sockets_windows.go │ │ │ │ │ ├── tcp_socket.go │ │ │ │ │ └── unix_socket.go │ │ │ ├── go-plugins-helpers │ │ │ │ ├── LICENSE │ │ │ │ ├── NOTICE │ │ │ │ ├── ipam │ │ │ │ │ ├── README.md │ │ │ │ │ └── api.go │ │ │ │ └── sdk │ │ │ │ │ ├── encoder.go │ │ │ │ │ ├── handler.go │ │ │ │ │ ├── tcp_listener.go │ │ │ │ │ ├── unix_listener.go │ │ │ │ │ └── unix_listener_unsupported.go │ │ │ └── libnetwork │ │ │ │ ├── LICENSE │ │ │ │ └── netlabel │ │ │ │ └── labels.go │ │ ├── opencontainers │ │ │ └── runc │ │ │ │ ├── LICENSE │ │ │ │ ├── NOTICE │ │ │ │ └── libcontainer │ │ │ │ └── user │ │ │ │ ├── MAINTAINERS │ │ │ │ ├── lookup.go │ │ │ │ ├── lookup_unix.go │ │ │ │ ├── lookup_unsupported.go │ │ │ │ └── user.go │ │ └── ugorji │ │ │ └── go │ │ │ ├── LICENSE │ │ │ └── codec │ │ │ ├── 0doc.go │ │ │ ├── README.md │ │ │ ├── binc.go │ │ │ ├── cbor.go │ │ │ ├── decode.go │ │ │ ├── encode.go │ │ │ ├── fast-path.generated.go │ │ │ ├── fast-path.go.tmpl │ │ │ ├── fast-path.not.go │ │ │ ├── gen-dec-array.go.tmpl │ │ │ ├── gen-dec-map.go.tmpl │ │ │ ├── gen-helper.generated.go │ │ │ ├── gen-helper.go.tmpl │ │ │ ├── gen.generated.go │ │ │ ├── gen.go │ │ │ ├── gen_15.go │ │ │ ├── gen_16.go │ │ │ ├── helper.go │ │ │ ├── helper_internal.go │ │ │ ├── helper_not_unsafe.go │ │ │ ├── helper_unsafe.go │ │ │ ├── json.go │ │ │ ├── msgpack.go │ │ │ ├── noop.go │ │ │ ├── prebuild.go │ │ │ ├── prebuild.sh │ │ │ ├── rpc.go │ │ │ ├── simple.go │ │ │ ├── test-cbor-goldens.json │ │ │ ├── test.py │ │ │ ├── tests.sh │ │ │ └── time.go │ │ └── golang.org │ │ └── x │ │ ├── net │ │ ├── LICENSE │ │ ├── PATENTS │ │ ├── context │ │ │ ├── context.go │ │ │ ├── go17.go │ │ │ └── pre_go17.go │ │ └── proxy │ │ │ ├── direct.go │ │ │ ├── per_host.go │ │ │ ├── proxy.go │ │ │ └── socks5.go │ │ └── sys │ │ ├── LICENSE │ │ ├── PATENTS │ │ └── unix │ │ ├── .gitignore │ │ ├── asm.s │ │ ├── asm_darwin_386.s │ │ ├── asm_darwin_amd64.s │ │ ├── asm_darwin_arm.s │ │ ├── asm_darwin_arm64.s │ │ ├── asm_dragonfly_386.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_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 │ │ ├── mkall.sh │ │ ├── mkerrors.sh │ │ ├── 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_386.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_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_386.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_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_386.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_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_386.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_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_386.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_netbsd_386.go │ │ ├── ztypes_netbsd_amd64.go │ │ ├── ztypes_netbsd_arm.go │ │ ├── ztypes_openbsd_386.go │ │ ├── ztypes_openbsd_amd64.go │ │ └── ztypes_solaris_amd64.go ├── bridge │ ├── bridge.go │ └── operation.go ├── command │ └── command.go ├── db │ └── db.go ├── ipamdriver │ ├── handler.go │ └── server.go ├── main.go └── util │ └── util.go └── rpms ├── docker-engine-1.11.1-1.el7.centos.x86_64.rpm ├── docker-engine-selinux-1.11.1-1.el7.centos.noarch.rpm ├── etcd-2.3.1-1.el7.centos.x86_64.rpm ├── oam-docker-ipam-1.0.0-1.el7.centos.x86_64.rpm ├── shipyard-3.0.4-1.el7.centos.x86_64.rpm └── swarm-1.2.2-1.el7.centos.x86_64.rpm /doc/Docker 扁平化网络插件.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TalkingData/Shrike/237332298c2b8e50bd280b3f041c90f57ed2efca/doc/Docker 扁平化网络插件.docx -------------------------------------------------------------------------------- /logo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TalkingData/Shrike/237332298c2b8e50bd280b3f041c90f57ed2efca/logo.jpg -------------------------------------------------------------------------------- /oam-docker-ipam/Godeps/Godeps.json: -------------------------------------------------------------------------------- 1 | { 2 | "ImportPath": "oam-docker-ipam", 3 | "GoVersion": "go1.5", 4 | "GodepVersion": "v62", 5 | "Deps": [ 6 | { 7 | "ImportPath": "github.com/Microsoft/go-winio", 8 | "Comment": "v0.3.3", 9 | "Rev": "3b8b3c98b207f95fe0cd6c7c311a9ac497ba7c0f" 10 | }, 11 | { 12 | "ImportPath": "github.com/Sirupsen/logrus", 13 | "Comment": "v0.10.0-14-g081307d", 14 | "Rev": "081307d9bc1364753142d5962fc1d795c742baaf" 15 | }, 16 | { 17 | "ImportPath": "github.com/codegangsta/cli", 18 | "Comment": "1.2.0-237-g71f57d3", 19 | "Rev": "71f57d300dd6a780ac1856c005c4b518cfd498ec" 20 | }, 21 | { 22 | "ImportPath": "github.com/coreos/etcd/client", 23 | "Comment": "v2.3.0-471-gbf9cccf", 24 | "Rev": "bf9cccfc3400d6a33aaa73347276298a2366196f" 25 | }, 26 | { 27 | "ImportPath": "github.com/coreos/etcd/pkg/pathutil", 28 | "Comment": "v2.3.0-471-gbf9cccf", 29 | "Rev": "bf9cccfc3400d6a33aaa73347276298a2366196f" 30 | }, 31 | { 32 | "ImportPath": "github.com/coreos/etcd/pkg/types", 33 | "Comment": "v2.3.0-471-gbf9cccf", 34 | "Rev": "bf9cccfc3400d6a33aaa73347276298a2366196f" 35 | }, 36 | { 37 | "ImportPath": "github.com/coreos/go-systemd/activation", 38 | "Comment": "v5", 39 | "Rev": "7b2428fec40033549c68f54e26e89e7ca9a9ce31" 40 | }, 41 | { 42 | "ImportPath": "github.com/coreos/go-systemd/util", 43 | "Comment": "v5", 44 | "Rev": "7b2428fec40033549c68f54e26e89e7ca9a9ce31" 45 | }, 46 | { 47 | "ImportPath": "github.com/docker/go-connections/sockets", 48 | "Comment": "v0.2.0-4-g5b7154b", 49 | "Rev": "5b7154ba2efe13ff86ae8830a9e7cb120b080d6e" 50 | }, 51 | { 52 | "ImportPath": "github.com/docker/go-plugins-helpers/ipam", 53 | "Rev": "7945ace0aa5cd39b512c5f3cf30ef6e55f5cc0fc" 54 | }, 55 | { 56 | "ImportPath": "github.com/docker/go-plugins-helpers/sdk", 57 | "Rev": "7945ace0aa5cd39b512c5f3cf30ef6e55f5cc0fc" 58 | }, 59 | { 60 | "ImportPath": "github.com/docker/libnetwork/netlabel", 61 | "Comment": "v0.7.0-dev.10-96-gf8fe886", 62 | "Rev": "f8fe886c436247b39c03996590cde60738a2c9f9" 63 | }, 64 | { 65 | "ImportPath": "github.com/opencontainers/runc/libcontainer/user", 66 | "Comment": "v0.1.0-19-g9384f48", 67 | "Rev": "9384f484ff795fb049f1dd2dc977536baae472c3" 68 | }, 69 | { 70 | "ImportPath": "github.com/ugorji/go/codec", 71 | "Rev": "a396ed22fc049df733440d90efe17475e3929ccb" 72 | }, 73 | { 74 | "ImportPath": "golang.org/x/net/context", 75 | "Rev": "fb93926129b8ec0056f2f458b1f519654814edf0" 76 | }, 77 | { 78 | "ImportPath": "golang.org/x/net/proxy", 79 | "Rev": "fb93926129b8ec0056f2f458b1f519654814edf0" 80 | }, 81 | { 82 | "ImportPath": "golang.org/x/sys/unix", 83 | "Rev": "f64b50fbea64174967a8882830d621a18ee1548e" 84 | } 85 | ] 86 | } 87 | -------------------------------------------------------------------------------- /oam-docker-ipam/Godeps/Readme: -------------------------------------------------------------------------------- 1 | This directory tree is generated automatically by godep. 2 | 3 | Please do not edit. 4 | 5 | See https://github.com/tools/godep for more information. 6 | -------------------------------------------------------------------------------- /oam-docker-ipam/Godeps/_workspace/.gitignore: -------------------------------------------------------------------------------- 1 | /pkg 2 | /bin 3 | -------------------------------------------------------------------------------- /oam-docker-ipam/Godeps/_workspace/src/github.com/Microsoft/go-winio/.gitignore: -------------------------------------------------------------------------------- 1 | *.exe 2 | -------------------------------------------------------------------------------- /oam-docker-ipam/Godeps/_workspace/src/github.com/Microsoft/go-winio/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Microsoft 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 | -------------------------------------------------------------------------------- /oam-docker-ipam/Godeps/_workspace/src/github.com/Microsoft/go-winio/README.md: -------------------------------------------------------------------------------- 1 | # go-winio 2 | 3 | This repository contains utilities for efficiently performing Win32 IO operations in 4 | Go. Currently, this is focused on accessing named pipes and other file handles, and 5 | for using named pipes as a net transport. 6 | 7 | This code relies on IO completion ports to avoid blocking IO on system threads, allowing Go 8 | to reuse the thread to schedule another goroutine. This limits support to Windows Vista and 9 | newer operating systems. This is similar to the implementation of network sockets in Go's net 10 | package. 11 | 12 | Please see the LICENSE file for licensing information. 13 | 14 | Thanks to natefinch for the inspiration for this library. See https://github.com/natefinch/npipe 15 | for another named pipe implementation. 16 | -------------------------------------------------------------------------------- /oam-docker-ipam/Godeps/_workspace/src/github.com/Microsoft/go-winio/fileinfo.go: -------------------------------------------------------------------------------- 1 | package winio 2 | 3 | import ( 4 | "os" 5 | "syscall" 6 | "unsafe" 7 | ) 8 | 9 | //sys getFileInformationByHandleEx(h syscall.Handle, class uint32, buffer *byte, size uint32) (err error) = GetFileInformationByHandleEx 10 | //sys setFileInformationByHandle(h syscall.Handle, class uint32, buffer *byte, size uint32) (err error) = SetFileInformationByHandle 11 | 12 | const ( 13 | fileBasicInfo = 0 14 | fileIDInfo = 0x12 15 | ) 16 | 17 | // FileBasicInfo contains file access time and file attributes information. 18 | type FileBasicInfo struct { 19 | CreationTime, LastAccessTime, LastWriteTime, ChangeTime syscall.Filetime 20 | FileAttributes uintptr // includes padding 21 | } 22 | 23 | // GetFileBasicInfo retrieves times and attributes for a file. 24 | func GetFileBasicInfo(f *os.File) (*FileBasicInfo, error) { 25 | bi := &FileBasicInfo{} 26 | if err := getFileInformationByHandleEx(syscall.Handle(f.Fd()), fileBasicInfo, (*byte)(unsafe.Pointer(bi)), uint32(unsafe.Sizeof(*bi))); err != nil { 27 | return nil, &os.PathError{Op: "GetFileInformationByHandleEx", Path: f.Name(), Err: err} 28 | } 29 | return bi, nil 30 | } 31 | 32 | // SetFileBasicInfo sets times and attributes for a file. 33 | func SetFileBasicInfo(f *os.File, bi *FileBasicInfo) error { 34 | if err := setFileInformationByHandle(syscall.Handle(f.Fd()), fileBasicInfo, (*byte)(unsafe.Pointer(bi)), uint32(unsafe.Sizeof(*bi))); err != nil { 35 | return &os.PathError{Op: "SetFileInformationByHandle", Path: f.Name(), Err: err} 36 | } 37 | return nil 38 | } 39 | 40 | // FileIDInfo contains the volume serial number and file ID for a file. This pair should be 41 | // unique on a system. 42 | type FileIDInfo struct { 43 | VolumeSerialNumber uint64 44 | FileID [16]byte 45 | } 46 | 47 | // GetFileID retrieves the unique (volume, file ID) pair for a file. 48 | func GetFileID(f *os.File) (*FileIDInfo, error) { 49 | fileID := &FileIDInfo{} 50 | if err := getFileInformationByHandleEx(syscall.Handle(f.Fd()), fileIDInfo, (*byte)(unsafe.Pointer(fileID)), uint32(unsafe.Sizeof(*fileID))); err != nil { 51 | return nil, &os.PathError{Op: "GetFileInformationByHandleEx", Path: f.Name(), Err: err} 52 | } 53 | return fileID, nil 54 | } 55 | -------------------------------------------------------------------------------- /oam-docker-ipam/Godeps/_workspace/src/github.com/Microsoft/go-winio/reparse.go: -------------------------------------------------------------------------------- 1 | package winio 2 | 3 | import ( 4 | "bytes" 5 | "encoding/binary" 6 | "fmt" 7 | "strings" 8 | "unicode/utf16" 9 | "unsafe" 10 | ) 11 | 12 | const ( 13 | reparseTagMountPoint = 0xA0000003 14 | reparseTagSymlink = 0xA000000C 15 | ) 16 | 17 | type reparseDataBuffer struct { 18 | ReparseTag uint32 19 | ReparseDataLength uint16 20 | Reserved uint16 21 | SubstituteNameOffset uint16 22 | SubstituteNameLength uint16 23 | PrintNameOffset uint16 24 | PrintNameLength uint16 25 | } 26 | 27 | // ReparsePoint describes a Win32 symlink or mount point. 28 | type ReparsePoint struct { 29 | Target string 30 | IsMountPoint bool 31 | } 32 | 33 | // UnsupportedReparsePointError is returned when trying to decode a non-symlink or 34 | // mount point reparse point. 35 | type UnsupportedReparsePointError struct { 36 | Tag uint32 37 | } 38 | 39 | func (e *UnsupportedReparsePointError) Error() string { 40 | return fmt.Sprintf("unsupported reparse point %x", e.Tag) 41 | } 42 | 43 | // DecodeReparsePoint decodes a Win32 REPARSE_DATA_BUFFER structure containing either a symlink 44 | // or a mount point. 45 | func DecodeReparsePoint(b []byte) (*ReparsePoint, error) { 46 | tag := binary.LittleEndian.Uint32(b[0:4]) 47 | return DecodeReparsePointData(tag, b[8:]) 48 | } 49 | 50 | func DecodeReparsePointData(tag uint32, b []byte) (*ReparsePoint, error) { 51 | isMountPoint := false 52 | switch tag { 53 | case reparseTagMountPoint: 54 | isMountPoint = true 55 | case reparseTagSymlink: 56 | default: 57 | return nil, &UnsupportedReparsePointError{tag} 58 | } 59 | nameOffset := 8 + binary.LittleEndian.Uint16(b[4:6]) 60 | if !isMountPoint { 61 | nameOffset += 4 62 | } 63 | nameLength := binary.LittleEndian.Uint16(b[6:8]) 64 | name := make([]uint16, nameLength/2) 65 | err := binary.Read(bytes.NewReader(b[nameOffset:nameOffset+nameLength]), binary.LittleEndian, &name) 66 | if err != nil { 67 | return nil, err 68 | } 69 | return &ReparsePoint{string(utf16.Decode(name)), isMountPoint}, nil 70 | } 71 | 72 | func isDriveLetter(c byte) bool { 73 | return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') 74 | } 75 | 76 | // EncodeReparsePoint encodes a Win32 REPARSE_DATA_BUFFER structure describing a symlink or 77 | // mount point. 78 | func EncodeReparsePoint(rp *ReparsePoint) []byte { 79 | // Generate an NT path and determine if this is a relative path. 80 | var ntTarget string 81 | relative := false 82 | if strings.HasPrefix(rp.Target, `\\?\`) { 83 | ntTarget = `\??\` + rp.Target[4:] 84 | } else if strings.HasPrefix(rp.Target, `\\`) { 85 | ntTarget = `\??\UNC\` + rp.Target[2:] 86 | } else if len(rp.Target) >= 2 && isDriveLetter(rp.Target[0]) && rp.Target[1] == ':' { 87 | ntTarget = `\??\` + rp.Target 88 | } else { 89 | ntTarget = rp.Target 90 | relative = true 91 | } 92 | 93 | // The paths must be NUL-terminated even though they are counted strings. 94 | target16 := utf16.Encode([]rune(rp.Target + "\x00")) 95 | ntTarget16 := utf16.Encode([]rune(ntTarget + "\x00")) 96 | 97 | size := int(unsafe.Sizeof(reparseDataBuffer{})) - 8 98 | size += len(ntTarget16)*2 + len(target16)*2 99 | 100 | tag := uint32(reparseTagMountPoint) 101 | if !rp.IsMountPoint { 102 | tag = reparseTagSymlink 103 | size += 4 // Add room for symlink flags 104 | } 105 | 106 | data := reparseDataBuffer{ 107 | ReparseTag: tag, 108 | ReparseDataLength: uint16(size), 109 | SubstituteNameOffset: 0, 110 | SubstituteNameLength: uint16((len(ntTarget16) - 1) * 2), 111 | PrintNameOffset: uint16(len(ntTarget16) * 2), 112 | PrintNameLength: uint16((len(target16) - 1) * 2), 113 | } 114 | 115 | var b bytes.Buffer 116 | binary.Write(&b, binary.LittleEndian, &data) 117 | if !rp.IsMountPoint { 118 | flags := uint32(0) 119 | if relative { 120 | flags |= 1 121 | } 122 | binary.Write(&b, binary.LittleEndian, flags) 123 | } 124 | 125 | binary.Write(&b, binary.LittleEndian, ntTarget16) 126 | binary.Write(&b, binary.LittleEndian, target16) 127 | return b.Bytes() 128 | } 129 | -------------------------------------------------------------------------------- /oam-docker-ipam/Godeps/_workspace/src/github.com/Microsoft/go-winio/sd.go: -------------------------------------------------------------------------------- 1 | package winio 2 | 3 | import ( 4 | "syscall" 5 | "unsafe" 6 | ) 7 | 8 | //sys lookupAccountName(systemName *uint16, accountName string, sid *byte, sidSize *uint32, refDomain *uint16, refDomainSize *uint32, sidNameUse *uint32) (err error) = advapi32.LookupAccountNameW 9 | //sys convertSidToStringSid(sid *byte, str **uint16) (err error) = advapi32.ConvertSidToStringSidW 10 | //sys convertStringSecurityDescriptorToSecurityDescriptor(str string, revision uint32, sd *uintptr, size *uint32) (err error) = advapi32.ConvertStringSecurityDescriptorToSecurityDescriptorW 11 | //sys convertSecurityDescriptorToStringSecurityDescriptor(sd *byte, revision uint32, secInfo uint32, sddl **uint16, sddlSize *uint32) (err error) = advapi32.ConvertSecurityDescriptorToStringSecurityDescriptorW 12 | //sys localFree(mem uintptr) = LocalFree 13 | //sys getSecurityDescriptorLength(sd uintptr) (len uint32) = advapi32.GetSecurityDescriptorLength 14 | 15 | const ( 16 | cERROR_NONE_MAPPED = syscall.Errno(1332) 17 | ) 18 | 19 | type AccountLookupError struct { 20 | Name string 21 | Err error 22 | } 23 | 24 | func (e *AccountLookupError) Error() string { 25 | if e.Name == "" { 26 | return "lookup account: empty account name specified" 27 | } 28 | var s string 29 | switch e.Err { 30 | case cERROR_NONE_MAPPED: 31 | s = "not found" 32 | default: 33 | s = e.Err.Error() 34 | } 35 | return "lookup account " + e.Name + ": " + s 36 | } 37 | 38 | type SddlConversionError struct { 39 | Sddl string 40 | Err error 41 | } 42 | 43 | func (e *SddlConversionError) Error() string { 44 | return "convert " + e.Sddl + ": " + e.Err.Error() 45 | } 46 | 47 | // LookupSidByName looks up the SID of an account by name 48 | func LookupSidByName(name string) (sid string, err error) { 49 | if name == "" { 50 | return "", &AccountLookupError{name, cERROR_NONE_MAPPED} 51 | } 52 | 53 | var sidSize, sidNameUse, refDomainSize uint32 54 | err = lookupAccountName(nil, name, nil, &sidSize, nil, &refDomainSize, &sidNameUse) 55 | if err != nil && err != syscall.ERROR_INSUFFICIENT_BUFFER { 56 | return "", &AccountLookupError{name, err} 57 | } 58 | sidBuffer := make([]byte, sidSize) 59 | refDomainBuffer := make([]uint16, refDomainSize) 60 | err = lookupAccountName(nil, name, &sidBuffer[0], &sidSize, &refDomainBuffer[0], &refDomainSize, &sidNameUse) 61 | if err != nil { 62 | return "", &AccountLookupError{name, err} 63 | } 64 | var strBuffer *uint16 65 | err = convertSidToStringSid(&sidBuffer[0], &strBuffer) 66 | if err != nil { 67 | return "", &AccountLookupError{name, err} 68 | } 69 | sid = syscall.UTF16ToString((*[0xffff]uint16)(unsafe.Pointer(strBuffer))[:]) 70 | localFree(uintptr(unsafe.Pointer(strBuffer))) 71 | return sid, nil 72 | } 73 | 74 | func SddlToSecurityDescriptor(sddl string) ([]byte, error) { 75 | var sdBuffer uintptr 76 | err := convertStringSecurityDescriptorToSecurityDescriptor(sddl, 1, &sdBuffer, nil) 77 | if err != nil { 78 | return nil, &SddlConversionError{sddl, err} 79 | } 80 | defer localFree(sdBuffer) 81 | sd := make([]byte, getSecurityDescriptorLength(sdBuffer)) 82 | copy(sd, (*[0xffff]byte)(unsafe.Pointer(sdBuffer))[:len(sd)]) 83 | return sd, nil 84 | } 85 | 86 | func SecurityDescriptorToSddl(sd []byte) (string, error) { 87 | var sddl *uint16 88 | // The returned string length seems to including an aribtrary number of terminating NULs. 89 | // Don't use it. 90 | err := convertSecurityDescriptorToStringSecurityDescriptor(&sd[0], 1, 0xff, &sddl, nil) 91 | if err != nil { 92 | return "", err 93 | } 94 | defer localFree(uintptr(unsafe.Pointer(sddl))) 95 | return syscall.UTF16ToString((*[0xffff]uint16)(unsafe.Pointer(sddl))[:]), nil 96 | } 97 | -------------------------------------------------------------------------------- /oam-docker-ipam/Godeps/_workspace/src/github.com/Microsoft/go-winio/syscall.go: -------------------------------------------------------------------------------- 1 | package winio 2 | 3 | //go:generate go run $GOROOT/src/syscall/mksyscall_windows.go -output zsyscall.go file.go pipe.go sd.go fileinfo.go privilege.go backup.go 4 | -------------------------------------------------------------------------------- /oam-docker-ipam/Godeps/_workspace/src/github.com/Sirupsen/logrus/.gitignore: -------------------------------------------------------------------------------- 1 | logrus 2 | -------------------------------------------------------------------------------- /oam-docker-ipam/Godeps/_workspace/src/github.com/Sirupsen/logrus/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | go: 3 | - 1.3 4 | - 1.4 5 | - 1.5 6 | - tip 7 | install: 8 | - go get -t ./... 9 | script: GOMAXPROCS=4 GORACE="halt_on_error=1" go test -race -v ./... 10 | -------------------------------------------------------------------------------- /oam-docker-ipam/Godeps/_workspace/src/github.com/Sirupsen/logrus/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # 0.10.0 2 | 3 | * feature: Add a test hook (#180) 4 | * feature: `ParseLevel` is now case-insensitive (#326) 5 | * feature: `FieldLogger` interface that generalizes `Logger` and `Entry` (#308) 6 | * performance: avoid re-allocations on `WithFields` (#335) 7 | 8 | # 0.9.0 9 | 10 | * logrus/text_formatter: don't emit empty msg 11 | * logrus/hooks/airbrake: move out of main repository 12 | * logrus/hooks/sentry: move out of main repository 13 | * logrus/hooks/papertrail: move out of main repository 14 | * logrus/hooks/bugsnag: move out of main repository 15 | * logrus/core: run tests with `-race` 16 | * logrus/core: detect TTY based on `stderr` 17 | * logrus/core: support `WithError` on logger 18 | * logrus/core: Solaris support 19 | 20 | # 0.8.7 21 | 22 | * logrus/core: fix possible race (#216) 23 | * logrus/doc: small typo fixes and doc improvements 24 | 25 | 26 | # 0.8.6 27 | 28 | * hooks/raven: allow passing an initialized client 29 | 30 | # 0.8.5 31 | 32 | * logrus/core: revert #208 33 | 34 | # 0.8.4 35 | 36 | * formatter/text: fix data race (#218) 37 | 38 | # 0.8.3 39 | 40 | * logrus/core: fix entry log level (#208) 41 | * logrus/core: improve performance of text formatter by 40% 42 | * logrus/core: expose `LevelHooks` type 43 | * logrus/core: add support for DragonflyBSD and NetBSD 44 | * formatter/text: print structs more verbosely 45 | 46 | # 0.8.2 47 | 48 | * logrus: fix more Fatal family functions 49 | 50 | # 0.8.1 51 | 52 | * logrus: fix not exiting on `Fatalf` and `Fatalln` 53 | 54 | # 0.8.0 55 | 56 | * logrus: defaults to stderr instead of stdout 57 | * hooks/sentry: add special field for `*http.Request` 58 | * formatter/text: ignore Windows for colors 59 | 60 | # 0.7.3 61 | 62 | * formatter/\*: allow configuration of timestamp layout 63 | 64 | # 0.7.2 65 | 66 | * formatter/text: Add configuration option for time format (#158) 67 | -------------------------------------------------------------------------------- /oam-docker-ipam/Godeps/_workspace/src/github.com/Sirupsen/logrus/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Simon Eskildsen 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 13 | all 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 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /oam-docker-ipam/Godeps/_workspace/src/github.com/Sirupsen/logrus/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Package logrus is a structured logger for Go, completely API compatible with the standard library logger. 3 | 4 | 5 | The simplest way to use Logrus is simply the package-level exported logger: 6 | 7 | package main 8 | 9 | import ( 10 | log "github.com/Sirupsen/logrus" 11 | ) 12 | 13 | func main() { 14 | log.WithFields(log.Fields{ 15 | "animal": "walrus", 16 | "number": 1, 17 | "size": 10, 18 | }).Info("A walrus appears") 19 | } 20 | 21 | Output: 22 | time="2015-09-07T08:48:33Z" level=info msg="A walrus appears" animal=walrus number=1 size=10 23 | 24 | For a full guide visit https://github.com/Sirupsen/logrus 25 | */ 26 | package logrus 27 | -------------------------------------------------------------------------------- /oam-docker-ipam/Godeps/_workspace/src/github.com/Sirupsen/logrus/formatter.go: -------------------------------------------------------------------------------- 1 | package logrus 2 | 3 | import "time" 4 | 5 | const DefaultTimestampFormat = time.RFC3339 6 | 7 | // The Formatter interface is used to implement a custom Formatter. It takes an 8 | // `Entry`. It exposes all the fields, including the default ones: 9 | // 10 | // * `entry.Data["msg"]`. The message passed from Info, Warn, Error .. 11 | // * `entry.Data["time"]`. The timestamp. 12 | // * `entry.Data["level"]. The level the entry was logged at. 13 | // 14 | // Any additional fields added with `WithField` or `WithFields` are also in 15 | // `entry.Data`. Format is expected to return an array of bytes which are then 16 | // logged to `logger.Out`. 17 | type Formatter interface { 18 | Format(*Entry) ([]byte, error) 19 | } 20 | 21 | // This is to not silently overwrite `time`, `msg` and `level` fields when 22 | // dumping it. If this code wasn't there doing: 23 | // 24 | // logrus.WithField("level", 1).Info("hello") 25 | // 26 | // Would just silently drop the user provided level. Instead with this code 27 | // it'll logged as: 28 | // 29 | // {"level": "info", "fields.level": 1, "msg": "hello", "time": "..."} 30 | // 31 | // It's not exported because it's still using Data in an opinionated way. It's to 32 | // avoid code duplication between the two default formatters. 33 | func prefixFieldClashes(data Fields) { 34 | if t, ok := data["time"]; ok { 35 | data["fields.time"] = t 36 | } 37 | 38 | if m, ok := data["msg"]; ok { 39 | data["fields.msg"] = m 40 | } 41 | 42 | if l, ok := data["level"]; ok { 43 | data["fields.level"] = l 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /oam-docker-ipam/Godeps/_workspace/src/github.com/Sirupsen/logrus/hooks.go: -------------------------------------------------------------------------------- 1 | package logrus 2 | 3 | // A hook to be fired when logging on the logging levels returned from 4 | // `Levels()` on your implementation of the interface. Note that this is not 5 | // fired in a goroutine or a channel with workers, you should handle such 6 | // functionality yourself if your call is non-blocking and you don't wish for 7 | // the logging calls for levels returned from `Levels()` to block. 8 | type Hook interface { 9 | Levels() []Level 10 | Fire(*Entry) error 11 | } 12 | 13 | // Internal type for storing the hooks on a logger instance. 14 | type LevelHooks map[Level][]Hook 15 | 16 | // Add a hook to an instance of logger. This is called with 17 | // `log.Hooks.Add(new(MyHook))` where `MyHook` implements the `Hook` interface. 18 | func (hooks LevelHooks) Add(hook Hook) { 19 | for _, level := range hook.Levels() { 20 | hooks[level] = append(hooks[level], hook) 21 | } 22 | } 23 | 24 | // Fire all the hooks for the passed level. Used by `entry.log` to fire 25 | // appropriate hooks for a log entry. 26 | func (hooks LevelHooks) Fire(level Level, entry *Entry) error { 27 | for _, hook := range hooks[level] { 28 | if err := hook.Fire(entry); err != nil { 29 | return err 30 | } 31 | } 32 | 33 | return nil 34 | } 35 | -------------------------------------------------------------------------------- /oam-docker-ipam/Godeps/_workspace/src/github.com/Sirupsen/logrus/json_formatter.go: -------------------------------------------------------------------------------- 1 | package logrus 2 | 3 | import ( 4 | "encoding/json" 5 | "fmt" 6 | ) 7 | 8 | type JSONFormatter struct { 9 | // TimestampFormat sets the format used for marshaling timestamps. 10 | TimestampFormat string 11 | } 12 | 13 | func (f *JSONFormatter) Format(entry *Entry) ([]byte, error) { 14 | data := make(Fields, len(entry.Data)+3) 15 | for k, v := range entry.Data { 16 | switch v := v.(type) { 17 | case error: 18 | // Otherwise errors are ignored by `encoding/json` 19 | // https://github.com/Sirupsen/logrus/issues/137 20 | data[k] = v.Error() 21 | default: 22 | data[k] = v 23 | } 24 | } 25 | prefixFieldClashes(data) 26 | 27 | timestampFormat := f.TimestampFormat 28 | if timestampFormat == "" { 29 | timestampFormat = DefaultTimestampFormat 30 | } 31 | 32 | data["time"] = entry.Time.Format(timestampFormat) 33 | data["msg"] = entry.Message 34 | data["level"] = entry.Level.String() 35 | 36 | serialized, err := json.Marshal(data) 37 | if err != nil { 38 | return nil, fmt.Errorf("Failed to marshal fields to JSON, %v", err) 39 | } 40 | return append(serialized, '\n'), nil 41 | } 42 | -------------------------------------------------------------------------------- /oam-docker-ipam/Godeps/_workspace/src/github.com/Sirupsen/logrus/logrus.go: -------------------------------------------------------------------------------- 1 | package logrus 2 | 3 | import ( 4 | "fmt" 5 | "log" 6 | "strings" 7 | ) 8 | 9 | // Fields type, used to pass to `WithFields`. 10 | type Fields map[string]interface{} 11 | 12 | // Level type 13 | type Level uint8 14 | 15 | // Convert the Level to a string. E.g. PanicLevel becomes "panic". 16 | func (level Level) String() string { 17 | switch level { 18 | case DebugLevel: 19 | return "debug" 20 | case InfoLevel: 21 | return "info" 22 | case WarnLevel: 23 | return "warning" 24 | case ErrorLevel: 25 | return "error" 26 | case FatalLevel: 27 | return "fatal" 28 | case PanicLevel: 29 | return "panic" 30 | } 31 | 32 | return "unknown" 33 | } 34 | 35 | // ParseLevel takes a string level and returns the Logrus log level constant. 36 | func ParseLevel(lvl string) (Level, error) { 37 | switch strings.ToLower(lvl) { 38 | case "panic": 39 | return PanicLevel, nil 40 | case "fatal": 41 | return FatalLevel, nil 42 | case "error": 43 | return ErrorLevel, nil 44 | case "warn", "warning": 45 | return WarnLevel, nil 46 | case "info": 47 | return InfoLevel, nil 48 | case "debug": 49 | return DebugLevel, nil 50 | } 51 | 52 | var l Level 53 | return l, fmt.Errorf("not a valid logrus Level: %q", lvl) 54 | } 55 | 56 | // A constant exposing all logging levels 57 | var AllLevels = []Level{ 58 | PanicLevel, 59 | FatalLevel, 60 | ErrorLevel, 61 | WarnLevel, 62 | InfoLevel, 63 | DebugLevel, 64 | } 65 | 66 | // These are the different logging levels. You can set the logging level to log 67 | // on your instance of logger, obtained with `logrus.New()`. 68 | const ( 69 | // PanicLevel level, highest level of severity. Logs and then calls panic with the 70 | // message passed to Debug, Info, ... 71 | PanicLevel Level = iota 72 | // FatalLevel level. Logs and then calls `os.Exit(1)`. It will exit even if the 73 | // logging level is set to Panic. 74 | FatalLevel 75 | // ErrorLevel level. Logs. Used for errors that should definitely be noted. 76 | // Commonly used for hooks to send errors to an error tracking service. 77 | ErrorLevel 78 | // WarnLevel level. Non-critical entries that deserve eyes. 79 | WarnLevel 80 | // InfoLevel level. General operational entries about what's going on inside the 81 | // application. 82 | InfoLevel 83 | // DebugLevel level. Usually only enabled when debugging. Very verbose logging. 84 | DebugLevel 85 | ) 86 | 87 | // Won't compile if StdLogger can't be realized by a log.Logger 88 | var ( 89 | _ StdLogger = &log.Logger{} 90 | _ StdLogger = &Entry{} 91 | _ StdLogger = &Logger{} 92 | ) 93 | 94 | // StdLogger is what your logrus-enabled library should take, that way 95 | // it'll accept a stdlib logger and a logrus logger. There's no standard 96 | // interface, this is the closest we get, unfortunately. 97 | type StdLogger interface { 98 | Print(...interface{}) 99 | Printf(string, ...interface{}) 100 | Println(...interface{}) 101 | 102 | Fatal(...interface{}) 103 | Fatalf(string, ...interface{}) 104 | Fatalln(...interface{}) 105 | 106 | Panic(...interface{}) 107 | Panicf(string, ...interface{}) 108 | Panicln(...interface{}) 109 | } 110 | 111 | // The FieldLogger interface generalizes the Entry and Logger types 112 | type FieldLogger interface { 113 | WithField(key string, value interface{}) *Entry 114 | WithFields(fields Fields) *Entry 115 | WithError(err error) *Entry 116 | 117 | Debugf(format string, args ...interface{}) 118 | Infof(format string, args ...interface{}) 119 | Printf(format string, args ...interface{}) 120 | Warnf(format string, args ...interface{}) 121 | Warningf(format string, args ...interface{}) 122 | Errorf(format string, args ...interface{}) 123 | Fatalf(format string, args ...interface{}) 124 | Panicf(format string, args ...interface{}) 125 | 126 | Debug(args ...interface{}) 127 | Info(args ...interface{}) 128 | Print(args ...interface{}) 129 | Warn(args ...interface{}) 130 | Warning(args ...interface{}) 131 | Error(args ...interface{}) 132 | Fatal(args ...interface{}) 133 | Panic(args ...interface{}) 134 | 135 | Debugln(args ...interface{}) 136 | Infoln(args ...interface{}) 137 | Println(args ...interface{}) 138 | Warnln(args ...interface{}) 139 | Warningln(args ...interface{}) 140 | Errorln(args ...interface{}) 141 | Fatalln(args ...interface{}) 142 | Panicln(args ...interface{}) 143 | } 144 | -------------------------------------------------------------------------------- /oam-docker-ipam/Godeps/_workspace/src/github.com/Sirupsen/logrus/terminal_bsd.go: -------------------------------------------------------------------------------- 1 | // +build darwin freebsd openbsd netbsd dragonfly 2 | 3 | package logrus 4 | 5 | import "syscall" 6 | 7 | const ioctlReadTermios = syscall.TIOCGETA 8 | 9 | type Termios syscall.Termios 10 | -------------------------------------------------------------------------------- /oam-docker-ipam/Godeps/_workspace/src/github.com/Sirupsen/logrus/terminal_linux.go: -------------------------------------------------------------------------------- 1 | // Based on ssh/terminal: 2 | // Copyright 2013 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 | package logrus 7 | 8 | import "syscall" 9 | 10 | const ioctlReadTermios = syscall.TCGETS 11 | 12 | type Termios syscall.Termios 13 | -------------------------------------------------------------------------------- /oam-docker-ipam/Godeps/_workspace/src/github.com/Sirupsen/logrus/terminal_notwindows.go: -------------------------------------------------------------------------------- 1 | // Based on ssh/terminal: 2 | // Copyright 2011 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 | // +build linux darwin freebsd openbsd netbsd dragonfly 7 | 8 | package logrus 9 | 10 | import ( 11 | "syscall" 12 | "unsafe" 13 | ) 14 | 15 | // IsTerminal returns true if stderr's file descriptor is a terminal. 16 | func IsTerminal() bool { 17 | fd := syscall.Stderr 18 | var termios Termios 19 | _, _, err := syscall.Syscall6(syscall.SYS_IOCTL, uintptr(fd), ioctlReadTermios, uintptr(unsafe.Pointer(&termios)), 0, 0, 0) 20 | return err == 0 21 | } 22 | -------------------------------------------------------------------------------- /oam-docker-ipam/Godeps/_workspace/src/github.com/Sirupsen/logrus/terminal_solaris.go: -------------------------------------------------------------------------------- 1 | // +build solaris 2 | 3 | package logrus 4 | 5 | import ( 6 | "os" 7 | 8 | "golang.org/x/sys/unix" 9 | ) 10 | 11 | // IsTerminal returns true if the given file descriptor is a terminal. 12 | func IsTerminal() bool { 13 | _, err := unix.IoctlGetTermios(int(os.Stdout.Fd()), unix.TCGETA) 14 | return err == nil 15 | } 16 | -------------------------------------------------------------------------------- /oam-docker-ipam/Godeps/_workspace/src/github.com/Sirupsen/logrus/terminal_windows.go: -------------------------------------------------------------------------------- 1 | // Based on ssh/terminal: 2 | // Copyright 2011 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 | // +build windows 7 | 8 | package logrus 9 | 10 | import ( 11 | "syscall" 12 | "unsafe" 13 | ) 14 | 15 | var kernel32 = syscall.NewLazyDLL("kernel32.dll") 16 | 17 | var ( 18 | procGetConsoleMode = kernel32.NewProc("GetConsoleMode") 19 | ) 20 | 21 | // IsTerminal returns true if stderr's file descriptor is a terminal. 22 | func IsTerminal() bool { 23 | fd := syscall.Stderr 24 | var st uint32 25 | r, _, e := syscall.Syscall(procGetConsoleMode.Addr(), 2, uintptr(fd), uintptr(unsafe.Pointer(&st)), 0) 26 | return r != 0 && e == 0 27 | } 28 | -------------------------------------------------------------------------------- /oam-docker-ipam/Godeps/_workspace/src/github.com/Sirupsen/logrus/text_formatter.go: -------------------------------------------------------------------------------- 1 | package logrus 2 | 3 | import ( 4 | "bytes" 5 | "fmt" 6 | "runtime" 7 | "sort" 8 | "strings" 9 | "time" 10 | ) 11 | 12 | const ( 13 | nocolor = 0 14 | red = 31 15 | green = 32 16 | yellow = 33 17 | blue = 34 18 | gray = 37 19 | ) 20 | 21 | var ( 22 | baseTimestamp time.Time 23 | isTerminal bool 24 | ) 25 | 26 | func init() { 27 | baseTimestamp = time.Now() 28 | isTerminal = IsTerminal() 29 | } 30 | 31 | func miniTS() int { 32 | return int(time.Since(baseTimestamp) / time.Second) 33 | } 34 | 35 | type TextFormatter struct { 36 | // Set to true to bypass checking for a TTY before outputting colors. 37 | ForceColors bool 38 | 39 | // Force disabling colors. 40 | DisableColors bool 41 | 42 | // Disable timestamp logging. useful when output is redirected to logging 43 | // system that already adds timestamps. 44 | DisableTimestamp bool 45 | 46 | // Enable logging the full timestamp when a TTY is attached instead of just 47 | // the time passed since beginning of execution. 48 | FullTimestamp bool 49 | 50 | // TimestampFormat to use for display when a full timestamp is printed 51 | TimestampFormat string 52 | 53 | // The fields are sorted by default for a consistent output. For applications 54 | // that log extremely frequently and don't use the JSON formatter this may not 55 | // be desired. 56 | DisableSorting bool 57 | } 58 | 59 | func (f *TextFormatter) Format(entry *Entry) ([]byte, error) { 60 | var keys []string = make([]string, 0, len(entry.Data)) 61 | for k := range entry.Data { 62 | keys = append(keys, k) 63 | } 64 | 65 | if !f.DisableSorting { 66 | sort.Strings(keys) 67 | } 68 | 69 | b := &bytes.Buffer{} 70 | 71 | prefixFieldClashes(entry.Data) 72 | 73 | isColorTerminal := isTerminal && (runtime.GOOS != "windows") 74 | isColored := (f.ForceColors || isColorTerminal) && !f.DisableColors 75 | 76 | timestampFormat := f.TimestampFormat 77 | if timestampFormat == "" { 78 | timestampFormat = DefaultTimestampFormat 79 | } 80 | if isColored { 81 | f.printColored(b, entry, keys, timestampFormat) 82 | } else { 83 | if !f.DisableTimestamp { 84 | f.appendKeyValue(b, "time", entry.Time.Format(timestampFormat)) 85 | } 86 | f.appendKeyValue(b, "level", entry.Level.String()) 87 | if entry.Message != "" { 88 | f.appendKeyValue(b, "msg", entry.Message) 89 | } 90 | for _, key := range keys { 91 | f.appendKeyValue(b, key, entry.Data[key]) 92 | } 93 | } 94 | 95 | b.WriteByte('\n') 96 | return b.Bytes(), nil 97 | } 98 | 99 | func (f *TextFormatter) printColored(b *bytes.Buffer, entry *Entry, keys []string, timestampFormat string) { 100 | var levelColor int 101 | switch entry.Level { 102 | case DebugLevel: 103 | levelColor = gray 104 | case WarnLevel: 105 | levelColor = yellow 106 | case ErrorLevel, FatalLevel, PanicLevel: 107 | levelColor = red 108 | default: 109 | levelColor = blue 110 | } 111 | 112 | levelText := strings.ToUpper(entry.Level.String())[0:4] 113 | 114 | if !f.FullTimestamp { 115 | fmt.Fprintf(b, "\x1b[%dm%s\x1b[0m[%04d] %-44s ", levelColor, levelText, miniTS(), entry.Message) 116 | } else { 117 | fmt.Fprintf(b, "\x1b[%dm%s\x1b[0m[%s] %-44s ", levelColor, levelText, entry.Time.Format(timestampFormat), entry.Message) 118 | } 119 | for _, k := range keys { 120 | v := entry.Data[k] 121 | fmt.Fprintf(b, " \x1b[%dm%s\x1b[0m=%+v", levelColor, k, v) 122 | } 123 | } 124 | 125 | func needsQuoting(text string) bool { 126 | for _, ch := range text { 127 | if !((ch >= 'a' && ch <= 'z') || 128 | (ch >= 'A' && ch <= 'Z') || 129 | (ch >= '0' && ch <= '9') || 130 | ch == '-' || ch == '.') { 131 | return true 132 | } 133 | } 134 | return false 135 | } 136 | 137 | func (f *TextFormatter) appendKeyValue(b *bytes.Buffer, key string, value interface{}) { 138 | 139 | b.WriteString(key) 140 | b.WriteByte('=') 141 | 142 | switch value := value.(type) { 143 | case string: 144 | if !needsQuoting(value) { 145 | b.WriteString(value) 146 | } else { 147 | fmt.Fprintf(b, "%q", value) 148 | } 149 | case error: 150 | errmsg := value.Error() 151 | if !needsQuoting(errmsg) { 152 | b.WriteString(errmsg) 153 | } else { 154 | fmt.Fprintf(b, "%q", value) 155 | } 156 | default: 157 | fmt.Fprint(b, value) 158 | } 159 | 160 | b.WriteByte(' ') 161 | } 162 | -------------------------------------------------------------------------------- /oam-docker-ipam/Godeps/_workspace/src/github.com/Sirupsen/logrus/writer.go: -------------------------------------------------------------------------------- 1 | package logrus 2 | 3 | import ( 4 | "bufio" 5 | "io" 6 | "runtime" 7 | ) 8 | 9 | func (logger *Logger) Writer() *io.PipeWriter { 10 | return logger.WriterLevel(InfoLevel) 11 | } 12 | 13 | func (logger *Logger) WriterLevel(level Level) *io.PipeWriter { 14 | reader, writer := io.Pipe() 15 | 16 | var printFunc func(args ...interface{}) 17 | switch level { 18 | case DebugLevel: 19 | printFunc = logger.Debug 20 | case InfoLevel: 21 | printFunc = logger.Info 22 | case WarnLevel: 23 | printFunc = logger.Warn 24 | case ErrorLevel: 25 | printFunc = logger.Error 26 | case FatalLevel: 27 | printFunc = logger.Fatal 28 | case PanicLevel: 29 | printFunc = logger.Panic 30 | default: 31 | printFunc = logger.Print 32 | } 33 | 34 | go logger.writerScanner(reader, printFunc) 35 | runtime.SetFinalizer(writer, writerFinalizer) 36 | 37 | return writer 38 | } 39 | 40 | func (logger *Logger) writerScanner(reader *io.PipeReader, printFunc func(args ...interface{})) { 41 | scanner := bufio.NewScanner(reader) 42 | for scanner.Scan() { 43 | printFunc(scanner.Text()) 44 | } 45 | if err := scanner.Err(); err != nil { 46 | logger.Errorf("Error while reading from Writer: %s", err) 47 | } 48 | reader.Close() 49 | } 50 | 51 | func writerFinalizer(writer *io.PipeWriter) { 52 | writer.Close() 53 | } 54 | -------------------------------------------------------------------------------- /oam-docker-ipam/Godeps/_workspace/src/github.com/codegangsta/cli/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | sudo: false 3 | 4 | go: 5 | - 1.1.2 6 | - 1.2.2 7 | - 1.3.3 8 | - 1.4.2 9 | - 1.5.1 10 | - tip 11 | 12 | matrix: 13 | allow_failures: 14 | - go: tip 15 | 16 | script: 17 | - go vet ./... 18 | - go test -v ./... 19 | -------------------------------------------------------------------------------- /oam-docker-ipam/Godeps/_workspace/src/github.com/codegangsta/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 | -------------------------------------------------------------------------------- /oam-docker-ipam/Godeps/_workspace/src/github.com/codegangsta/cli/appveyor.yml: -------------------------------------------------------------------------------- 1 | version: "{build}" 2 | 3 | os: Windows Server 2012 R2 4 | 5 | install: 6 | - go version 7 | - go env 8 | 9 | build_script: 10 | - cd %APPVEYOR_BUILD_FOLDER% 11 | - go vet ./... 12 | - go test -v ./... 13 | 14 | test: off 15 | 16 | deploy: off 17 | -------------------------------------------------------------------------------- /oam-docker-ipam/Godeps/_workspace/src/github.com/codegangsta/cli/category.go: -------------------------------------------------------------------------------- 1 | package cli 2 | 3 | type CommandCategories []*CommandCategory 4 | 5 | type CommandCategory struct { 6 | Name string 7 | Commands Commands 8 | } 9 | 10 | func (c CommandCategories) Less(i, j int) bool { 11 | return c[i].Name < c[j].Name 12 | } 13 | 14 | func (c CommandCategories) Len() int { 15 | return len(c) 16 | } 17 | 18 | func (c CommandCategories) Swap(i, j int) { 19 | c[i], c[j] = c[j], c[i] 20 | } 21 | 22 | func (c CommandCategories) AddCommand(category string, command Command) CommandCategories { 23 | for _, commandCategory := range c { 24 | if commandCategory.Name == category { 25 | commandCategory.Commands = append(commandCategory.Commands, command) 26 | return c 27 | } 28 | } 29 | return append(c, &CommandCategory{Name: category, Commands: []Command{command}}) 30 | } 31 | -------------------------------------------------------------------------------- /oam-docker-ipam/Godeps/_workspace/src/github.com/codegangsta/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 | 21 | import ( 22 | "strings" 23 | ) 24 | 25 | type MultiError struct { 26 | Errors []error 27 | } 28 | 29 | func NewMultiError(err ...error) MultiError { 30 | return MultiError{Errors: err} 31 | } 32 | 33 | func (m MultiError) Error() string { 34 | errs := make([]string, len(m.Errors)) 35 | for i, err := range m.Errors { 36 | errs[i] = err.Error() 37 | } 38 | 39 | return strings.Join(errs, "\n") 40 | } 41 | -------------------------------------------------------------------------------- /oam-docker-ipam/Godeps/_workspace/src/github.com/coreos/etcd/NOTICE: -------------------------------------------------------------------------------- 1 | CoreOS Project 2 | Copyright 2014 CoreOS, Inc 3 | 4 | This product includes software developed at CoreOS, Inc. 5 | (http://www.coreos.com/). 6 | -------------------------------------------------------------------------------- /oam-docker-ipam/Godeps/_workspace/src/github.com/coreos/etcd/client/cancelreq.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 | // borrowed from golang/net/context/ctxhttp/cancelreq.go 6 | 7 | package client 8 | 9 | import "net/http" 10 | 11 | func requestCanceler(tr CancelableTransport, req *http.Request) func() { 12 | ch := make(chan struct{}) 13 | req.Cancel = ch 14 | 15 | return func() { 16 | close(ch) 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /oam-docker-ipam/Godeps/_workspace/src/github.com/coreos/etcd/client/cluster_error.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 CoreOS, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package client 16 | 17 | import "fmt" 18 | 19 | type ClusterError struct { 20 | Errors []error 21 | } 22 | 23 | func (ce *ClusterError) Error() string { 24 | return ErrClusterUnavailable.Error() 25 | } 26 | 27 | func (ce *ClusterError) Detail() string { 28 | s := "" 29 | for i, e := range ce.Errors { 30 | s += fmt.Sprintf("error #%d: %s\n", i, e) 31 | } 32 | return s 33 | } 34 | -------------------------------------------------------------------------------- /oam-docker-ipam/Godeps/_workspace/src/github.com/coreos/etcd/client/curl.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 CoreOS, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package client 16 | 17 | import ( 18 | "bytes" 19 | "fmt" 20 | "io/ioutil" 21 | "net/http" 22 | "os" 23 | ) 24 | 25 | var ( 26 | cURLDebug = false 27 | ) 28 | 29 | func EnablecURLDebug() { 30 | cURLDebug = true 31 | } 32 | 33 | func DisablecURLDebug() { 34 | cURLDebug = false 35 | } 36 | 37 | // printcURL prints the cURL equivalent request to stderr. 38 | // It returns an error if the body of the request cannot 39 | // be read. 40 | // The caller MUST cancel the request if there is an error. 41 | func printcURL(req *http.Request) error { 42 | if !cURLDebug { 43 | return nil 44 | } 45 | var ( 46 | command string 47 | b []byte 48 | err error 49 | ) 50 | 51 | if req.URL != nil { 52 | command = fmt.Sprintf("curl -X %s %s", req.Method, req.URL.String()) 53 | } 54 | 55 | if req.Body != nil { 56 | b, err = ioutil.ReadAll(req.Body) 57 | if err != nil { 58 | return err 59 | } 60 | command += fmt.Sprintf(" -d %q", string(b)) 61 | } 62 | 63 | fmt.Fprintf(os.Stderr, "cURL Command: %s\n", command) 64 | 65 | // reset body 66 | body := bytes.NewBuffer(b) 67 | req.Body = ioutil.NopCloser(body) 68 | 69 | return nil 70 | } 71 | -------------------------------------------------------------------------------- /oam-docker-ipam/Godeps/_workspace/src/github.com/coreos/etcd/client/discover.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 CoreOS, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package client 16 | 17 | // Discoverer is an interface that wraps the Discover method. 18 | type Discoverer interface { 19 | // Discover looks up the etcd servers for the domain. 20 | Discover(domain string) ([]string, error) 21 | } 22 | -------------------------------------------------------------------------------- /oam-docker-ipam/Godeps/_workspace/src/github.com/coreos/etcd/client/doc.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 CoreOS, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | /* 16 | Package client provides bindings for the etcd APIs. 17 | 18 | Create a Config and exchange it for a Client: 19 | 20 | import ( 21 | "net/http" 22 | 23 | "github.com/coreos/etcd/client" 24 | "golang.org/x/net/context" 25 | ) 26 | 27 | cfg := client.Config{ 28 | Endpoints: []string{"http://127.0.0.1:2379"}, 29 | Transport: DefaultTransport, 30 | } 31 | 32 | c, err := client.New(cfg) 33 | if err != nil { 34 | // handle error 35 | } 36 | 37 | Clients are safe for concurrent use by multiple goroutines. 38 | 39 | Create a KeysAPI using the Client, then use it to interact with etcd: 40 | 41 | kAPI := client.NewKeysAPI(c) 42 | 43 | // create a new key /foo with the value "bar" 44 | _, err = kAPI.Create(context.Background(), "/foo", "bar") 45 | if err != nil { 46 | // handle error 47 | } 48 | 49 | // delete the newly created key only if the value is still "bar" 50 | _, err = kAPI.Delete(context.Background(), "/foo", &DeleteOptions{PrevValue: "bar"}) 51 | if err != nil { 52 | // handle error 53 | } 54 | 55 | Use a custom context to set timeouts on your operations: 56 | 57 | import "time" 58 | 59 | ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second) 60 | defer cancel() 61 | 62 | // set a new key, ignoring it's previous state 63 | _, err := kAPI.Set(ctx, "/ping", "pong", nil) 64 | if err != nil { 65 | if err == context.DeadlineExceeded { 66 | // request took longer than 5s 67 | } else { 68 | // handle error 69 | } 70 | } 71 | 72 | */ 73 | package client 74 | -------------------------------------------------------------------------------- /oam-docker-ipam/Godeps/_workspace/src/github.com/coreos/etcd/client/srv.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 CoreOS, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package client 16 | 17 | import ( 18 | "fmt" 19 | "net" 20 | "net/url" 21 | ) 22 | 23 | var ( 24 | // indirection for testing 25 | lookupSRV = net.LookupSRV 26 | ) 27 | 28 | type srvDiscover struct{} 29 | 30 | // NewSRVDiscover constructs a new Discoverer that uses the stdlib to lookup SRV records. 31 | func NewSRVDiscover() Discoverer { 32 | return &srvDiscover{} 33 | } 34 | 35 | // Discover looks up the etcd servers for the domain. 36 | func (d *srvDiscover) Discover(domain string) ([]string, error) { 37 | var urls []*url.URL 38 | 39 | updateURLs := func(service, scheme string) error { 40 | _, addrs, err := lookupSRV(service, "tcp", domain) 41 | if err != nil { 42 | return err 43 | } 44 | for _, srv := range addrs { 45 | urls = append(urls, &url.URL{ 46 | Scheme: scheme, 47 | Host: net.JoinHostPort(srv.Target, fmt.Sprintf("%d", srv.Port)), 48 | }) 49 | } 50 | return nil 51 | } 52 | 53 | errHTTPS := updateURLs("etcd-client-ssl", "https") 54 | errHTTP := updateURLs("etcd-client", "http") 55 | 56 | if errHTTPS != nil && errHTTP != nil { 57 | return nil, fmt.Errorf("dns lookup errors: %s and %s", errHTTPS, errHTTP) 58 | } 59 | 60 | endpoints := make([]string, len(urls)) 61 | for i := range urls { 62 | endpoints[i] = urls[i].String() 63 | } 64 | return endpoints, nil 65 | } 66 | -------------------------------------------------------------------------------- /oam-docker-ipam/Godeps/_workspace/src/github.com/coreos/etcd/client/util.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 CoreOS, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package client 16 | 17 | // IsKeyNotFound returns true if the error code is ErrorCodeKeyNotFound. 18 | func IsKeyNotFound(err error) bool { 19 | if cErr, ok := err.(Error); ok { 20 | return cErr.Code == ErrorCodeKeyNotFound 21 | } 22 | return false 23 | } 24 | -------------------------------------------------------------------------------- /oam-docker-ipam/Godeps/_workspace/src/github.com/coreos/etcd/pkg/pathutil/path.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 | // Package pathutil implements utility functions for handling slash-separated 6 | // paths. 7 | package pathutil 8 | 9 | import "path" 10 | 11 | // CanonicalURLPath returns the canonical url path for p, which follows the rules: 12 | // 1. the path always starts with "/" 13 | // 2. replace multiple slashes with a single slash 14 | // 3. replace each '.' '..' path name element with equivalent one 15 | // 4. keep the trailing slash 16 | // The function is borrowed from stdlib http.cleanPath in server.go. 17 | func CanonicalURLPath(p string) string { 18 | if p == "" { 19 | return "/" 20 | } 21 | if p[0] != '/' { 22 | p = "/" + p 23 | } 24 | np := path.Clean(p) 25 | // path.Clean removes trailing slash except for root, 26 | // put the trailing slash back if necessary. 27 | if p[len(p)-1] == '/' && np != "/" { 28 | np += "/" 29 | } 30 | return np 31 | } 32 | -------------------------------------------------------------------------------- /oam-docker-ipam/Godeps/_workspace/src/github.com/coreos/etcd/pkg/types/doc.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 CoreOS, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | // Package types declares various data types and implements type-checking 16 | // functions. 17 | package types 18 | -------------------------------------------------------------------------------- /oam-docker-ipam/Godeps/_workspace/src/github.com/coreos/etcd/pkg/types/id.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 CoreOS, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package types 16 | 17 | import ( 18 | "strconv" 19 | ) 20 | 21 | // ID represents a generic identifier which is canonically 22 | // stored as a uint64 but is typically represented as a 23 | // base-16 string for input/output 24 | type ID uint64 25 | 26 | func (i ID) String() string { 27 | return strconv.FormatUint(uint64(i), 16) 28 | } 29 | 30 | // IDFromString attempts to create an ID from a base-16 string. 31 | func IDFromString(s string) (ID, error) { 32 | i, err := strconv.ParseUint(s, 16, 64) 33 | return ID(i), err 34 | } 35 | 36 | // IDSlice implements the sort interface 37 | type IDSlice []ID 38 | 39 | func (p IDSlice) Len() int { return len(p) } 40 | func (p IDSlice) Less(i, j int) bool { return uint64(p[i]) < uint64(p[j]) } 41 | func (p IDSlice) Swap(i, j int) { p[i], p[j] = p[j], p[i] } 42 | -------------------------------------------------------------------------------- /oam-docker-ipam/Godeps/_workspace/src/github.com/coreos/etcd/pkg/types/slice.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 CoreOS, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package types 16 | 17 | // Uint64Slice implements sort interface 18 | type Uint64Slice []uint64 19 | 20 | func (p Uint64Slice) Len() int { return len(p) } 21 | func (p Uint64Slice) Less(i, j int) bool { return p[i] < p[j] } 22 | func (p Uint64Slice) Swap(i, j int) { p[i], p[j] = p[j], p[i] } 23 | -------------------------------------------------------------------------------- /oam-docker-ipam/Godeps/_workspace/src/github.com/coreos/etcd/pkg/types/urls.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 CoreOS, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package types 16 | 17 | import ( 18 | "errors" 19 | "fmt" 20 | "net" 21 | "net/url" 22 | "sort" 23 | "strings" 24 | ) 25 | 26 | type URLs []url.URL 27 | 28 | func NewURLs(strs []string) (URLs, error) { 29 | all := make([]url.URL, len(strs)) 30 | if len(all) == 0 { 31 | return nil, errors.New("no valid URLs given") 32 | } 33 | for i, in := range strs { 34 | in = strings.TrimSpace(in) 35 | u, err := url.Parse(in) 36 | if err != nil { 37 | return nil, err 38 | } 39 | if u.Scheme != "http" && u.Scheme != "https" { 40 | return nil, fmt.Errorf("URL scheme must be http or https: %s", in) 41 | } 42 | if _, _, err := net.SplitHostPort(u.Host); err != nil { 43 | return nil, fmt.Errorf(`URL address does not have the form "host:port": %s`, in) 44 | } 45 | if u.Path != "" { 46 | return nil, fmt.Errorf("URL must not contain a path: %s", in) 47 | } 48 | all[i] = *u 49 | } 50 | us := URLs(all) 51 | us.Sort() 52 | 53 | return us, nil 54 | } 55 | 56 | func MustNewURLs(strs []string) URLs { 57 | urls, err := NewURLs(strs) 58 | if err != nil { 59 | panic(err) 60 | } 61 | return urls 62 | } 63 | 64 | func (us URLs) String() string { 65 | return strings.Join(us.StringSlice(), ",") 66 | } 67 | 68 | func (us *URLs) Sort() { 69 | sort.Sort(us) 70 | } 71 | func (us URLs) Len() int { return len(us) } 72 | func (us URLs) Less(i, j int) bool { return us[i].String() < us[j].String() } 73 | func (us URLs) Swap(i, j int) { us[i], us[j] = us[j], us[i] } 74 | 75 | func (us URLs) StringSlice() []string { 76 | out := make([]string, len(us)) 77 | for i := range us { 78 | out[i] = us[i].String() 79 | } 80 | 81 | return out 82 | } 83 | -------------------------------------------------------------------------------- /oam-docker-ipam/Godeps/_workspace/src/github.com/coreos/etcd/pkg/types/urlsmap.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 CoreOS, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package types 16 | 17 | import ( 18 | "fmt" 19 | "sort" 20 | "strings" 21 | ) 22 | 23 | // URLsMap is a map from a name to its URLs. 24 | type URLsMap map[string]URLs 25 | 26 | // NewURLsMap returns a URLsMap instantiated from the given string, 27 | // which consists of discovery-formatted names-to-URLs, like: 28 | // mach0=http://1.1.1.1:2380,mach0=http://2.2.2.2::2380,mach1=http://3.3.3.3:2380,mach2=http://4.4.4.4:2380 29 | func NewURLsMap(s string) (URLsMap, error) { 30 | m := parse(s) 31 | 32 | cl := URLsMap{} 33 | for name, urls := range m { 34 | us, err := NewURLs(urls) 35 | if err != nil { 36 | return nil, err 37 | } 38 | cl[name] = us 39 | } 40 | return cl, nil 41 | } 42 | 43 | // String turns URLsMap into discovery-formatted name-to-URLs sorted by name. 44 | func (c URLsMap) String() string { 45 | var pairs []string 46 | for name, urls := range c { 47 | for _, url := range urls { 48 | pairs = append(pairs, fmt.Sprintf("%s=%s", name, url.String())) 49 | } 50 | } 51 | sort.Strings(pairs) 52 | return strings.Join(pairs, ",") 53 | } 54 | 55 | // URLs returns a list of all URLs. 56 | // The returned list is sorted in ascending lexicographical order. 57 | func (c URLsMap) URLs() []string { 58 | var urls []string 59 | for _, us := range c { 60 | for _, u := range us { 61 | urls = append(urls, u.String()) 62 | } 63 | } 64 | sort.Strings(urls) 65 | return urls 66 | } 67 | 68 | // Len returns the size of URLsMap. 69 | func (c URLsMap) Len() int { 70 | return len(c) 71 | } 72 | 73 | // parse parses the given string and returns a map listing the values specified for each key. 74 | func parse(s string) map[string][]string { 75 | m := make(map[string][]string) 76 | for s != "" { 77 | key := s 78 | if i := strings.IndexAny(key, ","); i >= 0 { 79 | key, s = key[:i], key[i+1:] 80 | } else { 81 | s = "" 82 | } 83 | if key == "" { 84 | continue 85 | } 86 | value := "" 87 | if i := strings.Index(key, "="); i >= 0 { 88 | key, value = key[:i], key[i+1:] 89 | } 90 | m[key] = append(m[key], value) 91 | } 92 | return m 93 | } 94 | -------------------------------------------------------------------------------- /oam-docker-ipam/Godeps/_workspace/src/github.com/coreos/go-systemd/activation/files.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 CoreOS, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | // Package activation implements primitives for systemd socket activation. 16 | package activation 17 | 18 | import ( 19 | "os" 20 | "strconv" 21 | "syscall" 22 | ) 23 | 24 | // based on: https://gist.github.com/alberts/4640792 25 | const ( 26 | listenFdsStart = 3 27 | ) 28 | 29 | func Files(unsetEnv bool) []*os.File { 30 | if unsetEnv { 31 | defer os.Unsetenv("LISTEN_PID") 32 | defer os.Unsetenv("LISTEN_FDS") 33 | } 34 | 35 | pid, err := strconv.Atoi(os.Getenv("LISTEN_PID")) 36 | if err != nil || pid != os.Getpid() { 37 | return nil 38 | } 39 | 40 | nfds, err := strconv.Atoi(os.Getenv("LISTEN_FDS")) 41 | if err != nil || nfds == 0 { 42 | return nil 43 | } 44 | 45 | files := make([]*os.File, 0, nfds) 46 | for fd := listenFdsStart; fd < listenFdsStart+nfds; fd++ { 47 | syscall.CloseOnExec(fd) 48 | files = append(files, os.NewFile(uintptr(fd), "LISTEN_FD_"+strconv.Itoa(fd))) 49 | } 50 | 51 | return files 52 | } 53 | -------------------------------------------------------------------------------- /oam-docker-ipam/Godeps/_workspace/src/github.com/coreos/go-systemd/activation/listeners.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 CoreOS, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package activation 16 | 17 | import ( 18 | "crypto/tls" 19 | "net" 20 | ) 21 | 22 | // Listeners returns a slice containing a net.Listener for each matching socket type 23 | // passed to this process. 24 | // 25 | // The order of the file descriptors is preserved in the returned slice. 26 | // Nil values are used to fill any gaps. For example if systemd were to return file descriptors 27 | // corresponding with "udp, tcp, tcp", then the slice would contain {nil, net.Listener, net.Listener} 28 | func Listeners(unsetEnv bool) ([]net.Listener, error) { 29 | files := Files(unsetEnv) 30 | listeners := make([]net.Listener, len(files)) 31 | 32 | for i, f := range files { 33 | if pc, err := net.FileListener(f); err == nil { 34 | listeners[i] = pc 35 | } 36 | } 37 | return listeners, nil 38 | } 39 | 40 | // TLSListeners returns a slice containing a net.listener for each matching TCP socket type 41 | // passed to this process. 42 | // It uses default Listeners func and forces TCP sockets handlers to use TLS based on tlsConfig. 43 | func TLSListeners(unsetEnv bool, tlsConfig *tls.Config) ([]net.Listener, error) { 44 | listeners, err := Listeners(unsetEnv) 45 | 46 | if listeners == nil || err != nil { 47 | return nil, err 48 | } 49 | 50 | if tlsConfig != nil && err == nil { 51 | tlsConfig.NextProtos = []string{"http/1.1"} 52 | 53 | for i, l := range listeners { 54 | // Activate TLS only for TCP sockets 55 | if l.Addr().Network() == "tcp" { 56 | listeners[i] = tls.NewListener(l, tlsConfig) 57 | } 58 | } 59 | } 60 | 61 | return listeners, err 62 | } 63 | -------------------------------------------------------------------------------- /oam-docker-ipam/Godeps/_workspace/src/github.com/coreos/go-systemd/activation/packetconns.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 CoreOS, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package activation 16 | 17 | import ( 18 | "net" 19 | ) 20 | 21 | // PacketConns returns a slice containing a net.PacketConn for each matching socket type 22 | // passed to this process. 23 | // 24 | // The order of the file descriptors is preserved in the returned slice. 25 | // Nil values are used to fill any gaps. For example if systemd were to return file descriptors 26 | // corresponding with "udp, tcp, udp", then the slice would contain {net.PacketConn, nil, net.PacketConn} 27 | func PacketConns(unsetEnv bool) ([]net.PacketConn, error) { 28 | files := Files(unsetEnv) 29 | conns := make([]net.PacketConn, len(files)) 30 | 31 | for i, f := range files { 32 | if pc, err := net.FilePacketConn(f); err == nil { 33 | conns[i] = pc 34 | } 35 | } 36 | return conns, nil 37 | } 38 | -------------------------------------------------------------------------------- /oam-docker-ipam/Godeps/_workspace/src/github.com/docker/go-connections/sockets/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TalkingData/Shrike/237332298c2b8e50bd280b3f041c90f57ed2efca/oam-docker-ipam/Godeps/_workspace/src/github.com/docker/go-connections/sockets/README.md -------------------------------------------------------------------------------- /oam-docker-ipam/Godeps/_workspace/src/github.com/docker/go-connections/sockets/inmem_socket.go: -------------------------------------------------------------------------------- 1 | package sockets 2 | 3 | import ( 4 | "errors" 5 | "net" 6 | "sync" 7 | ) 8 | 9 | var errClosed = errors.New("use of closed network connection") 10 | 11 | // InmemSocket implements net.Listener using in-memory only connections. 12 | type InmemSocket struct { 13 | chConn chan net.Conn 14 | chClose chan struct{} 15 | addr string 16 | mu sync.Mutex 17 | } 18 | 19 | // dummyAddr is used to satisfy net.Addr for the in-mem socket 20 | // it is just stored as a string and returns the string for all calls 21 | type dummyAddr string 22 | 23 | // NewInmemSocket creates an in-memory only net.Listener 24 | // The addr argument can be any string, but is used to satisfy the `Addr()` part 25 | // of the net.Listener interface 26 | func NewInmemSocket(addr string, bufSize int) *InmemSocket { 27 | return &InmemSocket{ 28 | chConn: make(chan net.Conn, bufSize), 29 | chClose: make(chan struct{}), 30 | addr: addr, 31 | } 32 | } 33 | 34 | // Addr returns the socket's addr string to satisfy net.Listener 35 | func (s *InmemSocket) Addr() net.Addr { 36 | return dummyAddr(s.addr) 37 | } 38 | 39 | // Accept implements the Accept method in the Listener interface; it waits for the next call and returns a generic Conn. 40 | func (s *InmemSocket) Accept() (net.Conn, error) { 41 | select { 42 | case conn := <-s.chConn: 43 | return conn, nil 44 | case <-s.chClose: 45 | return nil, errClosed 46 | } 47 | } 48 | 49 | // Close closes the listener. It will be unavailable for use once closed. 50 | func (s *InmemSocket) Close() error { 51 | s.mu.Lock() 52 | defer s.mu.Unlock() 53 | select { 54 | case <-s.chClose: 55 | default: 56 | close(s.chClose) 57 | } 58 | return nil 59 | } 60 | 61 | // Dial is used to establish a connection with the in-mem server 62 | func (s *InmemSocket) Dial(network, addr string) (net.Conn, error) { 63 | srvConn, clientConn := net.Pipe() 64 | select { 65 | case s.chConn <- srvConn: 66 | case <-s.chClose: 67 | return nil, errClosed 68 | } 69 | 70 | return clientConn, nil 71 | } 72 | 73 | // Network returns the addr string, satisfies net.Addr 74 | func (a dummyAddr) Network() string { 75 | return string(a) 76 | } 77 | 78 | // String returns the string form 79 | func (a dummyAddr) String() string { 80 | return string(a) 81 | } 82 | 83 | // timeoutError is used when there is a timeout with a connection 84 | // this implements the net.Error interface 85 | type timeoutError struct{} 86 | 87 | func (e *timeoutError) Error() string { return "i/o timeout" } 88 | func (e *timeoutError) Timeout() bool { return true } 89 | func (e *timeoutError) Temporary() bool { return true } 90 | -------------------------------------------------------------------------------- /oam-docker-ipam/Godeps/_workspace/src/github.com/docker/go-connections/sockets/proxy.go: -------------------------------------------------------------------------------- 1 | package sockets 2 | 3 | import ( 4 | "net" 5 | "net/url" 6 | "os" 7 | "strings" 8 | 9 | "golang.org/x/net/proxy" 10 | ) 11 | 12 | // GetProxyEnv allows access to the uppercase and the lowercase forms of 13 | // proxy-related variables. See the Go specification for details on these 14 | // variables. https://golang.org/pkg/net/http/ 15 | func GetProxyEnv(key string) string { 16 | proxyValue := os.Getenv(strings.ToUpper(key)) 17 | if proxyValue == "" { 18 | return os.Getenv(strings.ToLower(key)) 19 | } 20 | return proxyValue 21 | } 22 | 23 | // DialerFromEnvironment takes in a "direct" *net.Dialer and returns a 24 | // proxy.Dialer which will route the connections through the proxy using the 25 | // given dialer. 26 | func DialerFromEnvironment(direct *net.Dialer) (proxy.Dialer, error) { 27 | allProxy := GetProxyEnv("all_proxy") 28 | if len(allProxy) == 0 { 29 | return direct, nil 30 | } 31 | 32 | proxyURL, err := url.Parse(allProxy) 33 | if err != nil { 34 | return direct, err 35 | } 36 | 37 | proxyFromURL, err := proxy.FromURL(proxyURL, direct) 38 | if err != nil { 39 | return direct, err 40 | } 41 | 42 | noProxy := GetProxyEnv("no_proxy") 43 | if len(noProxy) == 0 { 44 | return proxyFromURL, nil 45 | } 46 | 47 | perHost := proxy.NewPerHost(proxyFromURL, direct) 48 | perHost.AddFromString(noProxy) 49 | 50 | return perHost, nil 51 | } 52 | -------------------------------------------------------------------------------- /oam-docker-ipam/Godeps/_workspace/src/github.com/docker/go-connections/sockets/sockets.go: -------------------------------------------------------------------------------- 1 | // Package sockets provides helper functions to create and configure Unix or TCP sockets. 2 | package sockets 3 | 4 | import ( 5 | "net" 6 | "net/http" 7 | "time" 8 | ) 9 | 10 | // Why 32? See https://github.com/docker/docker/pull/8035. 11 | const defaultTimeout = 32 * time.Second 12 | 13 | // ConfigureTransport configures the specified Transport according to the 14 | // specified proto and addr. 15 | // If the proto is unix (using a unix socket to communicate) or npipe the 16 | // compression is disabled. 17 | func ConfigureTransport(tr *http.Transport, proto, addr string) error { 18 | switch proto { 19 | case "unix": 20 | // No need for compression in local communications. 21 | tr.DisableCompression = true 22 | tr.Dial = func(_, _ string) (net.Conn, error) { 23 | return net.DialTimeout(proto, addr, defaultTimeout) 24 | } 25 | case "npipe": 26 | // No need for compression in local communications. 27 | tr.DisableCompression = true 28 | tr.Dial = func(_, _ string) (net.Conn, error) { 29 | return DialPipe(addr, defaultTimeout) 30 | } 31 | default: 32 | tr.Proxy = http.ProxyFromEnvironment 33 | dialer, err := DialerFromEnvironment(&net.Dialer{ 34 | Timeout: defaultTimeout, 35 | }) 36 | if err != nil { 37 | return err 38 | } 39 | tr.Dial = dialer.Dial 40 | } 41 | return nil 42 | } 43 | -------------------------------------------------------------------------------- /oam-docker-ipam/Godeps/_workspace/src/github.com/docker/go-connections/sockets/sockets_unix.go: -------------------------------------------------------------------------------- 1 | // +build !windows 2 | 3 | package sockets 4 | 5 | import ( 6 | "net" 7 | "syscall" 8 | "time" 9 | ) 10 | 11 | // DialPipe connects to a Windows named pipe. 12 | // This is not supported on other OSes. 13 | func DialPipe(_ string, _ time.Duration) (net.Conn, error) { 14 | return nil, syscall.EAFNOSUPPORT 15 | } 16 | -------------------------------------------------------------------------------- /oam-docker-ipam/Godeps/_workspace/src/github.com/docker/go-connections/sockets/sockets_windows.go: -------------------------------------------------------------------------------- 1 | package sockets 2 | 3 | import ( 4 | "net" 5 | "time" 6 | 7 | "github.com/Microsoft/go-winio" 8 | ) 9 | 10 | // DialPipe connects to a Windows named pipe. 11 | func DialPipe(addr string, timeout time.Duration) (net.Conn, error) { 12 | return winio.DialPipe(addr, &timeout) 13 | } 14 | -------------------------------------------------------------------------------- /oam-docker-ipam/Godeps/_workspace/src/github.com/docker/go-connections/sockets/tcp_socket.go: -------------------------------------------------------------------------------- 1 | // Package sockets provides helper functions to create and configure Unix or TCP sockets. 2 | package sockets 3 | 4 | import ( 5 | "crypto/tls" 6 | "net" 7 | ) 8 | 9 | // NewTCPSocket creates a TCP socket listener with the specified address and 10 | // and the specified tls configuration. If TLSConfig is set, will encapsulate the 11 | // TCP listener inside a TLS one. 12 | func NewTCPSocket(addr string, tlsConfig *tls.Config) (net.Listener, error) { 13 | l, err := net.Listen("tcp", addr) 14 | if err != nil { 15 | return nil, err 16 | } 17 | if tlsConfig != nil { 18 | tlsConfig.NextProtos = []string{"http/1.1"} 19 | l = tls.NewListener(l, tlsConfig) 20 | } 21 | return l, nil 22 | } 23 | -------------------------------------------------------------------------------- /oam-docker-ipam/Godeps/_workspace/src/github.com/docker/go-connections/sockets/unix_socket.go: -------------------------------------------------------------------------------- 1 | // +build linux freebsd solaris 2 | 3 | package sockets 4 | 5 | import ( 6 | "fmt" 7 | "net" 8 | "os" 9 | "strconv" 10 | "syscall" 11 | 12 | "github.com/Sirupsen/logrus" 13 | "github.com/opencontainers/runc/libcontainer/user" 14 | ) 15 | 16 | // NewUnixSocket creates a unix socket with the specified path and group. 17 | func NewUnixSocket(path, group string) (net.Listener, error) { 18 | if err := syscall.Unlink(path); err != nil && !os.IsNotExist(err) { 19 | return nil, err 20 | } 21 | mask := syscall.Umask(0777) 22 | defer syscall.Umask(mask) 23 | l, err := net.Listen("unix", path) 24 | if err != nil { 25 | return nil, err 26 | } 27 | if err := setSocketGroup(path, group); err != nil { 28 | l.Close() 29 | return nil, err 30 | } 31 | if err := os.Chmod(path, 0660); err != nil { 32 | l.Close() 33 | return nil, err 34 | } 35 | return l, nil 36 | } 37 | 38 | func setSocketGroup(path, group string) error { 39 | if group == "" { 40 | return nil 41 | } 42 | if err := changeGroup(path, group); err != nil { 43 | if group != "docker" { 44 | return err 45 | } 46 | logrus.Debugf("Warning: could not change group %s to docker: %v", path, err) 47 | } 48 | return nil 49 | } 50 | 51 | func changeGroup(path string, nameOrGid string) error { 52 | gid, err := lookupGidByName(nameOrGid) 53 | if err != nil { 54 | return err 55 | } 56 | logrus.Debugf("%s group found. gid: %d", nameOrGid, gid) 57 | return os.Chown(path, 0, gid) 58 | } 59 | 60 | func lookupGidByName(nameOrGid string) (int, error) { 61 | groupFile, err := user.GetGroupPath() 62 | if err != nil { 63 | return -1, err 64 | } 65 | groups, err := user.ParseGroupFileFilter(groupFile, func(g user.Group) bool { 66 | return g.Name == nameOrGid || strconv.Itoa(g.Gid) == nameOrGid 67 | }) 68 | if err != nil { 69 | return -1, err 70 | } 71 | if groups != nil && len(groups) > 0 { 72 | return groups[0].Gid, nil 73 | } 74 | gid, err := strconv.Atoi(nameOrGid) 75 | if err == nil { 76 | logrus.Warnf("Could not find GID %d", gid) 77 | return gid, nil 78 | } 79 | return -1, fmt.Errorf("Group %s not found", nameOrGid) 80 | } 81 | -------------------------------------------------------------------------------- /oam-docker-ipam/Godeps/_workspace/src/github.com/docker/go-plugins-helpers/NOTICE: -------------------------------------------------------------------------------- 1 | Docker 2 | Copyright 2012-2015 Docker, Inc. 3 | 4 | This product includes software developed at Docker, Inc. (https://www.docker.com). 5 | 6 | This product contains software (https://github.com/kr/pty) developed 7 | by Keith Rarick, licensed under the MIT License. 8 | 9 | The following is courtesy of our legal counsel: 10 | 11 | 12 | Use and transfer of Docker may be subject to certain restrictions by the 13 | United States and other governments. 14 | It is your responsibility to ensure that your use and/or transfer does not 15 | violate applicable laws. 16 | 17 | For more information, please see https://www.bis.doc.gov 18 | 19 | See also https://www.apache.org/dev/crypto.html and/or seek legal counsel. 20 | -------------------------------------------------------------------------------- /oam-docker-ipam/Godeps/_workspace/src/github.com/docker/go-plugins-helpers/ipam/README.md: -------------------------------------------------------------------------------- 1 | # Docker IPAM extension API 2 | 3 | Go handler to create external IPAM extensions for Docker. 4 | 5 | ## Usage 6 | 7 | This library is designed to be integrated in your program. 8 | 9 | 1. Implement the `ipam.Driver` interface. 10 | 2. Initialize a `ipam.Handler` with your implementation. 11 | 3. Call either `ServeTCP` or `ServeUnix` from the `ipam.Handler`. 12 | 13 | ### Example using TCP sockets: 14 | 15 | ```go 16 | import "github.com/docker/go-plugins-helpers/ipam" 17 | 18 | d := MyIPAMDriver{} 19 | h := ipam.NewHandler(d) 20 | h.ServeTCP("test_ipam", ":8080") 21 | ``` 22 | 23 | ### Example using Unix sockets: 24 | 25 | ```go 26 | import "github.com/docker/go-plugins-helpers/ipam" 27 | 28 | d := MyIPAMDriver{} 29 | h := ipam.NewHandler(d) 30 | h.ServeUnix("root", "test_ipam") 31 | ``` 32 | -------------------------------------------------------------------------------- /oam-docker-ipam/Godeps/_workspace/src/github.com/docker/go-plugins-helpers/sdk/encoder.go: -------------------------------------------------------------------------------- 1 | package sdk 2 | 3 | import ( 4 | "encoding/json" 5 | "net/http" 6 | ) 7 | 8 | // DefaultContentTypeV1_1 is the default content type accepted and sent by the plugins. 9 | const DefaultContentTypeV1_1 = "application/vnd.docker.plugins.v1.1+json" 10 | 11 | // DecodeRequest decodes an http request into a given structure. 12 | func DecodeRequest(w http.ResponseWriter, r *http.Request, req interface{}) (err error) { 13 | if err = json.NewDecoder(r.Body).Decode(req); err != nil { 14 | http.Error(w, err.Error(), http.StatusBadRequest) 15 | } 16 | return 17 | } 18 | 19 | // EncodeResponse encodes the given structure into an http response. 20 | func EncodeResponse(w http.ResponseWriter, res interface{}, err string) { 21 | w.Header().Set("Content-Type", DefaultContentTypeV1_1) 22 | if err != "" { 23 | w.WriteHeader(http.StatusInternalServerError) 24 | } 25 | json.NewEncoder(w).Encode(res) 26 | } 27 | -------------------------------------------------------------------------------- /oam-docker-ipam/Godeps/_workspace/src/github.com/docker/go-plugins-helpers/sdk/handler.go: -------------------------------------------------------------------------------- 1 | package sdk 2 | 3 | import ( 4 | "fmt" 5 | "net" 6 | "net/http" 7 | "os" 8 | ) 9 | 10 | const activatePath = "/Plugin.Activate" 11 | 12 | // Handler is the base to create plugin handlers. 13 | // It initializes connections and sockets to listen to. 14 | type Handler struct { 15 | mux *http.ServeMux 16 | } 17 | 18 | // NewHandler creates a new Handler with an http mux. 19 | func NewHandler(manifest string) Handler { 20 | mux := http.NewServeMux() 21 | 22 | mux.HandleFunc(activatePath, func(w http.ResponseWriter, r *http.Request) { 23 | w.Header().Set("Content-Type", DefaultContentTypeV1_1) 24 | fmt.Fprintln(w, manifest) 25 | }) 26 | 27 | return Handler{mux: mux} 28 | } 29 | 30 | // Serve sets up the handler to serve requests on the passed in listener 31 | func (h Handler) Serve(l net.Listener) error { 32 | server := http.Server{ 33 | Addr: l.Addr().String(), 34 | Handler: h.mux, 35 | } 36 | return server.Serve(l) 37 | } 38 | 39 | // ServeTCP makes the handler to listen for request in a given TCP address. 40 | // It also writes the spec file on the right directory for docker to read. 41 | func (h Handler) ServeTCP(pluginName, addr string) error { 42 | return h.listenAndServe("tcp", addr, pluginName) 43 | } 44 | 45 | // ServeUnix makes the handler to listen for requests in a unix socket. 46 | // It also creates the socket file on the right directory for docker to read. 47 | func (h Handler) ServeUnix(systemGroup, addr string) error { 48 | return h.listenAndServe("unix", addr, systemGroup) 49 | } 50 | 51 | // HandleFunc registers a function to handle a request path with. 52 | func (h Handler) HandleFunc(path string, fn func(w http.ResponseWriter, r *http.Request)) { 53 | h.mux.HandleFunc(path, fn) 54 | } 55 | 56 | func (h Handler) listenAndServe(proto, addr, group string) error { 57 | var ( 58 | err error 59 | spec string 60 | l net.Listener 61 | ) 62 | 63 | server := http.Server{ 64 | Addr: addr, 65 | Handler: h.mux, 66 | } 67 | 68 | switch proto { 69 | case "tcp": 70 | l, spec, err = newTCPListener(addr, group) 71 | case "unix": 72 | l, spec, err = newUnixListener(addr, group) 73 | } 74 | 75 | if spec != "" { 76 | defer os.Remove(spec) 77 | } 78 | if err != nil { 79 | return err 80 | } 81 | 82 | return server.Serve(l) 83 | } 84 | -------------------------------------------------------------------------------- /oam-docker-ipam/Godeps/_workspace/src/github.com/docker/go-plugins-helpers/sdk/tcp_listener.go: -------------------------------------------------------------------------------- 1 | package sdk 2 | 3 | import ( 4 | "io/ioutil" 5 | "net" 6 | "os" 7 | "path/filepath" 8 | 9 | "github.com/docker/go-connections/sockets" 10 | ) 11 | 12 | const ( 13 | pluginSpecDir = "/etc/docker/plugins" 14 | ) 15 | 16 | func newTCPListener(address string, pluginName string) (net.Listener, string, error) { 17 | listener, err := sockets.NewTCPSocket(address, nil) 18 | if err != nil { 19 | return nil, "", err 20 | } 21 | spec, err := writeSpec(pluginName, listener.Addr().String()) 22 | if err != nil { 23 | return nil, "", err 24 | } 25 | return listener, spec, nil 26 | } 27 | 28 | func writeSpec(name string, address string) (string, error) { 29 | if err := os.MkdirAll(pluginSpecDir, 0755); err != nil { 30 | return "", err 31 | } 32 | spec := filepath.Join(pluginSpecDir, name+".spec") 33 | url := "tcp://" + address 34 | if err := ioutil.WriteFile(spec, []byte(url), 0644); err != nil { 35 | return "", err 36 | } 37 | return spec, nil 38 | } 39 | -------------------------------------------------------------------------------- /oam-docker-ipam/Godeps/_workspace/src/github.com/docker/go-plugins-helpers/sdk/unix_listener.go: -------------------------------------------------------------------------------- 1 | // +build linux freebsd 2 | 3 | package sdk 4 | 5 | import ( 6 | "fmt" 7 | "net" 8 | "os" 9 | "path/filepath" 10 | 11 | "github.com/coreos/go-systemd/activation" 12 | "github.com/coreos/go-systemd/util" 13 | "github.com/docker/go-connections/sockets" 14 | ) 15 | 16 | const ( 17 | pluginSockDir = "/run/docker/plugins" 18 | ) 19 | 20 | func newUnixListener(pluginName string, group string) (net.Listener, string, error) { 21 | path, err := fullSocketAddress(pluginName) 22 | if err != nil { 23 | return nil, "", err 24 | } 25 | listener, err := setupSocketActivation() 26 | if err != nil { 27 | return nil, "", err 28 | } 29 | if listener == nil { 30 | listener, err = sockets.NewUnixSocket(path, group) 31 | if err != nil { 32 | return nil, "", err 33 | } 34 | } 35 | return listener, path, nil 36 | } 37 | 38 | func fullSocketAddress(address string) (string, error) { 39 | if err := os.MkdirAll(pluginSockDir, 0755); err != nil { 40 | return "", err 41 | } 42 | if filepath.IsAbs(address) { 43 | return address, nil 44 | } 45 | return filepath.Join(pluginSockDir, address+".sock"), nil 46 | } 47 | 48 | func setupSocketActivation() (net.Listener, error) { 49 | if !util.IsRunningSystemd() { 50 | return nil, nil 51 | } 52 | listenFds := activation.Files(false) 53 | if len(listenFds) > 1 { 54 | return nil, fmt.Errorf("expected only one socket from systemd, got %d", len(listenFds)) 55 | } 56 | var listener net.Listener 57 | if len(listenFds) == 1 { 58 | l, err := net.FileListener(listenFds[0]) 59 | if err != nil { 60 | return nil, err 61 | } 62 | listener = l 63 | } 64 | return listener, nil 65 | } 66 | -------------------------------------------------------------------------------- /oam-docker-ipam/Godeps/_workspace/src/github.com/docker/go-plugins-helpers/sdk/unix_listener_unsupported.go: -------------------------------------------------------------------------------- 1 | // +build !linux,!freebsd 2 | 3 | package sdk 4 | 5 | import ( 6 | "errors" 7 | "net" 8 | ) 9 | 10 | var ( 11 | errOnlySupportedOnLinuxAndFreeBSD = errors.New("unix socket creation is only supported on linux and freebsd") 12 | ) 13 | 14 | func newUnixListener(pluginName string, group string) (net.Listener, string, error) { 15 | return nil, "", errOnlySupportedOnLinuxAndFreeBSD 16 | } 17 | -------------------------------------------------------------------------------- /oam-docker-ipam/Godeps/_workspace/src/github.com/opencontainers/runc/NOTICE: -------------------------------------------------------------------------------- 1 | runc 2 | 3 | Copyright 2012-2015 Docker, Inc. 4 | 5 | This product includes software developed at Docker, Inc. (http://www.docker.com). 6 | 7 | The following is courtesy of our legal counsel: 8 | 9 | 10 | Use and transfer of Docker may be subject to certain restrictions by the 11 | United States and other governments. 12 | It is your responsibility to ensure that your use and/or transfer does not 13 | violate applicable laws. 14 | 15 | For more information, please see http://www.bis.doc.gov 16 | 17 | See also http://www.apache.org/dev/crypto.html and/or seek legal counsel. 18 | -------------------------------------------------------------------------------- /oam-docker-ipam/Godeps/_workspace/src/github.com/opencontainers/runc/libcontainer/user/MAINTAINERS: -------------------------------------------------------------------------------- 1 | Tianon Gravi (@tianon) 2 | Aleksa Sarai (@cyphar) 3 | -------------------------------------------------------------------------------- /oam-docker-ipam/Godeps/_workspace/src/github.com/opencontainers/runc/libcontainer/user/lookup.go: -------------------------------------------------------------------------------- 1 | package user 2 | 3 | import ( 4 | "errors" 5 | "syscall" 6 | ) 7 | 8 | var ( 9 | // The current operating system does not provide the required data for user lookups. 10 | ErrUnsupported = errors.New("user lookup: operating system does not provide passwd-formatted data") 11 | // No matching entries found in file. 12 | ErrNoPasswdEntries = errors.New("no matching entries in passwd file") 13 | ErrNoGroupEntries = errors.New("no matching entries in group file") 14 | ) 15 | 16 | func lookupUser(filter func(u User) bool) (User, error) { 17 | // Get operating system-specific passwd reader-closer. 18 | passwd, err := GetPasswd() 19 | if err != nil { 20 | return User{}, err 21 | } 22 | defer passwd.Close() 23 | 24 | // Get the users. 25 | users, err := ParsePasswdFilter(passwd, filter) 26 | if err != nil { 27 | return User{}, err 28 | } 29 | 30 | // No user entries found. 31 | if len(users) == 0 { 32 | return User{}, ErrNoPasswdEntries 33 | } 34 | 35 | // Assume the first entry is the "correct" one. 36 | return users[0], nil 37 | } 38 | 39 | // CurrentUser looks up the current user by their user id in /etc/passwd. If the 40 | // user cannot be found (or there is no /etc/passwd file on the filesystem), 41 | // then CurrentUser returns an error. 42 | func CurrentUser() (User, error) { 43 | return LookupUid(syscall.Getuid()) 44 | } 45 | 46 | // LookupUser looks up a user by their username in /etc/passwd. If the user 47 | // cannot be found (or there is no /etc/passwd file on the filesystem), then 48 | // LookupUser returns an error. 49 | func LookupUser(username string) (User, error) { 50 | return lookupUser(func(u User) bool { 51 | return u.Name == username 52 | }) 53 | } 54 | 55 | // LookupUid looks up a user by their user id in /etc/passwd. If the user cannot 56 | // be found (or there is no /etc/passwd file on the filesystem), then LookupId 57 | // returns an error. 58 | func LookupUid(uid int) (User, error) { 59 | return lookupUser(func(u User) bool { 60 | return u.Uid == uid 61 | }) 62 | } 63 | 64 | func lookupGroup(filter func(g Group) bool) (Group, error) { 65 | // Get operating system-specific group reader-closer. 66 | group, err := GetGroup() 67 | if err != nil { 68 | return Group{}, err 69 | } 70 | defer group.Close() 71 | 72 | // Get the users. 73 | groups, err := ParseGroupFilter(group, filter) 74 | if err != nil { 75 | return Group{}, err 76 | } 77 | 78 | // No user entries found. 79 | if len(groups) == 0 { 80 | return Group{}, ErrNoGroupEntries 81 | } 82 | 83 | // Assume the first entry is the "correct" one. 84 | return groups[0], nil 85 | } 86 | 87 | // CurrentGroup looks up the current user's group by their primary group id's 88 | // entry in /etc/passwd. If the group cannot be found (or there is no 89 | // /etc/group file on the filesystem), then CurrentGroup returns an error. 90 | func CurrentGroup() (Group, error) { 91 | return LookupGid(syscall.Getgid()) 92 | } 93 | 94 | // LookupGroup looks up a group by its name in /etc/group. If the group cannot 95 | // be found (or there is no /etc/group file on the filesystem), then LookupGroup 96 | // returns an error. 97 | func LookupGroup(groupname string) (Group, error) { 98 | return lookupGroup(func(g Group) bool { 99 | return g.Name == groupname 100 | }) 101 | } 102 | 103 | // LookupGid looks up a group by its group id in /etc/group. If the group cannot 104 | // be found (or there is no /etc/group file on the filesystem), then LookupGid 105 | // returns an error. 106 | func LookupGid(gid int) (Group, error) { 107 | return lookupGroup(func(g Group) bool { 108 | return g.Gid == gid 109 | }) 110 | } 111 | -------------------------------------------------------------------------------- /oam-docker-ipam/Godeps/_workspace/src/github.com/opencontainers/runc/libcontainer/user/lookup_unix.go: -------------------------------------------------------------------------------- 1 | // +build darwin dragonfly freebsd linux netbsd openbsd solaris 2 | 3 | package user 4 | 5 | import ( 6 | "io" 7 | "os" 8 | ) 9 | 10 | // Unix-specific path to the passwd and group formatted files. 11 | const ( 12 | unixPasswdPath = "/etc/passwd" 13 | unixGroupPath = "/etc/group" 14 | ) 15 | 16 | func GetPasswdPath() (string, error) { 17 | return unixPasswdPath, nil 18 | } 19 | 20 | func GetPasswd() (io.ReadCloser, error) { 21 | return os.Open(unixPasswdPath) 22 | } 23 | 24 | func GetGroupPath() (string, error) { 25 | return unixGroupPath, nil 26 | } 27 | 28 | func GetGroup() (io.ReadCloser, error) { 29 | return os.Open(unixGroupPath) 30 | } 31 | -------------------------------------------------------------------------------- /oam-docker-ipam/Godeps/_workspace/src/github.com/opencontainers/runc/libcontainer/user/lookup_unsupported.go: -------------------------------------------------------------------------------- 1 | // +build !darwin,!dragonfly,!freebsd,!linux,!netbsd,!openbsd,!solaris 2 | 3 | package user 4 | 5 | import "io" 6 | 7 | func GetPasswdPath() (string, error) { 8 | return "", ErrUnsupported 9 | } 10 | 11 | func GetPasswd() (io.ReadCloser, error) { 12 | return nil, ErrUnsupported 13 | } 14 | 15 | func GetGroupPath() (string, error) { 16 | return "", ErrUnsupported 17 | } 18 | 19 | func GetGroup() (io.ReadCloser, error) { 20 | return nil, ErrUnsupported 21 | } 22 | -------------------------------------------------------------------------------- /oam-docker-ipam/Godeps/_workspace/src/github.com/ugorji/go/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2012-2015 Ugorji Nwoke. 4 | All rights reserved. 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, 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, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | -------------------------------------------------------------------------------- /oam-docker-ipam/Godeps/_workspace/src/github.com/ugorji/go/codec/fast-path.not.go: -------------------------------------------------------------------------------- 1 | // +build notfastpath 2 | 3 | package codec 4 | 5 | import "reflect" 6 | 7 | // The generated fast-path code is very large, and adds a few seconds to the build time. 8 | // This causes test execution, execution of small tools which use codec, etc 9 | // to take a long time. 10 | // 11 | // To mitigate, we now support the notfastpath tag. 12 | // This tag disables fastpath during build, allowing for faster build, test execution, 13 | // short-program runs, etc. 14 | 15 | func fastpathDecodeTypeSwitch(iv interface{}, d *Decoder) bool { return false } 16 | func fastpathEncodeTypeSwitch(iv interface{}, e *Encoder) bool { return false } 17 | func fastpathEncodeTypeSwitchSlice(iv interface{}, e *Encoder) bool { return false } 18 | func fastpathEncodeTypeSwitchMap(iv interface{}, e *Encoder) bool { return false } 19 | 20 | type fastpathT struct{} 21 | type fastpathE struct { 22 | rtid uintptr 23 | rt reflect.Type 24 | encfn func(*encFnInfo, reflect.Value) 25 | decfn func(*decFnInfo, reflect.Value) 26 | } 27 | type fastpathA [0]fastpathE 28 | 29 | func (x fastpathA) index(rtid uintptr) int { return -1 } 30 | 31 | var fastpathAV fastpathA 32 | var fastpathTV fastpathT 33 | -------------------------------------------------------------------------------- /oam-docker-ipam/Godeps/_workspace/src/github.com/ugorji/go/codec/gen-dec-array.go.tmpl: -------------------------------------------------------------------------------- 1 | {{var "v"}} := {{if not isArray}}*{{end}}{{ .Varname }} 2 | {{var "h"}}, {{var "l"}} := z.DecSliceHelperStart() {{/* // helper, containerLenS */}}{{if not isArray}} 3 | var {{var "c"}} bool {{/* // changed */}} 4 | _ = {{var "c"}}{{end}} 5 | if {{var "l"}} == 0 { 6 | {{if isSlice }}if {{var "v"}} == nil { 7 | {{var "v"}} = []{{ .Typ }}{} 8 | {{var "c"}} = true 9 | } else if len({{var "v"}}) != 0 { 10 | {{var "v"}} = {{var "v"}}[:0] 11 | {{var "c"}} = true 12 | } {{end}} {{if isChan }}if {{var "v"}} == nil { 13 | {{var "v"}} = make({{ .CTyp }}, 0) 14 | {{var "c"}} = true 15 | } {{end}} 16 | } else if {{var "l"}} > 0 { 17 | {{if isChan }}if {{var "v"}} == nil { 18 | {{var "rl"}}, _ = z.DecInferLen({{var "l"}}, z.DecBasicHandle().MaxInitLen, {{ .Size }}) 19 | {{var "v"}} = make({{ .CTyp }}, {{var "rl"}}) 20 | {{var "c"}} = true 21 | } 22 | for {{var "r"}} := 0; {{var "r"}} < {{var "l"}}; {{var "r"}}++ { 23 | {{var "h"}}.ElemContainerState({{var "r"}}) 24 | var {{var "t"}} {{ .Typ }} 25 | {{ $x := printf "%st%s" .TempVar .Rand }}{{ decLineVar $x }} 26 | {{var "v"}} <- {{var "t"}} 27 | } 28 | {{ else }} var {{var "rr"}}, {{var "rl"}} int {{/* // num2read, length of slice/array/chan */}} 29 | var {{var "rt"}} bool {{/* truncated */}} 30 | _, _ = {{var "rl"}}, {{var "rt"}} 31 | {{var "rr"}} = {{var "l"}} // len({{var "v"}}) 32 | if {{var "l"}} > cap({{var "v"}}) { 33 | {{if isArray }}z.DecArrayCannotExpand(len({{var "v"}}), {{var "l"}}) 34 | {{ else }}{{if not .Immutable }} 35 | {{var "rg"}} := len({{var "v"}}) > 0 36 | {{var "v2"}} := {{var "v"}} {{end}} 37 | {{var "rl"}}, {{var "rt"}} = z.DecInferLen({{var "l"}}, z.DecBasicHandle().MaxInitLen, {{ .Size }}) 38 | if {{var "rt"}} { 39 | if {{var "rl"}} <= cap({{var "v"}}) { 40 | {{var "v"}} = {{var "v"}}[:{{var "rl"}}] 41 | } else { 42 | {{var "v"}} = make([]{{ .Typ }}, {{var "rl"}}) 43 | } 44 | } else { 45 | {{var "v"}} = make([]{{ .Typ }}, {{var "rl"}}) 46 | } 47 | {{var "c"}} = true 48 | {{var "rr"}} = len({{var "v"}}) {{if not .Immutable }} 49 | if {{var "rg"}} { copy({{var "v"}}, {{var "v2"}}) } {{end}} {{end}}{{/* end not Immutable, isArray */}} 50 | } {{if isSlice }} else if {{var "l"}} != len({{var "v"}}) { 51 | {{var "v"}} = {{var "v"}}[:{{var "l"}}] 52 | {{var "c"}} = true 53 | } {{end}} {{/* end isSlice:47 */}} 54 | {{var "j"}} := 0 55 | for ; {{var "j"}} < {{var "rr"}} ; {{var "j"}}++ { 56 | {{var "h"}}.ElemContainerState({{var "j"}}) 57 | {{ $x := printf "%[1]vv%[2]v[%[1]vj%[2]v]" .TempVar .Rand }}{{ decLineVar $x }} 58 | } 59 | {{if isArray }}for ; {{var "j"}} < {{var "l"}} ; {{var "j"}}++ { 60 | {{var "h"}}.ElemContainerState({{var "j"}}) 61 | z.DecSwallow() 62 | } 63 | {{ else }}if {{var "rt"}} { 64 | for ; {{var "j"}} < {{var "l"}} ; {{var "j"}}++ { 65 | {{var "v"}} = append({{var "v"}}, {{ zero}}) 66 | {{var "h"}}.ElemContainerState({{var "j"}}) 67 | {{ $x := printf "%[1]vv%[2]v[%[1]vj%[2]v]" .TempVar .Rand }}{{ decLineVar $x }} 68 | } 69 | } {{end}} {{/* end isArray:56 */}} 70 | {{end}} {{/* end isChan:16 */}} 71 | } else { {{/* len < 0 */}} 72 | {{var "j"}} := 0 73 | for ; !r.CheckBreak(); {{var "j"}}++ { 74 | {{if isChan }} 75 | {{var "h"}}.ElemContainerState({{var "j"}}) 76 | var {{var "t"}} {{ .Typ }} 77 | {{ $x := printf "%st%s" .TempVar .Rand }}{{ decLineVar $x }} 78 | {{var "v"}} <- {{var "t"}} 79 | {{ else }} 80 | if {{var "j"}} >= len({{var "v"}}) { 81 | {{if isArray }}z.DecArrayCannotExpand(len({{var "v"}}), {{var "j"}}+1) 82 | {{ else }}{{var "v"}} = append({{var "v"}}, {{zero}})// var {{var "z"}} {{ .Typ }} 83 | {{var "c"}} = true {{end}} 84 | } 85 | {{var "h"}}.ElemContainerState({{var "j"}}) 86 | if {{var "j"}} < len({{var "v"}}) { 87 | {{ $x := printf "%[1]vv%[2]v[%[1]vj%[2]v]" .TempVar .Rand }}{{ decLineVar $x }} 88 | } else { 89 | z.DecSwallow() 90 | } 91 | {{end}} 92 | } 93 | {{if isSlice }}if {{var "j"}} < len({{var "v"}}) { 94 | {{var "v"}} = {{var "v"}}[:{{var "j"}}] 95 | {{var "c"}} = true 96 | } else if {{var "j"}} == 0 && {{var "v"}} == nil { 97 | {{var "v"}} = []{{ .Typ }}{} 98 | {{var "c"}} = true 99 | }{{end}} 100 | } 101 | {{var "h"}}.End() 102 | {{if not isArray }}if {{var "c"}} { 103 | *{{ .Varname }} = {{var "v"}} 104 | }{{end}} 105 | -------------------------------------------------------------------------------- /oam-docker-ipam/Godeps/_workspace/src/github.com/ugorji/go/codec/gen-dec-map.go.tmpl: -------------------------------------------------------------------------------- 1 | {{var "v"}} := *{{ .Varname }} 2 | {{var "l"}} := r.ReadMapStart() 3 | {{var "bh"}} := z.DecBasicHandle() 4 | if {{var "v"}} == nil { 5 | {{var "rl"}}, _ := z.DecInferLen({{var "l"}}, {{var "bh"}}.MaxInitLen, {{ .Size }}) 6 | {{var "v"}} = make(map[{{ .KTyp }}]{{ .Typ }}, {{var "rl"}}) 7 | *{{ .Varname }} = {{var "v"}} 8 | } 9 | var {{var "mk"}} {{ .KTyp }} 10 | var {{var "mv"}} {{ .Typ }} 11 | var {{var "mg"}} {{if decElemKindPtr}}, {{var "ms"}}, {{var "mok"}}{{end}} bool 12 | if {{var "bh"}}.MapValueReset { 13 | {{if decElemKindPtr}}{{var "mg"}} = true 14 | {{else if decElemKindIntf}}if !{{var "bh"}}.InterfaceReset { {{var "mg"}} = true } 15 | {{else if not decElemKindImmutable}}{{var "mg"}} = true 16 | {{end}} } 17 | if {{var "l"}} > 0 { 18 | for {{var "j"}} := 0; {{var "j"}} < {{var "l"}}; {{var "j"}}++ { 19 | z.DecSendContainerState(codecSelfer_containerMapKey{{ .Sfx }}) 20 | {{ $x := printf "%vmk%v" .TempVar .Rand }}{{ decLineVarK $x }} 21 | {{ if eq .KTyp "interface{}" }}{{/* // special case if a byte array. */}}if {{var "bv"}}, {{var "bok"}} := {{var "mk"}}.([]byte); {{var "bok"}} { 22 | {{var "mk"}} = string({{var "bv"}}) 23 | }{{ end }}{{if decElemKindPtr}} 24 | {{var "ms"}} = true{{end}} 25 | if {{var "mg"}} { 26 | {{if decElemKindPtr}}{{var "mv"}}, {{var "mok"}} = {{var "v"}}[{{var "mk"}}] 27 | if {{var "mok"}} { 28 | {{var "ms"}} = false 29 | } {{else}}{{var "mv"}} = {{var "v"}}[{{var "mk"}}] {{end}} 30 | } {{if not decElemKindImmutable}}else { {{var "mv"}} = {{decElemZero}} }{{end}} 31 | z.DecSendContainerState(codecSelfer_containerMapValue{{ .Sfx }}) 32 | {{ $x := printf "%vmv%v" .TempVar .Rand }}{{ decLineVar $x }} 33 | if {{if decElemKindPtr}} {{var "ms"}} && {{end}} {{var "v"}} != nil { 34 | {{var "v"}}[{{var "mk"}}] = {{var "mv"}} 35 | } 36 | } 37 | } else if {{var "l"}} < 0 { 38 | for {{var "j"}} := 0; !r.CheckBreak(); {{var "j"}}++ { 39 | z.DecSendContainerState(codecSelfer_containerMapKey{{ .Sfx }}) 40 | {{ $x := printf "%vmk%v" .TempVar .Rand }}{{ decLineVarK $x }} 41 | {{ if eq .KTyp "interface{}" }}{{/* // special case if a byte array. */}}if {{var "bv"}}, {{var "bok"}} := {{var "mk"}}.([]byte); {{var "bok"}} { 42 | {{var "mk"}} = string({{var "bv"}}) 43 | }{{ end }}{{if decElemKindPtr}} 44 | {{var "ms"}} = true {{ end }} 45 | if {{var "mg"}} { 46 | {{if decElemKindPtr}}{{var "mv"}}, {{var "mok"}} = {{var "v"}}[{{var "mk"}}] 47 | if {{var "mok"}} { 48 | {{var "ms"}} = false 49 | } {{else}}{{var "mv"}} = {{var "v"}}[{{var "mk"}}] {{end}} 50 | } {{if not decElemKindImmutable}}else { {{var "mv"}} = {{decElemZero}} }{{end}} 51 | z.DecSendContainerState(codecSelfer_containerMapValue{{ .Sfx }}) 52 | {{ $x := printf "%vmv%v" .TempVar .Rand }}{{ decLineVar $x }} 53 | if {{if decElemKindPtr}} {{var "ms"}} && {{end}} {{var "v"}} != nil { 54 | {{var "v"}}[{{var "mk"}}] = {{var "mv"}} 55 | } 56 | } 57 | } // else len==0: TODO: Should we clear map entries? 58 | z.DecSendContainerState(codecSelfer_containerMapEnd{{ .Sfx }}) 59 | -------------------------------------------------------------------------------- /oam-docker-ipam/Godeps/_workspace/src/github.com/ugorji/go/codec/gen_15.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved. 2 | // Use of this source code is governed by a MIT license found in the LICENSE file. 3 | 4 | // +build go1.5,!go1.6 5 | 6 | package codec 7 | 8 | import "os" 9 | 10 | func init() { 11 | genCheckVendor = os.Getenv("GO15VENDOREXPERIMENT") == "1" 12 | } 13 | -------------------------------------------------------------------------------- /oam-docker-ipam/Godeps/_workspace/src/github.com/ugorji/go/codec/gen_16.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved. 2 | // Use of this source code is governed by a MIT license found in the LICENSE file. 3 | 4 | // +build go1.6 5 | 6 | package codec 7 | 8 | import "os" 9 | 10 | func init() { 11 | genCheckVendor = os.Getenv("GO15VENDOREXPERIMENT") != "0" 12 | } 13 | -------------------------------------------------------------------------------- /oam-docker-ipam/Godeps/_workspace/src/github.com/ugorji/go/codec/helper_not_unsafe.go: -------------------------------------------------------------------------------- 1 | //+build !unsafe 2 | 3 | // Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved. 4 | // Use of this source code is governed by a MIT license found in the LICENSE file. 5 | 6 | package codec 7 | 8 | // stringView returns a view of the []byte as a string. 9 | // In unsafe mode, it doesn't incur allocation and copying caused by conversion. 10 | // In regular safe mode, it is an allocation and copy. 11 | func stringView(v []byte) string { 12 | return string(v) 13 | } 14 | 15 | // bytesView returns a view of the string as a []byte. 16 | // In unsafe mode, it doesn't incur allocation and copying caused by conversion. 17 | // In regular safe mode, it is an allocation and copy. 18 | func bytesView(v string) []byte { 19 | return []byte(v) 20 | } 21 | -------------------------------------------------------------------------------- /oam-docker-ipam/Godeps/_workspace/src/github.com/ugorji/go/codec/helper_unsafe.go: -------------------------------------------------------------------------------- 1 | //+build unsafe 2 | 3 | // Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved. 4 | // Use of this source code is governed by a MIT license found in the LICENSE file. 5 | 6 | package codec 7 | 8 | import ( 9 | "unsafe" 10 | ) 11 | 12 | // This file has unsafe variants of some helper methods. 13 | 14 | type unsafeString struct { 15 | Data uintptr 16 | Len int 17 | } 18 | 19 | type unsafeSlice struct { 20 | Data uintptr 21 | Len int 22 | Cap int 23 | } 24 | 25 | // stringView returns a view of the []byte as a string. 26 | // In unsafe mode, it doesn't incur allocation and copying caused by conversion. 27 | // In regular safe mode, it is an allocation and copy. 28 | func stringView(v []byte) string { 29 | if len(v) == 0 { 30 | return "" 31 | } 32 | 33 | bx := (*unsafeSlice)(unsafe.Pointer(&v)) 34 | sx := unsafeString{bx.Data, bx.Len} 35 | return *(*string)(unsafe.Pointer(&sx)) 36 | } 37 | 38 | // bytesView returns a view of the string as a []byte. 39 | // In unsafe mode, it doesn't incur allocation and copying caused by conversion. 40 | // In regular safe mode, it is an allocation and copy. 41 | func bytesView(v string) []byte { 42 | if len(v) == 0 { 43 | return zeroByteSlice 44 | } 45 | 46 | sx := (*unsafeString)(unsafe.Pointer(&v)) 47 | bx := unsafeSlice{sx.Data, sx.Len, sx.Len} 48 | return *(*[]byte)(unsafe.Pointer(&bx)) 49 | } 50 | -------------------------------------------------------------------------------- /oam-docker-ipam/Godeps/_workspace/src/github.com/ugorji/go/codec/prebuild.go: -------------------------------------------------------------------------------- 1 | package codec 2 | 3 | //go:generate bash prebuild.sh 4 | -------------------------------------------------------------------------------- /oam-docker-ipam/Godeps/_workspace/src/github.com/ugorji/go/codec/tests.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Run all the different permutations of all the tests. 4 | # This helps ensure that nothing gets broken. 5 | 6 | _run() { 7 | # 1. VARIATIONS: regular (t), canonical (c), IO R/W (i), 8 | # binc-nosymbols (n), struct2array (s), intern string (e), 9 | # json-indent (d), circular (l) 10 | # 2. MODE: reflection (r), external (x), codecgen (g), unsafe (u), notfastpath (f) 11 | # 3. OPTIONS: verbose (v), reset (z), must (m), 12 | # 13 | # Use combinations of mode to get exactly what you want, 14 | # and then pass the variations you need. 15 | 16 | ztags="" 17 | zargs="" 18 | local OPTIND 19 | OPTIND=1 20 | while getopts "_xurtcinsvgzmefdl" flag 21 | do 22 | case "x$flag" in 23 | 'xr') ;; 24 | 'xf') ztags="$ztags notfastpath" ;; 25 | 'xg') ztags="$ztags codecgen" ;; 26 | 'xx') ztags="$ztags x" ;; 27 | 'xu') ztags="$ztags unsafe" ;; 28 | 'xv') zargs="$zargs -tv" ;; 29 | 'xz') zargs="$zargs -tr" ;; 30 | 'xm') zargs="$zargs -tm" ;; 31 | 'xl') zargs="$zargs -tl" ;; 32 | *) ;; 33 | esac 34 | done 35 | # shift $((OPTIND-1)) 36 | printf '............. TAGS: %s .............\n' "$ztags" 37 | # echo ">>>>>>> TAGS: $ztags" 38 | 39 | OPTIND=1 40 | while getopts "_xurtcinsvgzmefdl" flag 41 | do 42 | case "x$flag" in 43 | 'xt') printf ">>>>>>> REGULAR : "; go test "-tags=$ztags" $zargs ; sleep 2 ;; 44 | 'xc') printf ">>>>>>> CANONICAL : "; go test "-tags=$ztags" $zargs -tc; sleep 2 ;; 45 | 'xi') printf ">>>>>>> I/O : "; go test "-tags=$ztags" $zargs -ti; sleep 2 ;; 46 | 'xn') printf ">>>>>>> NO_SYMBOLS : "; go test "-tags=$ztags" -run=Binc $zargs -tn; sleep 2 ;; 47 | 'xs') printf ">>>>>>> TO_ARRAY : "; go test "-tags=$ztags" $zargs -ts; sleep 2 ;; 48 | 'xe') printf ">>>>>>> INTERN : "; go test "-tags=$ztags" $zargs -te; sleep 2 ;; 49 | 'xd') printf ">>>>>>> INDENT : "; 50 | go test "-tags=$ztags" -run=JsonCodecsTable -td=-1 $zargs; 51 | go test "-tags=$ztags" -run=JsonCodecsTable -td=8 $zargs; 52 | sleep 2 ;; 53 | *) ;; 54 | esac 55 | done 56 | shift $((OPTIND-1)) 57 | 58 | OPTIND=1 59 | } 60 | 61 | # echo ">>>>>>> RUNNING VARIATIONS OF TESTS" 62 | if [[ "x$@" = "x" ]]; then 63 | # All: r, x, g, gu 64 | _run "-_tcinsed_ml" # regular 65 | _run "-_tcinsed_ml_z" # regular with reset 66 | _run "-_tcinsed_ml_f" # regular with no fastpath (notfastpath) 67 | _run "-x_tcinsed_ml" # external 68 | _run "-gx_tcinsed_ml" # codecgen: requires external 69 | _run "-gxu_tcinsed_ml" # codecgen + unsafe 70 | elif [[ "x$@" = "x-Z" ]]; then 71 | # Regular 72 | _run "-_tcinsed_ml" # regular 73 | _run "-_tcinsed_ml_z" # regular with reset 74 | elif [[ "x$@" = "x-F" ]]; then 75 | # regular with notfastpath 76 | _run "-_tcinsed_ml_f" # regular 77 | _run "-_tcinsed_ml_zf" # regular with reset 78 | else 79 | _run "$@" 80 | fi 81 | -------------------------------------------------------------------------------- /oam-docker-ipam/Godeps/_workspace/src/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 | -------------------------------------------------------------------------------- /oam-docker-ipam/Godeps/_workspace/src/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 | -------------------------------------------------------------------------------- /oam-docker-ipam/Godeps/_workspace/src/golang.org/x/net/context/go17.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 go1.7 6 | 7 | package context 8 | 9 | import ( 10 | "context" // standard library's context, as of Go 1.7 11 | "time" 12 | ) 13 | 14 | var ( 15 | todo = context.TODO() 16 | background = context.Background() 17 | ) 18 | 19 | // Canceled is the error returned by Context.Err when the context is canceled. 20 | var Canceled = context.Canceled 21 | 22 | // DeadlineExceeded is the error returned by Context.Err when the context's 23 | // deadline passes. 24 | var DeadlineExceeded = context.DeadlineExceeded 25 | 26 | // WithCancel returns a copy of parent with a new Done channel. The returned 27 | // context's Done channel is closed when the returned cancel function is called 28 | // or when the parent context's Done channel is closed, whichever happens first. 29 | // 30 | // Canceling this context releases resources associated with it, so code should 31 | // call cancel as soon as the operations running in this Context complete. 32 | func WithCancel(parent Context) (ctx Context, cancel CancelFunc) { 33 | ctx, f := context.WithCancel(parent) 34 | return ctx, CancelFunc(f) 35 | } 36 | 37 | // WithDeadline returns a copy of the parent context with the deadline adjusted 38 | // to be no later than d. If the parent's deadline is already earlier than d, 39 | // WithDeadline(parent, d) is semantically equivalent to parent. The returned 40 | // context's Done channel is closed when the deadline expires, when the returned 41 | // cancel function is called, or when the parent context's Done channel is 42 | // closed, whichever happens first. 43 | // 44 | // Canceling this context releases resources associated with it, so code should 45 | // call cancel as soon as the operations running in this Context complete. 46 | func WithDeadline(parent Context, deadline time.Time) (Context, CancelFunc) { 47 | ctx, f := context.WithDeadline(parent, deadline) 48 | return ctx, CancelFunc(f) 49 | } 50 | 51 | // WithTimeout returns WithDeadline(parent, time.Now().Add(timeout)). 52 | // 53 | // Canceling this context releases resources associated with it, so code should 54 | // call cancel as soon as the operations running in this Context complete: 55 | // 56 | // func slowOperationWithTimeout(ctx context.Context) (Result, error) { 57 | // ctx, cancel := context.WithTimeout(ctx, 100*time.Millisecond) 58 | // defer cancel() // releases resources if slowOperation completes before timeout elapses 59 | // return slowOperation(ctx) 60 | // } 61 | func WithTimeout(parent Context, timeout time.Duration) (Context, CancelFunc) { 62 | return WithDeadline(parent, time.Now().Add(timeout)) 63 | } 64 | 65 | // WithValue returns a copy of parent in which the value associated with key is 66 | // val. 67 | // 68 | // Use context Values only for request-scoped data that transits processes and 69 | // APIs, not for passing optional parameters to functions. 70 | func WithValue(parent Context, key interface{}, val interface{}) Context { 71 | return context.WithValue(parent, key, val) 72 | } 73 | -------------------------------------------------------------------------------- /oam-docker-ipam/Godeps/_workspace/src/golang.org/x/net/proxy/direct.go: -------------------------------------------------------------------------------- 1 | // Copyright 2011 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 proxy 6 | 7 | import ( 8 | "net" 9 | ) 10 | 11 | type direct struct{} 12 | 13 | // Direct is a direct proxy: one that makes network connections directly. 14 | var Direct = direct{} 15 | 16 | func (direct) Dial(network, addr string) (net.Conn, error) { 17 | return net.Dial(network, addr) 18 | } 19 | -------------------------------------------------------------------------------- /oam-docker-ipam/Godeps/_workspace/src/golang.org/x/net/proxy/proxy.go: -------------------------------------------------------------------------------- 1 | // Copyright 2011 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 proxy provides support for a variety of protocols to proxy network 6 | // data. 7 | package proxy 8 | 9 | import ( 10 | "errors" 11 | "net" 12 | "net/url" 13 | "os" 14 | ) 15 | 16 | // A Dialer is a means to establish a connection. 17 | type Dialer interface { 18 | // Dial connects to the given address via the proxy. 19 | Dial(network, addr string) (c net.Conn, err error) 20 | } 21 | 22 | // Auth contains authentication parameters that specific Dialers may require. 23 | type Auth struct { 24 | User, Password string 25 | } 26 | 27 | // FromEnvironment returns the dialer specified by the proxy related variables in 28 | // the environment. 29 | func FromEnvironment() Dialer { 30 | allProxy := os.Getenv("all_proxy") 31 | if len(allProxy) == 0 { 32 | return Direct 33 | } 34 | 35 | proxyURL, err := url.Parse(allProxy) 36 | if err != nil { 37 | return Direct 38 | } 39 | proxy, err := FromURL(proxyURL, Direct) 40 | if err != nil { 41 | return Direct 42 | } 43 | 44 | noProxy := os.Getenv("no_proxy") 45 | if len(noProxy) == 0 { 46 | return proxy 47 | } 48 | 49 | perHost := NewPerHost(proxy, Direct) 50 | perHost.AddFromString(noProxy) 51 | return perHost 52 | } 53 | 54 | // proxySchemes is a map from URL schemes to a function that creates a Dialer 55 | // from a URL with such a scheme. 56 | var proxySchemes map[string]func(*url.URL, Dialer) (Dialer, error) 57 | 58 | // RegisterDialerType takes a URL scheme and a function to generate Dialers from 59 | // a URL with that scheme and a forwarding Dialer. Registered schemes are used 60 | // by FromURL. 61 | func RegisterDialerType(scheme string, f func(*url.URL, Dialer) (Dialer, error)) { 62 | if proxySchemes == nil { 63 | proxySchemes = make(map[string]func(*url.URL, Dialer) (Dialer, error)) 64 | } 65 | proxySchemes[scheme] = f 66 | } 67 | 68 | // FromURL returns a Dialer given a URL specification and an underlying 69 | // Dialer for it to make network requests. 70 | func FromURL(u *url.URL, forward Dialer) (Dialer, error) { 71 | var auth *Auth 72 | if u.User != nil { 73 | auth = new(Auth) 74 | auth.User = u.User.Username() 75 | if p, ok := u.User.Password(); ok { 76 | auth.Password = p 77 | } 78 | } 79 | 80 | switch u.Scheme { 81 | case "socks5": 82 | return SOCKS5("tcp", u.Host, auth, forward) 83 | } 84 | 85 | // If the scheme doesn't match any of the built-in schemes, see if it 86 | // was registered by another package. 87 | if proxySchemes != nil { 88 | if f, ok := proxySchemes[u.Scheme]; ok { 89 | return f(u, forward) 90 | } 91 | } 92 | 93 | return nil, errors.New("proxy: unknown scheme: " + u.Scheme) 94 | } 95 | -------------------------------------------------------------------------------- /oam-docker-ipam/Godeps/_workspace/src/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 | -------------------------------------------------------------------------------- /oam-docker-ipam/Godeps/_workspace/src/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 | -------------------------------------------------------------------------------- /oam-docker-ipam/Godeps/_workspace/src/golang.org/x/sys/unix/.gitignore: -------------------------------------------------------------------------------- 1 | _obj/ 2 | -------------------------------------------------------------------------------- /oam-docker-ipam/Godeps/_workspace/src/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 | -------------------------------------------------------------------------------- /oam-docker-ipam/Godeps/_workspace/src/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 | -------------------------------------------------------------------------------- /oam-docker-ipam/Godeps/_workspace/src/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 | -------------------------------------------------------------------------------- /oam-docker-ipam/Godeps/_workspace/src/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 | -------------------------------------------------------------------------------- /oam-docker-ipam/Godeps/_workspace/src/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 | -------------------------------------------------------------------------------- /oam-docker-ipam/Godeps/_workspace/src/golang.org/x/sys/unix/asm_dragonfly_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-32 17 | JMP syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-44 20 | JMP syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-56 23 | JMP syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-32 26 | JMP syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-44 29 | JMP syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /oam-docker-ipam/Godeps/_workspace/src/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 | -------------------------------------------------------------------------------- /oam-docker-ipam/Godeps/_workspace/src/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 | -------------------------------------------------------------------------------- /oam-docker-ipam/Godeps/_workspace/src/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 | -------------------------------------------------------------------------------- /oam-docker-ipam/Godeps/_workspace/src/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 | -------------------------------------------------------------------------------- /oam-docker-ipam/Godeps/_workspace/src/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 | -------------------------------------------------------------------------------- /oam-docker-ipam/Godeps/_workspace/src/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 | -------------------------------------------------------------------------------- /oam-docker-ipam/Godeps/_workspace/src/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 | -------------------------------------------------------------------------------- /oam-docker-ipam/Godeps/_workspace/src/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 | -------------------------------------------------------------------------------- /oam-docker-ipam/Godeps/_workspace/src/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 | -------------------------------------------------------------------------------- /oam-docker-ipam/Godeps/_workspace/src/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 | -------------------------------------------------------------------------------- /oam-docker-ipam/Godeps/_workspace/src/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 | -------------------------------------------------------------------------------- /oam-docker-ipam/Godeps/_workspace/src/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 | -------------------------------------------------------------------------------- /oam-docker-ipam/Godeps/_workspace/src/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 | -------------------------------------------------------------------------------- /oam-docker-ipam/Godeps/_workspace/src/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 | -------------------------------------------------------------------------------- /oam-docker-ipam/Godeps/_workspace/src/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 | -------------------------------------------------------------------------------- /oam-docker-ipam/Godeps/_workspace/src/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 | -------------------------------------------------------------------------------- /oam-docker-ipam/Godeps/_workspace/src/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 | -------------------------------------------------------------------------------- /oam-docker-ipam/Godeps/_workspace/src/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 | -------------------------------------------------------------------------------- /oam-docker-ipam/Godeps/_workspace/src/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 | -------------------------------------------------------------------------------- /oam-docker-ipam/Godeps/_workspace/src/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 | -------------------------------------------------------------------------------- /oam-docker-ipam/Godeps/_workspace/src/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 | -------------------------------------------------------------------------------- /oam-docker-ipam/Godeps/_workspace/src/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 | -------------------------------------------------------------------------------- /oam-docker-ipam/Godeps/_workspace/src/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 | -------------------------------------------------------------------------------- /oam-docker-ipam/Godeps/_workspace/src/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 | -------------------------------------------------------------------------------- /oam-docker-ipam/Godeps/_workspace/src/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 | -------------------------------------------------------------------------------- /oam-docker-ipam/Godeps/_workspace/src/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 < len(b) { 66 | return nil, nil, EINVAL 67 | } 68 | return h, b[cmsgAlignOf(SizeofCmsghdr):h.Len], nil 69 | } 70 | 71 | // UnixRights encodes a set of open file descriptors into a socket 72 | // control message for sending to another process. 73 | func UnixRights(fds ...int) []byte { 74 | datalen := len(fds) * 4 75 | b := make([]byte, CmsgSpace(datalen)) 76 | h := (*Cmsghdr)(unsafe.Pointer(&b[0])) 77 | h.Level = SOL_SOCKET 78 | h.Type = SCM_RIGHTS 79 | h.SetLen(CmsgLen(datalen)) 80 | data := cmsgData(h) 81 | for _, fd := range fds { 82 | *(*int32)(data) = int32(fd) 83 | data = unsafe.Pointer(uintptr(data) + 4) 84 | } 85 | return b 86 | } 87 | 88 | // ParseUnixRights decodes a socket control message that contains an 89 | // integer array of open file descriptors from another process. 90 | func ParseUnixRights(m *SocketControlMessage) ([]int, error) { 91 | if m.Header.Level != SOL_SOCKET { 92 | return nil, EINVAL 93 | } 94 | if m.Header.Type != SCM_RIGHTS { 95 | return nil, EINVAL 96 | } 97 | fds := make([]int, len(m.Data)>>2) 98 | for i, j := 0, 0; i < len(m.Data); i += 4 { 99 | fds[j] = int(*(*int32)(unsafe.Pointer(&m.Data[i]))) 100 | j++ 101 | } 102 | return fds, nil 103 | } 104 | -------------------------------------------------------------------------------- /oam-docker-ipam/Godeps/_workspace/src/golang.org/x/sys/unix/str.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 darwin dragonfly freebsd linux netbsd openbsd solaris 6 | 7 | package unix 8 | 9 | func itoa(val int) string { // do it here rather than with fmt to avoid dependency 10 | if val < 0 { 11 | return "-" + uitoa(uint(-val)) 12 | } 13 | return uitoa(uint(val)) 14 | } 15 | 16 | func uitoa(val uint) string { 17 | var buf [32]byte // big enough for int64 18 | i := len(buf) - 1 19 | for val >= 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 | -------------------------------------------------------------------------------- /oam-docker-ipam/Godeps/_workspace/src/golang.org/x/sys/unix/syscall.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 darwin dragonfly freebsd linux netbsd openbsd solaris 6 | 7 | // Package unix contains an interface to the low-level operating system 8 | // primitives. OS details vary depending on the underlying system, and 9 | // by default, godoc will display OS-specific documentation for the current 10 | // system. If you want godoc to display OS documentation for another 11 | // system, set $GOOS and $GOARCH to the desired system. For example, if 12 | // you want to view documentation for freebsd/arm on linux/amd64, set $GOOS 13 | // to freebsd and $GOARCH to arm. 14 | // The primary use of this package is inside other packages that provide a more 15 | // portable interface to the system, such as "os", "time" and "net". Use 16 | // those packages rather than this one if you can. 17 | // For details of the functions and data types in this package consult 18 | // the manuals for the appropriate operating system. 19 | // These calls return err == nil to indicate success; otherwise 20 | // err represents an operating system error describing the failure and 21 | // holds a value of type syscall.Errno. 22 | package unix 23 | 24 | import "unsafe" 25 | 26 | // ByteSliceFromString returns a NUL-terminated slice of bytes 27 | // containing the text of s. If s contains a NUL byte at any 28 | // location, it returns (nil, EINVAL). 29 | func ByteSliceFromString(s string) ([]byte, error) { 30 | for i := 0; i < len(s); i++ { 31 | if s[i] == 0 { 32 | return nil, EINVAL 33 | } 34 | } 35 | a := make([]byte, len(s)+1) 36 | copy(a, s) 37 | return a, nil 38 | } 39 | 40 | // BytePtrFromString returns a pointer to a NUL-terminated array of 41 | // bytes containing the text of s. If s contains a NUL byte at any 42 | // location, it returns (nil, EINVAL). 43 | func BytePtrFromString(s string) (*byte, error) { 44 | a, err := ByteSliceFromString(s) 45 | if err != nil { 46 | return nil, err 47 | } 48 | return &a[0], nil 49 | } 50 | 51 | // Single-word zero for use when we need a valid pointer to 0 bytes. 52 | // See mkunix.pl. 53 | var _zero uintptr 54 | 55 | func (ts *Timespec) Unix() (sec int64, nsec int64) { 56 | return int64(ts.Sec), int64(ts.Nsec) 57 | } 58 | 59 | func (tv *Timeval) Unix() (sec int64, nsec int64) { 60 | return int64(tv.Sec), int64(tv.Usec) * 1000 61 | } 62 | 63 | func (ts *Timespec) Nano() int64 { 64 | return int64(ts.Sec)*1e9 + int64(ts.Nsec) 65 | } 66 | 67 | func (tv *Timeval) Nano() int64 { 68 | return int64(tv.Sec)*1e9 + int64(tv.Usec)*1000 69 | } 70 | 71 | func TimevalToNsec(tv Timeval) int64 { return int64(tv.Sec)*1e9 + int64(tv.Usec)*1e3 } 72 | 73 | // use is a no-op, but the compiler cannot see that it is. 74 | // Calling use(p) ensures that p is kept live until that point. 75 | //go:noescape 76 | func use(p unsafe.Pointer) 77 | -------------------------------------------------------------------------------- /oam-docker-ipam/Godeps/_workspace/src/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 | -------------------------------------------------------------------------------- /oam-docker-ipam/Godeps/_workspace/src/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 | -------------------------------------------------------------------------------- /oam-docker-ipam/Godeps/_workspace/src/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 | -------------------------------------------------------------------------------- /oam-docker-ipam/Godeps/_workspace/src/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 | -------------------------------------------------------------------------------- /oam-docker-ipam/Godeps/_workspace/src/golang.org/x/sys/unix/syscall_dragonfly_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,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 = 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 | -------------------------------------------------------------------------------- /oam-docker-ipam/Godeps/_workspace/src/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 | -------------------------------------------------------------------------------- /oam-docker-ipam/Godeps/_workspace/src/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 | -------------------------------------------------------------------------------- /oam-docker-ipam/Godeps/_workspace/src/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 | -------------------------------------------------------------------------------- /oam-docker-ipam/Godeps/_workspace/src/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 | -------------------------------------------------------------------------------- /oam-docker-ipam/Godeps/_workspace/src/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 | -------------------------------------------------------------------------------- /oam-docker-ipam/Godeps/_workspace/src/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 | -------------------------------------------------------------------------------- /oam-docker-ipam/Godeps/_workspace/src/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 | -------------------------------------------------------------------------------- /oam-docker-ipam/Godeps/_workspace/src/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 | -------------------------------------------------------------------------------- /oam-docker-ipam/Godeps/_workspace/src/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 | -------------------------------------------------------------------------------- /oam-docker-ipam/Godeps/_workspace/src/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 | -------------------------------------------------------------------------------- /oam-docker-ipam/Godeps/_workspace/src/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 | -------------------------------------------------------------------------------- /oam-docker-ipam/Godeps/_workspace/src/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 | -------------------------------------------------------------------------------- /oam-docker-ipam/bridge/bridge.go: -------------------------------------------------------------------------------- 1 | package bridge 2 | 3 | import ( 4 | "encoding/json" 5 | "errors" 6 | "fmt" 7 | "oam-docker-ipam/db" 8 | "oam-docker-ipam/util" 9 | "path/filepath" 10 | "strings" 11 | 12 | log "github.com/Sirupsen/logrus" 13 | ) 14 | 15 | const ( 16 | network_key_prefix = "/talkingdata/hosts" 17 | ) 18 | 19 | type Config struct { 20 | Subnet string 21 | Gateway string 22 | } 23 | 24 | func AllocateHostRange(ip_start, ip_end, gateway string) []string { 25 | ips := util.GetIPRange(ip_start, ip_end) 26 | ip_net, mask := util.GetIPNetAndMask(ip_start) 27 | for _, ip := range ips { 28 | if checkIPAssigned(ip) { 29 | log.Warnf("IP %s has been allocated", ip) 30 | continue 31 | } 32 | db.SetKey(filepath.Join(network_key_prefix, "pool", ip), "") 33 | } 34 | initializeConfig(ip_net, fmt.Sprint(ip_net, "/", mask), gateway) 35 | fmt.Println("Allocate Hosts Done! Total:", len(ips)) 36 | return ips 37 | } 38 | 39 | func initializeConfig(ip_net, subnet, gateway string) error { 40 | config := &Config{Subnet: subnet, Gateway: gateway} 41 | config_bytes, _ := json.Marshal(config) 42 | err := db.SetKey(filepath.Join(network_key_prefix, "config"), string(config_bytes)) 43 | if err == nil { 44 | log.Infof("Initialized Config %s for network %s", string(config_bytes), ip_net) 45 | } 46 | return err 47 | } 48 | 49 | func getConfig() (*Config, error) { 50 | config, err := db.GetKey(filepath.Join(network_key_prefix, "config")) 51 | if err == nil { 52 | log.Debugf("getConfig %s", config) 53 | } 54 | conf := &Config{} 55 | json.Unmarshal([]byte(config), conf) 56 | return conf, err 57 | } 58 | 59 | func allocateHost(ip string) error { 60 | if ip == "" { 61 | return errors.New("arg ip is lack") 62 | } 63 | err := db.DeleteKey(filepath.Join(network_key_prefix, "pool", ip)) 64 | if err != nil { 65 | return err 66 | } 67 | if err = db.SetKey(filepath.Join(network_key_prefix, "assigned", ip), ""); err != nil { 68 | return err 69 | } 70 | log.Infof("Allocated host %s", ip) 71 | return nil 72 | } 73 | 74 | func getHost(ip string) (string, error) { 75 | ip_pool, err := db.GetKeys(filepath.Join(network_key_prefix, "pool")) 76 | if err != nil { 77 | return "", err 78 | } 79 | if len(ip_pool) == 0 { 80 | return "", errors.New("Pool is empty") 81 | } 82 | if ip == "" { 83 | find_ip := strings.Split(ip_pool[0].Key, "/") 84 | ip = find_ip[len(find_ip)-1] 85 | } else if exist := db.IsKeyExist(filepath.Join(network_key_prefix, "pool", ip)); exist != true { 86 | return "", errors.New(fmt.Sprintf("Host %s not in pool", ip)) 87 | } 88 | if assigned := checkIPAssigned(ip); assigned == true { 89 | return "", errors.New(fmt.Sprintf("Host %s has been allocated", ip)) 90 | } 91 | return ip, nil 92 | } 93 | 94 | func checkIPAssigned(ip string) bool { 95 | if exist := db.IsKeyExist(filepath.Join(network_key_prefix, "assigned", ip)); exist { 96 | return true 97 | } 98 | return false 99 | } 100 | 101 | func ReleaseHost(ip string) error { 102 | err := db.DeleteKey(filepath.Join(network_key_prefix, "assigned", ip)) 103 | if err != nil { 104 | log.Fatal(err) 105 | } 106 | err = db.SetKey(filepath.Join(network_key_prefix, "pool", ip), "") 107 | if err != nil { 108 | log.Fatal(err) 109 | } 110 | log.Infof("Release host %s", ip) 111 | return err 112 | } 113 | 114 | func CreateNetwork(ip string) { 115 | var assigned_ip string 116 | var config *Config 117 | var err error 118 | 119 | if config, err = getConfig(); err != nil { 120 | log.Fatal(err) 121 | } 122 | if assigned_ip, err = getHost(ip); err != nil { 123 | log.Fatal(err) 124 | } 125 | if err = allocateHost(assigned_ip); err != nil { 126 | log.Fatal(err) 127 | } 128 | if err = createBridge(assigned_ip, config.Subnet, config.Gateway); err != nil { 129 | log.Fatal(err) 130 | } 131 | if err = restart_network(); err != nil { 132 | log.Fatal(err) 133 | } 134 | log.Infof("Create network %s done", assigned_ip) 135 | } 136 | -------------------------------------------------------------------------------- /oam-docker-ipam/bridge/operation.go: -------------------------------------------------------------------------------- 1 | package bridge 2 | 3 | import ( 4 | "fmt" 5 | "io/ioutil" 6 | "os" 7 | "os/exec" 8 | "strings" 9 | 10 | log "github.com/Sirupsen/logrus" 11 | 12 | "oam-docker-ipam/util" 13 | ) 14 | 15 | func createBridge(ip, subnet, gateway string) error { 16 | var err error = nil 17 | 18 | if err := create_network(ip, subnet, gateway); err != nil { 19 | return err 20 | } 21 | if err = configure_network(ip, subnet, gateway); err != nil { 22 | return err 23 | } 24 | return err 25 | } 26 | 27 | //DefaultGatewayIPv4 is the ip of br0 28 | func create_network(ip, subnet, gateway string) error { 29 | command := "docker" 30 | args := fmt.Sprint("network create ", 31 | "--opt=com.docker.network.bridge.enable_icc=true ", 32 | "--opt=com.docker.network.bridge.enable_ip_masquerade=false ", 33 | "--opt=com.docker.network.bridge.host_binding_ipv4=0.0.0.0 ", 34 | "--opt=com.docker.network.bridge.name=br0 ", 35 | "--opt=com.docker.network.driver.mtu=1500 ", 36 | "--ipam-driver=talkingdata ", 37 | "--subnet=%s ", 38 | "--gateway=%s ", 39 | "--aux-address=DefaultGatewayIPv4=%s ", 40 | "mynet") 41 | 42 | args = fmt.Sprintf(args, subnet, ip, gateway) 43 | 44 | var out []byte 45 | out, err := exec.Command(command, strings.Split(args, " ")...).CombinedOutput() 46 | if err != nil { 47 | log.Fatal(err, string(out)) 48 | return err 49 | } 50 | 51 | return nil 52 | } 53 | 54 | //use network-scripts to implement bridge 55 | func configure_network(ip, subnet, gateway string) error { 56 | bridge_command := "BRIDGE=br0" 57 | _, interface_name, _ := get_network_information() 58 | old_interface := "/etc/sysconfig/network-scripts/ifcfg-" + interface_name 59 | new_interface := "/etc/sysconfig/network-scripts/ifcfg-br0" 60 | netmask := util.Get4BytesMask(strings.Split(subnet, "/")[1]) 61 | 62 | old_fd, old_err := os.OpenFile(old_interface, os.O_RDWR|os.O_APPEND, 0666) 63 | if old_err != nil { 64 | log.Fatal(old_err) 65 | return old_err 66 | } 67 | defer old_fd.Close() 68 | br, _ := ioutil.ReadAll(old_fd) 69 | 70 | if strings.Contains(string(br), bridge_command) != true { 71 | buf := []byte(bridge_command) 72 | old_fd.Write(buf) 73 | } 74 | 75 | new_fd, new_err := os.OpenFile(new_interface, os.O_RDWR|os.O_CREATE|os.O_EXCL, 0666) 76 | if new_err != nil { 77 | log.Fatal(new_err) 78 | return new_err 79 | } 80 | defer new_fd.Close() 81 | 82 | br0_content := fmt.Sprint("DEVICE=br0\n", 83 | "TYPE=Bridge\n", 84 | "BOOTPROTO=static\n", 85 | "IPADDR=%s\n", 86 | "GATEWAY=%s\n", 87 | "NETMASK=%s\n", 88 | "ONBOOT=yes\n", 89 | "NOZEROCONF=yes\n", 90 | "IPV6INIT=no\n", 91 | "NM_CONTROLLED=no\n", 92 | "DELAY=0") 93 | br0_content = fmt.Sprintf(br0_content, ip, gateway, netmask) 94 | new_fd.WriteString(br0_content) 95 | 96 | return nil 97 | } 98 | 99 | func restart_network() error { 100 | command := "systemctl" 101 | 102 | disable_args := fmt.Sprint("disable ", "NetworkManager") 103 | _, err := exec.Command(command, strings.Split(disable_args, " ")...).CombinedOutput() 104 | if err != nil { 105 | log.Fatal(err) 106 | } 107 | stop_args := fmt.Sprint("stop ", "NetworkManager") 108 | _, err = exec.Command(command, strings.Split(stop_args, " ")...).CombinedOutput() 109 | if err != nil { 110 | log.Fatal(err) 111 | } 112 | 113 | log.Info("Restarting network") 114 | restart_args := fmt.Sprint("restart ", "network") 115 | _, err = exec.Command(command, strings.Split(restart_args, " ")...).CombinedOutput() 116 | if err != nil { 117 | log.Fatal(err) 118 | return err 119 | } 120 | log.Info("Restart network done") 121 | 122 | return nil 123 | } 124 | 125 | //get default network interface info 126 | func get_network_information() (gateway, interface_name, local_ip string) { 127 | command := "ip" 128 | args := fmt.Sprint("route get ", "8.8.8.8") 129 | out, err := exec.Command(command, strings.Split(args, " ")...).CombinedOutput() 130 | if err != nil { 131 | return 132 | } 133 | network_information := strings.Split(string(out), " ") 134 | gateway = network_information[2] 135 | interface_name = network_information[4] 136 | local_ip = network_information[6] 137 | 138 | return 139 | } 140 | -------------------------------------------------------------------------------- /oam-docker-ipam/command/command.go: -------------------------------------------------------------------------------- 1 | package command 2 | 3 | import ( 4 | "fmt" 5 | "os" 6 | 7 | log "github.com/Sirupsen/logrus" 8 | "github.com/codegangsta/cli" 9 | 10 | "oam-docker-ipam/bridge" 11 | "oam-docker-ipam/db" 12 | "oam-docker-ipam/ipamdriver" 13 | "oam-docker-ipam/util" 14 | ) 15 | 16 | var ( 17 | debug bool 18 | ) 19 | 20 | func initialize_log() { 21 | log.SetOutput(os.Stderr) 22 | if debug { 23 | log.SetLevel(log.DebugLevel) 24 | } else { 25 | log.SetLevel(log.InfoLevel) 26 | } 27 | } 28 | 29 | func NewServerCommand() cli.Command { 30 | return cli.Command{ 31 | Name: "server", 32 | Usage: "start the TalkingData IPAM plugin", 33 | Action: startServerAction, 34 | } 35 | } 36 | 37 | func startServerAction(c *cli.Context) { 38 | debug = c.GlobalBool("debug") 39 | db.SetDBAddr(c.GlobalString("cluster-store")) 40 | initialize_log() 41 | ipamdriver.StartServer() 42 | } 43 | 44 | func NewIPRangeCommand() cli.Command { 45 | return cli.Command{ 46 | Name: "ip-range", 47 | Usage: "set the ip range for containers", 48 | Flags: []cli.Flag{ 49 | cli.StringFlag{Name: "ip-start", Usage: "the first IP for containers in CIDR notation"}, 50 | cli.StringFlag{Name: "ip-end", Usage: "the last IP for containers in CIDR notation"}, 51 | }, 52 | Action: ipRangeAction, 53 | } 54 | } 55 | 56 | func ipRangeAction(c *cli.Context) { 57 | db.SetDBAddr(c.GlobalString("cluster-store")) 58 | ip_start := c.String("ip-start") 59 | ip_end := c.String("ip-end") 60 | if ip_start == "" || ip_end == "" { 61 | fmt.Println("Invalid args") 62 | return 63 | } 64 | ipamdriver.AllocateIPRange(ip_start, ip_end) 65 | } 66 | 67 | func NewReleaseIPCommand() cli.Command { 68 | return cli.Command{ 69 | Name: "release-ip", 70 | Usage: "release the specified IP address", 71 | Flags: []cli.Flag{ 72 | cli.StringFlag{Name: "ip", Usage: "the IP to release in CIDR notation"}, 73 | }, 74 | Action: releaseIPAction, 75 | } 76 | } 77 | 78 | func releaseIPAction(c *cli.Context) { 79 | db.SetDBAddr(c.GlobalString("cluster-store")) 80 | ip_args := c.String("ip") 81 | if ip_args == "" { 82 | fmt.Println("Invalid args") 83 | return 84 | } 85 | ip_net, _ := util.GetIPNetAndMask(ip_args) 86 | ip, _ := util.GetIPAndCIDR(ip_args) 87 | ipamdriver.ReleaseIP(ip_net, ip) 88 | } 89 | 90 | func NewReleaseHostCommand() cli.Command { 91 | return cli.Command{ 92 | Name: "release-host", 93 | Usage: "release the specified host", 94 | Flags: []cli.Flag{ 95 | cli.StringFlag{Name: "ip", Usage: "the IP to release in CIDR notation"}, 96 | }, 97 | Action: releaseHostAction, 98 | } 99 | } 100 | 101 | func releaseHostAction(c *cli.Context) { 102 | db.SetDBAddr(c.GlobalString("cluster-store")) 103 | ip := c.String("ip") 104 | if ip == "" { 105 | fmt.Println("Invalid args") 106 | return 107 | } 108 | bridge.ReleaseHost(ip) 109 | } 110 | 111 | func NewHostRangeCommand() cli.Command { 112 | return cli.Command{ 113 | Name: "host-range", 114 | Usage: "set the ip range for hosts", 115 | Flags: []cli.Flag{ 116 | cli.StringFlag{Name: "ip-start", Usage: "the first IP for containers in CIDR notation"}, 117 | cli.StringFlag{Name: "ip-end", Usage: "the last IP for containers in CIDR notation"}, 118 | cli.StringFlag{Name: "gateway", Usage: "the default gateway for the docker container network"}, 119 | }, 120 | Action: hostRangeAction, 121 | } 122 | 123 | } 124 | 125 | func hostRangeAction(c *cli.Context) { 126 | db.SetDBAddr(c.GlobalString("cluster-store")) 127 | ip_start := c.String("ip-start") 128 | ip_end := c.String("ip-end") 129 | gateway := c.String("gateway") 130 | if ip_start == "" || ip_end == "" || gateway == "" { 131 | fmt.Println("Invalid args") 132 | return 133 | } 134 | bridge.AllocateHostRange(ip_start, ip_end, gateway) 135 | } 136 | 137 | func NewCreateNetworkCommand() cli.Command { 138 | return cli.Command{ 139 | Name: "create-network", 140 | Usage: "create docker network br0", 141 | Flags: []cli.Flag{ 142 | cli.StringFlag{Name: "ip", Usage: "the IP docker bridge use"}, 143 | }, 144 | Action: createNetworkAction, 145 | } 146 | } 147 | 148 | func createNetworkAction(c *cli.Context) { 149 | db.SetDBAddr(c.GlobalString("cluster-store")) 150 | ip := c.String("ip") 151 | bridge.CreateNetwork(ip) 152 | } 153 | -------------------------------------------------------------------------------- /oam-docker-ipam/db/db.go: -------------------------------------------------------------------------------- 1 | package db 2 | 3 | import ( 4 | "strings" 5 | "time" 6 | 7 | log "github.com/Sirupsen/logrus" 8 | "github.com/coreos/etcd/client" 9 | "golang.org/x/net/context" 10 | ) 11 | 12 | var db_addr string 13 | 14 | func SetDBAddr(addr string) { 15 | db_addr = addr 16 | } 17 | 18 | func GetKey(key string) (string, error) { 19 | cli := newClient() 20 | kapi := client.NewKeysAPI(cli) 21 | resp, err := kapi.Get(context.Background(), key, nil) 22 | if err != nil { 23 | log.Error(err) 24 | return "", err 25 | } else { 26 | log.Debugf("Get key %s with value %s", resp.Node.Key, resp.Node.Value) 27 | } 28 | return resp.Node.Value, err 29 | } 30 | 31 | func GetKeys(dir string) (client.Nodes, error) { 32 | cli := newClient() 33 | kapi := client.NewKeysAPI(cli) 34 | resp, err := kapi.Get(context.Background(), dir, &client.GetOptions{Sort: true}) 35 | if err != nil { 36 | log.Error(err) 37 | return nil, err 38 | } else { 39 | log.Debugf("Get %d keys from dir %s", len(resp.Node.Nodes), resp.Node.Key) 40 | } 41 | return resp.Node.Nodes, err 42 | } 43 | 44 | func IsKeyExist(key string) bool { 45 | cli := newClient() 46 | kapi := client.NewKeysAPI(cli) 47 | _, err := kapi.Get(context.Background(), key, nil) 48 | if client.IsKeyNotFound(err) == true { 49 | return false 50 | } else if err != nil { 51 | log.Fatal(err) 52 | } 53 | return true 54 | } 55 | 56 | func SetKey(key, value string) error { 57 | cli := newClient() 58 | kapi := client.NewKeysAPI(cli) 59 | resp, err := kapi.Set(context.Background(), key, value, nil) 60 | if err != nil { 61 | log.Error(err) 62 | return err 63 | } else { 64 | log.Debugf("Set key %s with value %s", resp.Node.Key, resp.Node.Value) 65 | } 66 | return err 67 | } 68 | 69 | func DeleteKey(key string) error { 70 | cli := newClient() 71 | kapi := client.NewKeysAPI(cli) 72 | resp, err := kapi.Delete(context.Background(), key, &client.DeleteOptions{Recursive: true}) 73 | if err != nil { 74 | log.Error(err) 75 | return err 76 | } else { 77 | log.Debugf("Delete key %s with value %s", resp.Node.Key, resp.Node.Value) 78 | } 79 | return err 80 | } 81 | 82 | func newClient() client.Client { 83 | parsed_db_addr := strings.Split(db_addr, ",") 84 | cfg := client.Config{ 85 | Endpoints: parsed_db_addr, 86 | Transport: client.DefaultTransport, 87 | // set timeout per request to fail fast when the target endpoint is unavailable 88 | HeaderTimeoutPerRequest: time.Second, 89 | } 90 | c, err := client.New(cfg) 91 | if err != nil { 92 | log.Fatal(parsed_db_addr, err) 93 | } 94 | return c 95 | } 96 | -------------------------------------------------------------------------------- /oam-docker-ipam/ipamdriver/handler.go: -------------------------------------------------------------------------------- 1 | package ipamdriver 2 | 3 | import ( 4 | "encoding/json" 5 | "fmt" 6 | 7 | log "github.com/Sirupsen/logrus" 8 | "github.com/docker/go-plugins-helpers/ipam" 9 | netlabel "github.com/docker/libnetwork/netlabel" 10 | 11 | "oam-docker-ipam/util" 12 | ) 13 | 14 | type MyIPAMHandler struct { 15 | } 16 | 17 | func (iph *MyIPAMHandler) GetCapabilities() (response *ipam.CapabilitiesResponse, err error) { 18 | log.Infof("GetCapabilities") 19 | return &ipam.CapabilitiesResponse{RequiresMACAddress: true}, nil 20 | } 21 | 22 | func (iph *MyIPAMHandler) GetDefaultAddressSpaces() (response *ipam.AddressSpacesResponse, err error) { 23 | log.Infof("GetDefaultAddressSpaces") 24 | return &ipam.AddressSpacesResponse{}, nil 25 | } 26 | 27 | func (iph *MyIPAMHandler) RequestPool(request *ipam.RequestPoolRequest) (response *ipam.RequestPoolResponse, err error) { 28 | var request_json []byte = nil 29 | request_json, err = json.Marshal(request) 30 | if err != nil { 31 | return nil, err 32 | } 33 | log.Infof("RequestPool: %s", request_json) 34 | ip_net, _ := util.GetIPNetAndMask(request.Pool) 35 | _, ip_cidr := util.GetIPAndCIDR(request.Pool) 36 | options := request.Options 37 | return &ipam.RequestPoolResponse{ip_net, ip_cidr, options}, nil 38 | } 39 | 40 | func (iph *MyIPAMHandler) ReleasePool(request *ipam.ReleasePoolRequest) (err error) { 41 | var request_json []byte = nil 42 | request_json, err = json.Marshal(request) 43 | if err != nil { 44 | return err 45 | } 46 | log.Infof("ReleasePool %s is danger, you should do this by manual.", request_json) 47 | return nil 48 | } 49 | 50 | func (iph *MyIPAMHandler) RequestAddress(request *ipam.RequestAddressRequest) (response *ipam.RequestAddressResponse, err error) { 51 | var request_json []byte = nil 52 | request_json, err = json.Marshal(request) 53 | if err != nil { 54 | return nil, err 55 | } 56 | log.Infof("RequestAddress %s", request_json) 57 | ip_net := request.PoolID 58 | ip := request.Address 59 | config, _ := GetConfig(ip_net) 60 | 61 | if value, ok := request.Options["RequestAddressType"]; ok && value == netlabel.Gateway || len(request.Options) == 0 { 62 | log.Infof("Skip allocate gateway ip %s", ip) 63 | return &ipam.RequestAddressResponse{fmt.Sprintf("%s/%s", ip, config.Mask), nil}, nil 64 | } 65 | ip, err = AllocateIP(ip_net, ip) 66 | return &ipam.RequestAddressResponse{fmt.Sprintf("%s/%s", ip, config.Mask), nil}, err 67 | } 68 | 69 | func (iph *MyIPAMHandler) ReleaseAddress(request *ipam.ReleaseAddressRequest) (err error) { 70 | var request_json []byte = nil 71 | request_json, err = json.Marshal(request) 72 | if err != nil { 73 | return err 74 | } 75 | log.Infof("ReleaseAddress %s", request_json) 76 | err = ReleaseIP(request.PoolID, request.Address) 77 | return err 78 | } 79 | -------------------------------------------------------------------------------- /oam-docker-ipam/ipamdriver/server.go: -------------------------------------------------------------------------------- 1 | package ipamdriver 2 | 3 | import ( 4 | "encoding/json" 5 | "errors" 6 | "fmt" 7 | "path/filepath" 8 | "strings" 9 | 10 | log "github.com/Sirupsen/logrus" 11 | "github.com/docker/go-plugins-helpers/ipam" 12 | 13 | "oam-docker-ipam/db" 14 | "oam-docker-ipam/util" 15 | ) 16 | 17 | const ( 18 | network_key_prefix = "/talkingdata/containers" 19 | ) 20 | 21 | type Config struct { 22 | Ipnet string 23 | Mask string 24 | } 25 | 26 | func StartServer() { 27 | d := &MyIPAMHandler{} 28 | h := ipam.NewHandler(d) 29 | h.ServeUnix("root", "talkingdata") 30 | } 31 | 32 | func AllocateIPRange(ip_start, ip_end string) []string { 33 | ips := util.GetIPRange(ip_start, ip_end) 34 | ip_net, mask := util.GetIPNetAndMask(ip_start) 35 | for _, ip := range ips { 36 | if checkIPAssigned(ip_net, ip) { 37 | log.Warnf("IP %s has been allocated", ip) 38 | continue 39 | } 40 | db.SetKey(filepath.Join(network_key_prefix, ip_net, "pool", ip), "") 41 | } 42 | initializeConfig(ip_net, mask) 43 | fmt.Println("Allocate Containers IP Done! Total:", len(ips)) 44 | return ips 45 | } 46 | 47 | func ReleaseIP(ip_net, ip string) error { 48 | err := db.DeleteKey(filepath.Join(network_key_prefix, ip_net, "assigned", ip)) 49 | if err != nil { 50 | log.Infof("Skip Release IP %s", ip) 51 | return nil 52 | } 53 | err = db.SetKey(filepath.Join(network_key_prefix, ip_net, "pool", ip), "") 54 | if err == nil { 55 | log.Infof("Release IP %s", ip) 56 | } 57 | return nil 58 | } 59 | 60 | func AllocateIP(ip_net, ip string) (string, error) { 61 | ip_pool, err := db.GetKeys(filepath.Join(network_key_prefix, ip_net, "pool")) 62 | if err != nil { 63 | return ip, err 64 | } 65 | if len(ip_pool) == 0 { 66 | return ip, errors.New("Pool is empty") 67 | } 68 | if ip == "" { 69 | find_ip := strings.Split(ip_pool[0].Key, "/") 70 | ip = find_ip[len(find_ip)-1] 71 | } 72 | exist := checkIPAssigned(ip_net, ip) 73 | if exist == true { 74 | return ip, errors.New(fmt.Sprintf("IP %s has been allocated", ip)) 75 | } 76 | err = db.DeleteKey(filepath.Join(network_key_prefix, ip_net, "pool", ip)) 77 | if err != nil { 78 | return ip, err 79 | } 80 | db.SetKey(filepath.Join(network_key_prefix, ip_net, "assigned", ip), "") 81 | log.Infof("Allocated IP %s", ip) 82 | return ip, err 83 | } 84 | 85 | func checkIPAssigned(ip_net, ip string) bool { 86 | if exist := db.IsKeyExist(filepath.Join(network_key_prefix, ip_net, "assigned", ip)); exist { 87 | return true 88 | } 89 | return false 90 | } 91 | 92 | func initializeConfig(ip_net, mask string) error { 93 | config := &Config{Ipnet: ip_net, Mask: mask} 94 | config_bytes, err := json.Marshal(config) 95 | if err != nil { 96 | log.Fatal(err) 97 | } 98 | err = db.SetKey(filepath.Join(network_key_prefix, ip_net, "config"), string(config_bytes)) 99 | if err == nil { 100 | log.Infof("Initialized Config %s for network %s", string(config_bytes), ip_net) 101 | } 102 | return err 103 | } 104 | 105 | func DeleteNetWork(ip_net string) error { 106 | err := db.DeleteKey(filepath.Join(network_key_prefix, ip_net)) 107 | if err == nil { 108 | log.Infof("DeleteNetwork %s", ip_net) 109 | } 110 | return err 111 | } 112 | 113 | func GetConfig(ip_net string) (*Config, error) { 114 | config, err := db.GetKey(filepath.Join(network_key_prefix, ip_net, "config")) 115 | if err == nil { 116 | log.Debugf("GetConfig %s from network %s", config, ip_net) 117 | } 118 | conf := &Config{} 119 | json.Unmarshal([]byte(config), conf) 120 | return conf, err 121 | } 122 | -------------------------------------------------------------------------------- /oam-docker-ipam/main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "oam-docker-ipam/command" 5 | "os" 6 | 7 | "github.com/codegangsta/cli" 8 | ) 9 | 10 | func main() { 11 | app := cli.NewApp() 12 | app.Name = "oam-docker-ipam" 13 | app.Version = "1.0.0" 14 | app.Author = "chao.ma" 15 | app.Usage = "TalkingData network plugin with remote IPAM" 16 | app.Flags = []cli.Flag{ 17 | cli.StringFlag{Name: "cluster-store", Value: "http://127.0.0.1:2379", Usage: "the key/value store endpoint url. [$CLUSTER_STORE]"}, 18 | cli.BoolFlag{Name: "debug", Usage: "debug mode [$DEBUG]"}, 19 | } 20 | app.Commands = []cli.Command{ 21 | command.NewServerCommand(), 22 | command.NewIPRangeCommand(), 23 | command.NewReleaseIPCommand(), 24 | command.NewHostRangeCommand(), 25 | command.NewReleaseHostCommand(), 26 | command.NewCreateNetworkCommand(), 27 | } 28 | app.Run(os.Args) 29 | } 30 | -------------------------------------------------------------------------------- /oam-docker-ipam/util/util.go: -------------------------------------------------------------------------------- 1 | package util 2 | 3 | import ( 4 | "net" 5 | "strconv" 6 | "strings" 7 | 8 | log "github.com/Sirupsen/logrus" 9 | ) 10 | 11 | func GetIPRange(ip_start, ip_end string) []string { 12 | var ips []string 13 | ip_s, ipnet_s, start_err := net.ParseCIDR(ip_start) 14 | if start_err != nil { 15 | log.Fatal(start_err) 16 | } 17 | ip_e, ipnet_e, end_err := net.ParseCIDR(ip_end) 18 | if end_err != nil { 19 | log.Fatal(end_err) 20 | } 21 | 22 | if ipnet_s.Mask.String() != ipnet_e.Mask.String() { 23 | log.Fatalf("%s and %s are not in the same subnet", ip_start, ip_end) 24 | } 25 | for ip := ip_s; ipnet_s.Contains(ip); inc(ip) { 26 | ips = append(ips, ip.String()) 27 | if ip.Equal(ip_e) { 28 | break 29 | } 30 | } 31 | return ips 32 | } 33 | 34 | func Get4BytesMask(mask string) string { 35 | mask_int, _ := strconv.Atoi(mask) 36 | mask_bytes := []byte(net.CIDRMask(mask_int, 32)) 37 | var mask_strings []string 38 | for _, mask_byte := range mask_bytes { 39 | mask_strings = append(mask_strings, strconv.Itoa(int(mask_byte))) 40 | } 41 | return strings.Join(mask_strings, ".") 42 | } 43 | 44 | func GetIPNetAndMask(ip_cidr string) (string, string) { 45 | ip_obj, ipnet_obj, err := net.ParseCIDR(ip_cidr) 46 | if err != nil { 47 | log.Fatal(err) 48 | } 49 | return ip_obj.Mask(ipnet_obj.Mask).String(), strings.Split(ipnet_obj.String(), "/")[1] 50 | } 51 | 52 | func GetIPAndCIDR(ip_cidr string) (string, string) { 53 | ip, cidr, err := net.ParseCIDR(ip_cidr) 54 | if err != nil { 55 | log.Fatal(err) 56 | } 57 | return ip.String(), cidr.String() 58 | } 59 | 60 | func GetMask(ip_cidr string) int { 61 | _, cidr, _ := net.ParseCIDR(ip_cidr) 62 | mask, _ := cidr.Mask.Size() 63 | return mask 64 | } 65 | 66 | func inc(ip net.IP) { 67 | for j := len(ip) - 1; j >= 0; j-- { 68 | ip[j]++ 69 | if ip[j] > 0 { 70 | break 71 | } 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /rpms/docker-engine-1.11.1-1.el7.centos.x86_64.rpm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TalkingData/Shrike/237332298c2b8e50bd280b3f041c90f57ed2efca/rpms/docker-engine-1.11.1-1.el7.centos.x86_64.rpm -------------------------------------------------------------------------------- /rpms/docker-engine-selinux-1.11.1-1.el7.centos.noarch.rpm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TalkingData/Shrike/237332298c2b8e50bd280b3f041c90f57ed2efca/rpms/docker-engine-selinux-1.11.1-1.el7.centos.noarch.rpm -------------------------------------------------------------------------------- /rpms/etcd-2.3.1-1.el7.centos.x86_64.rpm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TalkingData/Shrike/237332298c2b8e50bd280b3f041c90f57ed2efca/rpms/etcd-2.3.1-1.el7.centos.x86_64.rpm -------------------------------------------------------------------------------- /rpms/oam-docker-ipam-1.0.0-1.el7.centos.x86_64.rpm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TalkingData/Shrike/237332298c2b8e50bd280b3f041c90f57ed2efca/rpms/oam-docker-ipam-1.0.0-1.el7.centos.x86_64.rpm -------------------------------------------------------------------------------- /rpms/shipyard-3.0.4-1.el7.centos.x86_64.rpm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TalkingData/Shrike/237332298c2b8e50bd280b3f041c90f57ed2efca/rpms/shipyard-3.0.4-1.el7.centos.x86_64.rpm -------------------------------------------------------------------------------- /rpms/swarm-1.2.2-1.el7.centos.x86_64.rpm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TalkingData/Shrike/237332298c2b8e50bd280b3f041c90f57ed2efca/rpms/swarm-1.2.2-1.el7.centos.x86_64.rpm --------------------------------------------------------------------------------