├── .gitignore ├── LICENSE ├── README.md ├── Vagrantfile ├── build.sh ├── examples ├── master.linen.conflist ├── minion1.linen.conflist └── minion2.linen.conflist ├── images ├── mgmt-workflow.png └── ovs-networking.png ├── kubernetes ├── controllers │ ├── onos-deployment.yaml │ └── ryu-deployment.yaml ├── daemon │ ├── Dockerfile │ └── flaxd.go ├── flaxd-rbac.yaml └── flaxd.yaml ├── linen ├── linen.go ├── ovs.go ├── utils.go └── utils_test.go └── vendor ├── github.com ├── John-Lin │ └── ovsdb │ │ ├── LICENSE │ │ ├── README.md │ │ ├── ovsdb.go │ │ └── utils.go ├── cenkalti │ ├── hub │ │ ├── LICENSE │ │ ├── README.md │ │ └── hub.go │ └── rpc2 │ │ ├── LICENSE │ │ ├── README.md │ │ ├── client.go │ │ ├── codec.go │ │ ├── jsonrpc │ │ └── jsonrpc.go │ │ ├── server.go │ │ └── state.go ├── containernetworking │ ├── cni │ │ ├── LICENSE │ │ └── pkg │ │ │ ├── invoke │ │ │ ├── args.go │ │ │ ├── delegate.go │ │ │ ├── exec.go │ │ │ ├── find.go │ │ │ ├── os_unix.go │ │ │ ├── os_windows.go │ │ │ └── raw_exec.go │ │ │ ├── skel │ │ │ └── skel.go │ │ │ ├── types │ │ │ ├── 020 │ │ │ │ └── types.go │ │ │ ├── args.go │ │ │ ├── current │ │ │ │ └── types.go │ │ │ └── types.go │ │ │ └── version │ │ │ ├── conf.go │ │ │ ├── plugin.go │ │ │ ├── reconcile.go │ │ │ └── version.go │ └── plugins │ │ ├── LICENSE │ │ └── pkg │ │ ├── ip │ │ ├── addr.go │ │ ├── cidr.go │ │ ├── ipforward.go │ │ ├── ipmasq.go │ │ ├── link.go │ │ ├── route.go │ │ ├── route_linux.go │ │ └── route_unspecified.go │ │ ├── ipam │ │ └── ipam.go │ │ ├── ns │ │ ├── README.md │ │ ├── ns.go │ │ ├── ns_linux.go │ │ └── ns_unspecified.go │ │ └── utils │ │ ├── hwaddr │ │ └── hwaddr.go │ │ └── utils.go ├── coreos │ └── go-iptables │ │ ├── LICENSE │ │ └── iptables │ │ ├── iptables.go │ │ └── lock.go ├── sirupsen │ └── logrus │ │ ├── CHANGELOG.md │ │ ├── LICENSE │ │ ├── README.md │ │ ├── alt_exit.go │ │ ├── appveyor.yml │ │ ├── doc.go │ │ ├── entry.go │ │ ├── exported.go │ │ ├── formatter.go │ │ ├── hooks.go │ │ ├── json_formatter.go │ │ ├── logger.go │ │ ├── logrus.go │ │ ├── terminal_bsd.go │ │ ├── terminal_linux.go │ │ ├── text_formatter.go │ │ └── writer.go ├── socketplane │ └── libovsdb │ │ ├── HACKING.md │ │ ├── LICENSE │ │ ├── MAINTAINERS │ │ ├── Makefile │ │ ├── README.md │ │ ├── circle.yml │ │ ├── client.go │ │ ├── docker-compose.yml │ │ ├── map.go │ │ ├── notation.go │ │ ├── row.go │ │ ├── rpc.go │ │ ├── schema.go │ │ ├── set.go │ │ └── uuid.go └── vishvananda │ ├── netlink │ ├── LICENSE │ ├── Makefile │ ├── README.md │ ├── addr.go │ ├── addr_linux.go │ ├── bpf_linux.go │ ├── bridge_linux.go │ ├── class.go │ ├── class_linux.go │ ├── conntrack_linux.go │ ├── conntrack_unspecified.go │ ├── filter.go │ ├── filter_linux.go │ ├── genetlink_linux.go │ ├── genetlink_unspecified.go │ ├── gtp_linux.go │ ├── handle_linux.go │ ├── handle_unspecified.go │ ├── link.go │ ├── link_linux.go │ ├── link_tuntap_linux.go │ ├── neigh.go │ ├── neigh_linux.go │ ├── netlink.go │ ├── netlink_linux.go │ ├── netlink_unspecified.go │ ├── nl │ │ ├── addr_linux.go │ │ ├── bridge_linux.go │ │ ├── conntrack_linux.go │ │ ├── genetlink_linux.go │ │ ├── link_linux.go │ │ ├── mpls_linux.go │ │ ├── nl_linux.go │ │ ├── nl_unspecified.go │ │ ├── route_linux.go │ │ ├── syscall.go │ │ ├── tc_linux.go │ │ ├── xfrm_linux.go │ │ ├── xfrm_monitor_linux.go │ │ ├── xfrm_policy_linux.go │ │ └── xfrm_state_linux.go │ ├── order.go │ ├── protinfo.go │ ├── protinfo_linux.go │ ├── qdisc.go │ ├── qdisc_linux.go │ ├── route.go │ ├── route_linux.go │ ├── route_unspecified.go │ ├── rule.go │ ├── rule_linux.go │ ├── socket.go │ ├── socket_linux.go │ ├── xfrm.go │ ├── xfrm_monitor_linux.go │ ├── xfrm_policy.go │ ├── xfrm_policy_linux.go │ ├── xfrm_state.go │ └── xfrm_state_linux.go │ └── netns │ ├── LICENSE │ ├── README.md │ ├── netns.go │ ├── netns_linux.go │ └── netns_unspecified.go ├── golang.org └── x │ ├── crypto │ ├── LICENSE │ ├── PATENTS │ └── ssh │ │ └── terminal │ │ ├── terminal.go │ │ ├── util.go │ │ ├── util_bsd.go │ │ ├── util_linux.go │ │ ├── util_plan9.go │ │ ├── util_solaris.go │ │ └── util_windows.go │ └── sys │ ├── LICENSE │ ├── PATENTS │ ├── unix │ ├── README.md │ ├── asm_darwin_386.s │ ├── asm_darwin_amd64.s │ ├── asm_darwin_arm.s │ ├── asm_darwin_arm64.s │ ├── asm_dragonfly_amd64.s │ ├── asm_freebsd_386.s │ ├── asm_freebsd_amd64.s │ ├── asm_freebsd_arm.s │ ├── asm_linux_386.s │ ├── asm_linux_amd64.s │ ├── asm_linux_arm.s │ ├── asm_linux_arm64.s │ ├── asm_linux_mips64x.s │ ├── asm_linux_mipsx.s │ ├── asm_linux_ppc64x.s │ ├── asm_linux_s390x.s │ ├── asm_netbsd_386.s │ ├── asm_netbsd_amd64.s │ ├── asm_netbsd_arm.s │ ├── asm_openbsd_386.s │ ├── asm_openbsd_amd64.s │ ├── asm_solaris_amd64.s │ ├── bluetooth_linux.go │ ├── cap_freebsd.go │ ├── constants.go │ ├── dev_linux.go │ ├── dirent.go │ ├── endian_big.go │ ├── endian_little.go │ ├── env_unix.go │ ├── env_unset.go │ ├── file_unix.go │ ├── flock.go │ ├── flock_linux_32bit.go │ ├── gccgo.go │ ├── gccgo_c.c │ ├── gccgo_linux_amd64.go │ ├── gccgo_linux_sparc64.go │ ├── mkall.sh │ ├── mkerrors.sh │ ├── mksyscall.pl │ ├── mksyscall_solaris.pl │ ├── mksysctl_openbsd.pl │ ├── mksysnum_darwin.pl │ ├── mksysnum_dragonfly.pl │ ├── mksysnum_freebsd.pl │ ├── mksysnum_netbsd.pl │ ├── mksysnum_openbsd.pl │ ├── openbsd_pledge.go │ ├── race.go │ ├── race0.go │ ├── sockcmsg_linux.go │ ├── sockcmsg_unix.go │ ├── str.go │ ├── syscall.go │ ├── syscall_bsd.go │ ├── syscall_darwin.go │ ├── syscall_darwin_386.go │ ├── syscall_darwin_amd64.go │ ├── syscall_darwin_arm.go │ ├── syscall_darwin_arm64.go │ ├── syscall_dragonfly.go │ ├── syscall_dragonfly_amd64.go │ ├── syscall_freebsd.go │ ├── syscall_freebsd_386.go │ ├── syscall_freebsd_amd64.go │ ├── syscall_freebsd_arm.go │ ├── syscall_linux.go │ ├── syscall_linux_386.go │ ├── syscall_linux_amd64.go │ ├── syscall_linux_amd64_gc.go │ ├── syscall_linux_arm.go │ ├── syscall_linux_arm64.go │ ├── syscall_linux_mips64x.go │ ├── syscall_linux_mipsx.go │ ├── syscall_linux_ppc64x.go │ ├── syscall_linux_s390x.go │ ├── syscall_linux_sparc64.go │ ├── syscall_netbsd.go │ ├── syscall_netbsd_386.go │ ├── syscall_netbsd_amd64.go │ ├── syscall_netbsd_arm.go │ ├── syscall_no_getwd.go │ ├── syscall_openbsd.go │ ├── syscall_openbsd_386.go │ ├── syscall_openbsd_amd64.go │ ├── syscall_solaris.go │ ├── syscall_solaris_amd64.go │ ├── syscall_unix.go │ ├── syscall_unix_gc.go │ ├── zerrors_darwin_386.go │ ├── zerrors_darwin_amd64.go │ ├── zerrors_darwin_arm.go │ ├── zerrors_darwin_arm64.go │ ├── zerrors_dragonfly_amd64.go │ ├── zerrors_freebsd_386.go │ ├── zerrors_freebsd_amd64.go │ ├── zerrors_freebsd_arm.go │ ├── zerrors_linux_386.go │ ├── zerrors_linux_amd64.go │ ├── zerrors_linux_arm.go │ ├── zerrors_linux_arm64.go │ ├── zerrors_linux_mips.go │ ├── zerrors_linux_mips64.go │ ├── zerrors_linux_mips64le.go │ ├── zerrors_linux_mipsle.go │ ├── zerrors_linux_ppc64.go │ ├── zerrors_linux_ppc64le.go │ ├── zerrors_linux_s390x.go │ ├── zerrors_linux_sparc64.go │ ├── zerrors_netbsd_386.go │ ├── zerrors_netbsd_amd64.go │ ├── zerrors_netbsd_arm.go │ ├── zerrors_openbsd_386.go │ ├── zerrors_openbsd_amd64.go │ ├── zerrors_solaris_amd64.go │ ├── zsyscall_darwin_386.go │ ├── zsyscall_darwin_amd64.go │ ├── zsyscall_darwin_arm.go │ ├── zsyscall_darwin_arm64.go │ ├── zsyscall_dragonfly_amd64.go │ ├── zsyscall_freebsd_386.go │ ├── zsyscall_freebsd_amd64.go │ ├── zsyscall_freebsd_arm.go │ ├── zsyscall_linux_386.go │ ├── zsyscall_linux_amd64.go │ ├── zsyscall_linux_arm.go │ ├── zsyscall_linux_arm64.go │ ├── zsyscall_linux_mips.go │ ├── zsyscall_linux_mips64.go │ ├── zsyscall_linux_mips64le.go │ ├── zsyscall_linux_mipsle.go │ ├── zsyscall_linux_ppc64.go │ ├── zsyscall_linux_ppc64le.go │ ├── zsyscall_linux_s390x.go │ ├── zsyscall_linux_sparc64.go │ ├── zsyscall_netbsd_386.go │ ├── zsyscall_netbsd_amd64.go │ ├── zsyscall_netbsd_arm.go │ ├── zsyscall_openbsd_386.go │ ├── zsyscall_openbsd_amd64.go │ ├── zsyscall_solaris_amd64.go │ ├── zsysctl_openbsd.go │ ├── zsysnum_darwin_386.go │ ├── zsysnum_darwin_amd64.go │ ├── zsysnum_darwin_arm.go │ ├── zsysnum_darwin_arm64.go │ ├── zsysnum_dragonfly_amd64.go │ ├── zsysnum_freebsd_386.go │ ├── zsysnum_freebsd_amd64.go │ ├── zsysnum_freebsd_arm.go │ ├── zsysnum_linux_386.go │ ├── zsysnum_linux_amd64.go │ ├── zsysnum_linux_arm.go │ ├── zsysnum_linux_arm64.go │ ├── zsysnum_linux_mips.go │ ├── zsysnum_linux_mips64.go │ ├── zsysnum_linux_mips64le.go │ ├── zsysnum_linux_mipsle.go │ ├── zsysnum_linux_ppc64.go │ ├── zsysnum_linux_ppc64le.go │ ├── zsysnum_linux_s390x.go │ ├── zsysnum_linux_sparc64.go │ ├── zsysnum_netbsd_386.go │ ├── zsysnum_netbsd_amd64.go │ ├── zsysnum_netbsd_arm.go │ ├── zsysnum_openbsd_386.go │ ├── zsysnum_openbsd_amd64.go │ ├── zsysnum_solaris_amd64.go │ ├── ztypes_darwin_386.go │ ├── ztypes_darwin_amd64.go │ ├── ztypes_darwin_arm.go │ ├── ztypes_darwin_arm64.go │ ├── ztypes_dragonfly_amd64.go │ ├── ztypes_freebsd_386.go │ ├── ztypes_freebsd_amd64.go │ ├── ztypes_freebsd_arm.go │ ├── ztypes_linux_386.go │ ├── ztypes_linux_amd64.go │ ├── ztypes_linux_arm.go │ ├── ztypes_linux_arm64.go │ ├── ztypes_linux_mips.go │ ├── ztypes_linux_mips64.go │ ├── ztypes_linux_mips64le.go │ ├── ztypes_linux_mipsle.go │ ├── ztypes_linux_ppc64.go │ ├── ztypes_linux_ppc64le.go │ ├── ztypes_linux_s390x.go │ ├── ztypes_linux_sparc64.go │ ├── ztypes_netbsd_386.go │ ├── ztypes_netbsd_amd64.go │ ├── ztypes_netbsd_arm.go │ ├── ztypes_openbsd_386.go │ ├── ztypes_openbsd_amd64.go │ └── ztypes_solaris_amd64.go │ └── windows │ ├── asm_windows_386.s │ ├── asm_windows_amd64.s │ ├── dll_windows.go │ ├── env_unset.go │ ├── env_windows.go │ ├── eventlog.go │ ├── exec_windows.go │ ├── memory_windows.go │ ├── mksyscall.go │ ├── race.go │ ├── race0.go │ ├── security_windows.go │ ├── service.go │ ├── str.go │ ├── syscall.go │ ├── syscall_windows.go │ ├── types_windows.go │ ├── types_windows_386.go │ ├── types_windows_amd64.go │ └── zsyscall_windows.go └── vendor.json /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | 3 | bin/ 4 | gopath/ 5 | .vagrant 6 | devenv/ 7 | *.log 8 | -------------------------------------------------------------------------------- /Vagrantfile: -------------------------------------------------------------------------------- 1 | # -*- mode: ruby -*- 2 | # vi: set ft=ruby : 3 | 4 | Vagrant.configure("2") do |config| 5 | config.vm.box = "ubuntu/xenial64" 6 | config.vm.hostname = 'dev' 7 | 8 | config.vm.provision "shell", privileged: false, inline: <<-SHELL 9 | set -e -x -u 10 | sudo apt-get update 11 | sudo apt-get install -y vim git build-essential openvswitch-switch bridge-utils 12 | 13 | # Install Golang 14 | wget --quiet https://storage.googleapis.com/golang/go1.9.1.linux-amd64.tar.gz 15 | sudo tar -zxf go1.9.1.linux-amd64.tar.gz -C /usr/local/ 16 | 17 | echo 'export GOROOT=/usr/local/go' >> /home/ubuntu/.bashrc 18 | echo 'export GOPATH=$HOME/go' >> /home/ubuntu/.bashrc 19 | echo 'export PATH=$PATH:$GOROOT/bin:$GOPATH/bin' >> /home/ubuntu/.bashrc 20 | source /home/ubuntu/.bashrc 21 | 22 | mkdir -p /home/ubuntu/go/src 23 | 24 | rm -rf /home/ubuntu/go1.9.1.linux-amd64.tar.gz 25 | 26 | # Download CNI and CNI plugins binaries 27 | wget --quiet https://github.com/containernetworking/cni/releases/download/v0.6.0/cni-amd64-v0.6.0.tgz 28 | wget --quiet https://github.com/containernetworking/plugins/releases/download/v0.6.0/cni-plugins-amd64-v0.6.0.tgz 29 | mkdir cni 30 | tar -zxf cni-amd64-v0.6.0.tgz -C /home/ubuntu/cni 31 | tar -zxf cni-plugins-amd64-v0.6.0.tgz -C /home/ubuntu/cni 32 | 33 | rm -rf /home/ubuntu/cni-plugins-amd64-v0.6.0.tgz /home/ubuntu/cni-amd64-v0.6.0.tgz 34 | 35 | # Download linen CNI source 36 | git clone https://github.com/John-Lin/linen-cni.git 37 | 38 | SHELL 39 | 40 | config.vm.provider :virtualbox do |v| 41 | v.customize ["modifyvm", :id, "--cpus", 2] 42 | # enable this when you want to have more memory 43 | # v.customize ["modifyvm", :id, "--memory", 4096] 44 | v.customize ['modifyvm', :id, '--nicpromisc1', 'allow-all'] 45 | end 46 | end 47 | -------------------------------------------------------------------------------- /build.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -e 3 | 4 | ORG_PATH="github.com/John-Lin" 5 | export REPO_PATH="${ORG_PATH}/linen-cni" 6 | 7 | if [ ! -h gopath/src/${REPO_PATH} ]; then 8 | mkdir -p gopath/src/${ORG_PATH} 9 | ln -s ../../../.. gopath/src/${REPO_PATH} || exit 255 10 | fi 11 | 12 | export GO15VENDOREXPERIMENT=1 13 | export GOPATH=${PWD}/gopath 14 | 15 | mkdir -p "${PWD}/bin" 16 | 17 | echo "Building plugins" 18 | PLUGINS="linen" 19 | for d in $PLUGINS; do 20 | if [ -d "$d" ]; then 21 | plugin="$(basename "$d")" 22 | echo " $plugin" 23 | # use go install so we don't duplicate work 24 | if [ -n "$FASTBUILD" ] 25 | then 26 | GOBIN=${PWD}/bin go install -pkgdir $GOPATH/pkg "$@" $REPO_PATH/$d 27 | else 28 | go build -o "${PWD}/bin/$plugin" -pkgdir "$GOPATH/pkg" "$@" "$REPO_PATH/$d" 29 | fi 30 | fi 31 | done 32 | -------------------------------------------------------------------------------- /examples/master.linen.conflist: -------------------------------------------------------------------------------- 1 | { 2 | "name":"linen-network", 3 | "cniVersion": "0.3.1", 4 | "plugins":[ 5 | { 6 | "type":"bridge", 7 | "bridge":"kbr0", 8 | "isGateway":true, 9 | "isDefaultGateway":true, 10 | "forceAddress":false, 11 | "ipMasq":true, 12 | "mtu":1400, 13 | "hairpinMode":false, 14 | "ipam":{ 15 | "type":"host-local", 16 | "subnet":"10.244.0.0/16", 17 | "rangeStart":"10.244.1.10", 18 | "rangeEnd":"10.244.1.150", 19 | "routes":[ 20 | { 21 | "dst":"0.0.0.0/0" 22 | } 23 | ], 24 | "gateway":"10.244.1.1" 25 | } 26 | }, 27 | { 28 | "type":"linen", 29 | "runtimeConfig":{ 30 | "ovs":{ 31 | "isMaster":true, 32 | "ovsBridge":"br0", 33 | "vtepIPs":[ 34 | "10.245.2.2", 35 | "10.245.2.3" 36 | ], 37 | "controller":"192.168.2.100:6653" 38 | } 39 | } 40 | } 41 | ] 42 | } -------------------------------------------------------------------------------- /examples/minion1.linen.conflist: -------------------------------------------------------------------------------- 1 | { 2 | "name":"linen-network", 3 | "cniVersion":"0.3.1", 4 | "plugins":[ 5 | { 6 | "type":"bridge", 7 | "bridge":"kbr0", 8 | "isGateway":true, 9 | "isDefaultGateway":true, 10 | "forceAddress":false, 11 | "ipMasq":true, 12 | "mtu":1400, 13 | "hairpinMode":false, 14 | "ipam":{ 15 | "type":"host-local", 16 | "subnet":"10.244.0.0/16", 17 | "rangeStart":"10.244.2.10", 18 | "rangeEnd":"10.244.2.150", 19 | "routes":[ 20 | { 21 | "dst":"0.0.0.0/0" 22 | } 23 | ], 24 | "gateway":"10.244.2.1" 25 | } 26 | }, 27 | { 28 | "type":"linen", 29 | "runtimeConfig":{ 30 | "ovs":{ 31 | "isMaster":false, 32 | "ovsBridge":"br0", 33 | "vtepIPs":[ 34 | "10.245.2.2" 35 | ], 36 | "controller":"192.168.2.100:6653" 37 | } 38 | } 39 | } 40 | ] 41 | } -------------------------------------------------------------------------------- /examples/minion2.linen.conflist: -------------------------------------------------------------------------------- 1 | { 2 | "name":"linen-network", 3 | "cniVersion":"0.3.1", 4 | "plugins":[ 5 | { 6 | "type":"bridge", 7 | "bridge":"kbr0", 8 | "isGateway":true, 9 | "isDefaultGateway":true, 10 | "forceAddress":false, 11 | "ipMasq":true, 12 | "mtu":1400, 13 | "hairpinMode":false, 14 | "ipam":{ 15 | "type":"host-local", 16 | "subnet":"10.244.0.0/16", 17 | "rangeStart":"10.244.3.10", 18 | "rangeEnd":"10.244.3.150", 19 | "routes":[ 20 | { 21 | "dst":"0.0.0.0/0" 22 | } 23 | ], 24 | "gateway":"10.244.3.1" 25 | } 26 | }, 27 | { 28 | "type":"linen", 29 | "runtimeConfig":{ 30 | "ovs":{ 31 | "isMaster":false, 32 | "ovsBridge":"br0", 33 | "vtepIPs":[ 34 | "10.245.2.2" 35 | ], 36 | "controller":"192.168.2.100:6653" 37 | } 38 | } 39 | } 40 | ] 41 | } -------------------------------------------------------------------------------- /images/mgmt-workflow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/John-Lin/linen-cni/cdc9b8ea9abfff0c419e44f2a9e3a469049bf2c6/images/mgmt-workflow.png -------------------------------------------------------------------------------- /images/ovs-networking.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/John-Lin/linen-cni/cdc9b8ea9abfff0c419e44f2a9e3a469049bf2c6/images/ovs-networking.png -------------------------------------------------------------------------------- /kubernetes/controllers/onos-deployment.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: extensions/v1beta1 2 | kind: Deployment 3 | metadata: 4 | name: onos-deployment 5 | spec: 6 | replicas: 1 7 | template: 8 | metadata: 9 | labels: 10 | app: onos 11 | spec: 12 | hostNetwork: true 13 | containers: 14 | - name: onos 15 | image: onosproject/onos:1.10.3 16 | env: 17 | - name: ONOS_APPS 18 | value: "drivers,openflow,fwd,proxyarp" 19 | args: 20 | - start 21 | ports: 22 | - containerPort: 6653 23 | name: openflow 24 | - containerPort: 6640 25 | name: ovsdb 26 | - containerPort: 8181 27 | name: gui 28 | - containerPort: 8101 29 | name: onos-cli 30 | - containerPort: 9876 31 | name: cluster 32 | nodeSelector: 33 | nodetype: master -------------------------------------------------------------------------------- /kubernetes/controllers/ryu-deployment.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: extensions/v1beta1 2 | kind: Deployment 3 | metadata: 4 | name: ryu-deployment 5 | spec: 6 | replicas: 1 7 | template: 8 | metadata: 9 | labels: 10 | app: ryu 11 | spec: 12 | hostNetwork: true 13 | containers: 14 | - name: ryu 15 | image: osrg/ryu 16 | args: 17 | - ryu-manager 18 | - ./ryu/ryu/app/simple_switch_13.py 19 | ports: 20 | - containerPort: 6653 21 | name: openflow 22 | nodeSelector: 23 | nodetype: master 24 | -------------------------------------------------------------------------------- /kubernetes/daemon/Dockerfile: -------------------------------------------------------------------------------- 1 | # build stage 2 | FROM golang:1.8.3-stretch AS build-env 3 | ADD . /src 4 | RUN go get -u k8s.io/apimachinery/pkg/apis/meta/v1 && \ 5 | go get -u k8s.io/client-go/kubernetes && \ 6 | go get -u k8s.io/client-go/rest && \ 7 | go get -u github.com/John-Lin/ovsdbDriver && \ 8 | go get -u github.com/sirupsen/logrus && \ 9 | go get -u github.com/containernetworking/cni/pkg/types 10 | RUN cd /src && go build -o flaxd 11 | 12 | # final stage 13 | FROM debian:stretch-slim 14 | WORKDIR /app 15 | COPY --from=build-env /src/flaxd /app/ 16 | ENTRYPOINT ./flaxd 17 | -------------------------------------------------------------------------------- /kubernetes/flaxd-rbac.yaml: -------------------------------------------------------------------------------- 1 | # Create the clusterrole and clusterrolebinding: 2 | # $ kubectl create -f flaxd-rbac.yml 3 | # Create the pod using the same namespace used by the flax serviceaccount: 4 | # $ kubectl create --namespace kube-system -f flaxd.yml 5 | --- 6 | kind: ClusterRole 7 | apiVersion: rbac.authorization.k8s.io/v1beta1 8 | metadata: 9 | name: flax 10 | rules: 11 | - apiGroups: [""] 12 | resources: ["nodes"] 13 | verbs: ["get", "watch", "list"] 14 | --- 15 | kind: ClusterRoleBinding 16 | apiVersion: rbac.authorization.k8s.io/v1beta1 17 | metadata: 18 | name: flax 19 | roleRef: 20 | apiGroup: rbac.authorization.k8s.io 21 | kind: ClusterRole 22 | name: flax 23 | subjects: 24 | - kind: ServiceAccount 25 | name: flax 26 | namespace: kube-system -------------------------------------------------------------------------------- /kubernetes/flaxd.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: v1 3 | kind: ServiceAccount 4 | metadata: 5 | name: flax 6 | namespace: kube-system 7 | --- 8 | apiVersion: extensions/v1beta1 9 | kind: DaemonSet 10 | metadata: 11 | name: kube-flax-ds 12 | namespace: kube-system 13 | spec: 14 | template: 15 | metadata: 16 | labels: 17 | app: flaxd 18 | spec: 19 | serviceAccountName: flax 20 | containers: 21 | - name: flaxd 22 | image: johnlin/flaxd 23 | volumeMounts: 24 | - name: ovsdbsock 25 | mountPath: /var/run/openvswitch/db.sock 26 | - name: netconf 27 | mountPath: /etc/cni/net.d/linen.conflist 28 | volumes: 29 | - hostPath: 30 | path: /var/run/openvswitch/db.sock 31 | name: ovsdbsock 32 | - hostPath: 33 | path: /etc/cni/net.d/linen.conflist 34 | name: netconf -------------------------------------------------------------------------------- /linen/utils.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2017 Che Wei, Lin 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 main 16 | 17 | import ( 18 | "fmt" 19 | "strings" 20 | ) 21 | 22 | // vxlanIfName returns formatted vxlan interface name 23 | func vxlanIfName(vtepIP string) string { 24 | return fmt.Sprintf("vxif%s", strings.Replace(vtepIP, ".", "_", -1)) 25 | } 26 | -------------------------------------------------------------------------------- /linen/utils_test.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2017 Che Wei, Lin 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 main 16 | 17 | import ( 18 | "math/rand" 19 | "strconv" 20 | "strings" 21 | "testing" 22 | "time" 23 | ) 24 | 25 | func TestVxlanIfName(t *testing.T) { 26 | // Test to returns formatted vxlan interface name 27 | s1 := rand.NewSource(time.Now().UnixNano()) 28 | r1 := rand.New(s1) 29 | 30 | var reg []string 31 | for i := 0; i <= 3; i++ { 32 | reg = append(reg, strconv.Itoa(r1.Intn(256))) 33 | } 34 | 35 | intfName := vxlanIfName(strings.Join(reg[:], ".")) 36 | 37 | checked := "vxif" + strings.Join(reg[:], "_") 38 | 39 | if intfName != checked { 40 | t.Error("Failed to generate vxlanIfName") 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /vendor/github.com/John-Lin/ovsdb/README.md: -------------------------------------------------------------------------------- 1 | ovsdb 2 | ==== 3 | A libovsdb wrapper for operating [Open vSwitch](http://openvswitch.org/) via Go. 4 | 5 | This library is a fork of the ovsdbDriver functionality in [contiv/ofnet](https://github.com/contiv/ofnet) and makes modifications for supporting Unix domain socket to connect OVSDB. 6 | 7 | ## Install 8 | 9 | ``` 10 | $ go get -u github.com/John-Lin/ovsdb 11 | ``` 12 | 13 | ## Usage with ovsdb-server 14 | 15 | You might need to create OVS bridge on given IP and TCP port, please make sure that you have set OVSDB listener. 16 | 17 | ``` 18 | $ ovs-vsctl set-manager ptcp:6640 19 | ``` 20 | 21 | Create bridge should assign IP and TCP port. 22 | 23 | ```go 24 | ovsDriver = ovsdb.NewOvsDriver("ovsbr", "127.0.0.1", 6640) 25 | ``` 26 | 27 | Otherwise, `ovsdb-server` connects to the Unix domain server socket and the default path is `unix:/var/run/openvswitch/db.sock` . 28 | 29 | ```go 30 | ovsDriver = ovsdb.NewOvsDriverWithUnix("br0") 31 | ``` 32 | 33 | ## Example 34 | ```go 35 | package main 36 | 37 | import "github.com/John-Lin/ovsdb" 38 | 39 | var ovsDriver *ovsdb.OvsDriver 40 | 41 | func main() { 42 | // Create an OVS bridge to the Unix domain server socket. 43 | ovsDriver = ovsdb.NewOvsDriverWithUnix("br0") 44 | 45 | // Create an OVS bridge to the given IP and TCP port. 46 | // ovsDriver = ovsdb.NewOvsDriver("br0", "127.0.0.1", 6640) 47 | 48 | // Add br0 as a internal port without vlan tag (0) 49 | ovsDriver.CreatePort("br0", "internal", 0) 50 | } 51 | ``` 52 | 53 | Use `ovs-vsctl show` to check bridge information. 54 | 55 | ``` 56 | root@dev:~# ovs-vsctl show 57 | 82040598-7050-4320-b946-1d4380fabc73 58 | Bridge "br0" 59 | Port "br0" 60 | Interface "br0" 61 | type: internal 62 | ovs_version: "2.5.2" 63 | ``` 64 | 65 | ## Related 66 | - [libovsdb](https://github.com/socketplane/libovsdb) is an OVSDB library which is originally developed by SocketPlane. 67 | - [contiv/ofnet](https://github.com/contiv/ofnet) is openflow networking library. 68 | 69 | 70 | -------------------------------------------------------------------------------- /vendor/github.com/John-Lin/ovsdb/utils.go: -------------------------------------------------------------------------------- 1 | package ovsdb 2 | 3 | import ( 4 | "os/exec" 5 | "regexp" 6 | ) 7 | 8 | func ovsdbUnixPath() string { 9 | var path string 10 | var re = regexp.MustCompile(`--remote=punix:(/.*openvswitch.*sock)`) 11 | cmd := "pgrep -f -a ovsdb-server" 12 | out, _ := exec.Command("sh", "-c", cmd).Output() 13 | if len(out) != 0 { 14 | str := string(out[:]) 15 | strSubMatch := re.FindStringSubmatch(str) 16 | if len(strSubMatch) != 0 { 17 | path = strSubMatch[1] 18 | } 19 | } 20 | return path 21 | } 22 | -------------------------------------------------------------------------------- /vendor/github.com/cenkalti/hub/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Cenk Altı 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | this software and associated documentation files (the "Software"), to deal in 7 | the Software without restriction, including without limitation the rights to 8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | the Software, and to permit persons to whom the Software is furnished to do so, 10 | subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /vendor/github.com/cenkalti/hub/README.md: -------------------------------------------------------------------------------- 1 | hub 2 | === 3 | 4 | [![GoDoc](https://godoc.org/github.com/cenkalti/hub?status.png)](https://godoc.org/github.com/cenkalti/hub) 5 | [![Build Status](https://travis-ci.org/cenkalti/hub.png)](https://travis-ci.org/cenkalti/hub) 6 | -------------------------------------------------------------------------------- /vendor/github.com/cenkalti/hub/hub.go: -------------------------------------------------------------------------------- 1 | // Package hub provides a simple event dispatcher for publish/subscribe pattern. 2 | package hub 3 | 4 | import "sync" 5 | 6 | type Kind int 7 | 8 | // Event is an interface for published events. 9 | type Event interface { 10 | Kind() Kind 11 | } 12 | 13 | // Hub is an event dispatcher, publishes events to the subscribers 14 | // which are subscribed for a specific event type. 15 | // Optimized for publish calls. 16 | // The handlers may be called in order different than they are registered. 17 | type Hub struct { 18 | subscribers map[Kind][]handler 19 | m sync.RWMutex 20 | seq uint64 21 | } 22 | 23 | type handler struct { 24 | f func(Event) 25 | id uint64 26 | } 27 | 28 | // Subscribe registers f for the event of a specific kind. 29 | func (h *Hub) Subscribe(kind Kind, f func(Event)) (cancel func()) { 30 | var cancelled bool 31 | h.m.Lock() 32 | h.seq++ 33 | id := h.seq 34 | if h.subscribers == nil { 35 | h.subscribers = make(map[Kind][]handler) 36 | } 37 | h.subscribers[kind] = append(h.subscribers[kind], handler{id: id, f: f}) 38 | h.m.Unlock() 39 | return func() { 40 | h.m.Lock() 41 | if cancelled { 42 | h.m.Unlock() 43 | return 44 | } 45 | cancelled = true 46 | a := h.subscribers[kind] 47 | for i, f := range a { 48 | if f.id == id { 49 | a[i], h.subscribers[kind] = a[len(a)-1], a[:len(a)-1] 50 | break 51 | } 52 | } 53 | if len(a) == 0 { 54 | delete(h.subscribers, kind) 55 | } 56 | h.m.Unlock() 57 | } 58 | } 59 | 60 | // Publish an event to the subscribers. 61 | func (h *Hub) Publish(e Event) { 62 | h.m.RLock() 63 | if handlers, ok := h.subscribers[e.Kind()]; ok { 64 | for _, h := range handlers { 65 | h.f(e) 66 | } 67 | } 68 | h.m.RUnlock() 69 | } 70 | 71 | // DefaultHub is the default Hub used by Publish and Subscribe. 72 | var DefaultHub Hub 73 | 74 | // Subscribe registers f for the event of a specific kind in the DefaultHub. 75 | func Subscribe(kind Kind, f func(Event)) (cancel func()) { 76 | return DefaultHub.Subscribe(kind, f) 77 | } 78 | 79 | // Publish an event to the subscribers in DefaultHub. 80 | func Publish(e Event) { 81 | DefaultHub.Publish(e) 82 | } 83 | -------------------------------------------------------------------------------- /vendor/github.com/cenkalti/rpc2/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Cenk Altı 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. -------------------------------------------------------------------------------- /vendor/github.com/cenkalti/rpc2/README.md: -------------------------------------------------------------------------------- 1 | rpc2 2 | ==== 3 | 4 | [![GoDoc](https://godoc.org/github.com/cenkalti/rpc2?status.png)](https://godoc.org/github.com/cenkalti/rpc2) 5 | [![Build Status](https://travis-ci.org/cenkalti/rpc2.png)](https://travis-ci.org/cenkalti/rpc2) 6 | 7 | rpc2 is a fork of net/rpc package in the standard library. 8 | The main goal is to add bi-directional support to calls. 9 | That means server can call the methods of client. 10 | This is not possible with net/rpc package. 11 | In order to do this it adds a `*Client` argument to method signatures. 12 | 13 | Install 14 | -------- 15 | 16 | go get github.com/cenkalti/rpc2 17 | 18 | Example server 19 | --------------- 20 | 21 | ```go 22 | type Args struct{ A, B int } 23 | type Reply int 24 | 25 | srv := rpc2.NewServer() 26 | srv.Handle("add", func(client *rpc2.Client, args *Args, reply *Reply) error { 27 | // Reversed call (server to client) 28 | var rep Reply 29 | client.Call("mult", Args{2, 3}, &rep) 30 | fmt.Println("mult result:", rep) 31 | 32 | *reply = Reply(args.A + args.B) 33 | return nil 34 | }) 35 | 36 | lis, _ := net.Listen("tcp", "127.0.0.1:5000") 37 | srv.Accept(lis) 38 | ``` 39 | 40 | Example Client 41 | --------------- 42 | 43 | ```go 44 | type Args struct{ A, B int } 45 | type Reply int 46 | 47 | conn, _ := net.Dial("tcp", "127.0.0.1:5000") 48 | 49 | clt := rpc2.NewClient(conn) 50 | clt.Handle("mult", func(client *rpc2.Client, args *Args, reply *Reply) error { 51 | *reply = Reply(args.A * args.B) 52 | return nil 53 | }) 54 | go clt.Run() 55 | 56 | var rep Reply 57 | clt.Call("add", Args{1, 2}, &rep) 58 | fmt.Println("add result:", rep) 59 | ``` 60 | -------------------------------------------------------------------------------- /vendor/github.com/cenkalti/rpc2/state.go: -------------------------------------------------------------------------------- 1 | package rpc2 2 | 3 | import "sync" 4 | 5 | type State struct { 6 | store map[string]interface{} 7 | m sync.RWMutex 8 | } 9 | 10 | func NewState() *State { 11 | return &State{store: make(map[string]interface{})} 12 | } 13 | 14 | func (s *State) Get(key string) (value interface{}, ok bool) { 15 | s.m.RLock() 16 | value, ok = s.store[key] 17 | s.m.RUnlock() 18 | return 19 | } 20 | 21 | func (s *State) Set(key string, value interface{}) { 22 | s.m.Lock() 23 | s.store[key] = value 24 | s.m.Unlock() 25 | } 26 | -------------------------------------------------------------------------------- /vendor/github.com/containernetworking/cni/pkg/invoke/args.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 CNI authors 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 invoke 16 | 17 | import ( 18 | "os" 19 | "strings" 20 | ) 21 | 22 | type CNIArgs interface { 23 | // For use with os/exec; i.e., return nil to inherit the 24 | // environment from this process 25 | AsEnv() []string 26 | } 27 | 28 | type inherited struct{} 29 | 30 | var inheritArgsFromEnv inherited 31 | 32 | func (_ *inherited) AsEnv() []string { 33 | return nil 34 | } 35 | 36 | func ArgsFromEnv() CNIArgs { 37 | return &inheritArgsFromEnv 38 | } 39 | 40 | type Args struct { 41 | Command string 42 | ContainerID string 43 | NetNS string 44 | PluginArgs [][2]string 45 | PluginArgsStr string 46 | IfName string 47 | Path string 48 | } 49 | 50 | // Args implements the CNIArgs interface 51 | var _ CNIArgs = &Args{} 52 | 53 | func (args *Args) AsEnv() []string { 54 | env := os.Environ() 55 | pluginArgsStr := args.PluginArgsStr 56 | if pluginArgsStr == "" { 57 | pluginArgsStr = stringify(args.PluginArgs) 58 | } 59 | 60 | // Ensure that the custom values are first, so any value present in 61 | // the process environment won't override them. 62 | env = append([]string{ 63 | "CNI_COMMAND=" + args.Command, 64 | "CNI_CONTAINERID=" + args.ContainerID, 65 | "CNI_NETNS=" + args.NetNS, 66 | "CNI_ARGS=" + pluginArgsStr, 67 | "CNI_IFNAME=" + args.IfName, 68 | "CNI_PATH=" + args.Path, 69 | }, env...) 70 | return env 71 | } 72 | 73 | // taken from rkt/networking/net_plugin.go 74 | func stringify(pluginArgs [][2]string) string { 75 | entries := make([]string, len(pluginArgs)) 76 | 77 | for i, kv := range pluginArgs { 78 | entries[i] = strings.Join(kv[:], "=") 79 | } 80 | 81 | return strings.Join(entries, ";") 82 | } 83 | -------------------------------------------------------------------------------- /vendor/github.com/containernetworking/cni/pkg/invoke/delegate.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 CNI authors 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 invoke 16 | 17 | import ( 18 | "fmt" 19 | "os" 20 | "path/filepath" 21 | 22 | "github.com/containernetworking/cni/pkg/types" 23 | ) 24 | 25 | func DelegateAdd(delegatePlugin string, netconf []byte) (types.Result, error) { 26 | if os.Getenv("CNI_COMMAND") != "ADD" { 27 | return nil, fmt.Errorf("CNI_COMMAND is not ADD") 28 | } 29 | 30 | paths := filepath.SplitList(os.Getenv("CNI_PATH")) 31 | 32 | pluginPath, err := FindInPath(delegatePlugin, paths) 33 | if err != nil { 34 | return nil, err 35 | } 36 | 37 | return ExecPluginWithResult(pluginPath, netconf, ArgsFromEnv()) 38 | } 39 | 40 | func DelegateDel(delegatePlugin string, netconf []byte) error { 41 | if os.Getenv("CNI_COMMAND") != "DEL" { 42 | return fmt.Errorf("CNI_COMMAND is not DEL") 43 | } 44 | 45 | paths := filepath.SplitList(os.Getenv("CNI_PATH")) 46 | 47 | pluginPath, err := FindInPath(delegatePlugin, paths) 48 | if err != nil { 49 | return err 50 | } 51 | 52 | return ExecPluginWithoutResult(pluginPath, netconf, ArgsFromEnv()) 53 | } 54 | -------------------------------------------------------------------------------- /vendor/github.com/containernetworking/cni/pkg/invoke/find.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 CNI authors 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 invoke 16 | 17 | import ( 18 | "fmt" 19 | "os" 20 | "path/filepath" 21 | ) 22 | 23 | // FindInPath returns the full path of the plugin by searching in the provided path 24 | func FindInPath(plugin string, paths []string) (string, error) { 25 | if plugin == "" { 26 | return "", fmt.Errorf("no plugin name provided") 27 | } 28 | 29 | if len(paths) == 0 { 30 | return "", fmt.Errorf("no paths provided") 31 | } 32 | 33 | for _, path := range paths { 34 | for _, fe := range ExecutableFileExtensions { 35 | fullpath := filepath.Join(path, plugin) + fe 36 | if fi, err := os.Stat(fullpath); err == nil && fi.Mode().IsRegular() { 37 | return fullpath, nil 38 | } 39 | } 40 | } 41 | 42 | return "", fmt.Errorf("failed to find plugin %q in path %s", plugin, paths) 43 | } 44 | -------------------------------------------------------------------------------- /vendor/github.com/containernetworking/cni/pkg/invoke/os_unix.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 CNI authors 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 | // +build darwin dragonfly freebsd linux netbsd opensbd solaris 16 | 17 | package invoke 18 | 19 | // Valid file extensions for plugin executables. 20 | var ExecutableFileExtensions = []string{""} 21 | -------------------------------------------------------------------------------- /vendor/github.com/containernetworking/cni/pkg/invoke/os_windows.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 CNI authors 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 invoke 16 | 17 | // Valid file extensions for plugin executables. 18 | var ExecutableFileExtensions = []string{".exe", ""} 19 | -------------------------------------------------------------------------------- /vendor/github.com/containernetworking/cni/pkg/invoke/raw_exec.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 CNI authors 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 invoke 16 | 17 | import ( 18 | "bytes" 19 | "encoding/json" 20 | "fmt" 21 | "io" 22 | "os/exec" 23 | 24 | "github.com/containernetworking/cni/pkg/types" 25 | ) 26 | 27 | type RawExec struct { 28 | Stderr io.Writer 29 | } 30 | 31 | func (e *RawExec) ExecPlugin(pluginPath string, stdinData []byte, environ []string) ([]byte, error) { 32 | stdout := &bytes.Buffer{} 33 | 34 | c := exec.Cmd{ 35 | Env: environ, 36 | Path: pluginPath, 37 | Args: []string{pluginPath}, 38 | Stdin: bytes.NewBuffer(stdinData), 39 | Stdout: stdout, 40 | Stderr: e.Stderr, 41 | } 42 | if err := c.Run(); err != nil { 43 | return nil, pluginErr(err, stdout.Bytes()) 44 | } 45 | 46 | return stdout.Bytes(), nil 47 | } 48 | 49 | func pluginErr(err error, output []byte) error { 50 | if _, ok := err.(*exec.ExitError); ok { 51 | emsg := types.Error{} 52 | if perr := json.Unmarshal(output, &emsg); perr != nil { 53 | emsg.Msg = fmt.Sprintf("netplugin failed but error parsing its diagnostic message %q: %v", string(output), perr) 54 | } 55 | return &emsg 56 | } 57 | 58 | return err 59 | } 60 | -------------------------------------------------------------------------------- /vendor/github.com/containernetworking/cni/pkg/version/conf.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 CNI authors 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 version 16 | 17 | import ( 18 | "encoding/json" 19 | "fmt" 20 | ) 21 | 22 | // ConfigDecoder can decode the CNI version available in network config data 23 | type ConfigDecoder struct{} 24 | 25 | func (*ConfigDecoder) Decode(jsonBytes []byte) (string, error) { 26 | var conf struct { 27 | CNIVersion string `json:"cniVersion"` 28 | } 29 | err := json.Unmarshal(jsonBytes, &conf) 30 | if err != nil { 31 | return "", fmt.Errorf("decoding version from network config: %s", err) 32 | } 33 | if conf.CNIVersion == "" { 34 | return "0.1.0", nil 35 | } 36 | return conf.CNIVersion, nil 37 | } 38 | -------------------------------------------------------------------------------- /vendor/github.com/containernetworking/cni/pkg/version/plugin.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 CNI authors 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 version 16 | 17 | import ( 18 | "encoding/json" 19 | "fmt" 20 | "io" 21 | ) 22 | 23 | // PluginInfo reports information about CNI versioning 24 | type PluginInfo interface { 25 | // SupportedVersions returns one or more CNI spec versions that the plugin 26 | // supports. If input is provided in one of these versions, then the plugin 27 | // promises to use the same CNI version in its response 28 | SupportedVersions() []string 29 | 30 | // Encode writes this CNI version information as JSON to the given Writer 31 | Encode(io.Writer) error 32 | } 33 | 34 | type pluginInfo struct { 35 | CNIVersion_ string `json:"cniVersion"` 36 | SupportedVersions_ []string `json:"supportedVersions,omitempty"` 37 | } 38 | 39 | // pluginInfo implements the PluginInfo interface 40 | var _ PluginInfo = &pluginInfo{} 41 | 42 | func (p *pluginInfo) Encode(w io.Writer) error { 43 | return json.NewEncoder(w).Encode(p) 44 | } 45 | 46 | func (p *pluginInfo) SupportedVersions() []string { 47 | return p.SupportedVersions_ 48 | } 49 | 50 | // PluginSupports returns a new PluginInfo that will report the given versions 51 | // as supported 52 | func PluginSupports(supportedVersions ...string) PluginInfo { 53 | if len(supportedVersions) < 1 { 54 | panic("programmer error: you must support at least one version") 55 | } 56 | return &pluginInfo{ 57 | CNIVersion_: Current(), 58 | SupportedVersions_: supportedVersions, 59 | } 60 | } 61 | 62 | // PluginDecoder can decode the response returned by a plugin's VERSION command 63 | type PluginDecoder struct{} 64 | 65 | func (*PluginDecoder) Decode(jsonBytes []byte) (PluginInfo, error) { 66 | var info pluginInfo 67 | err := json.Unmarshal(jsonBytes, &info) 68 | if err != nil { 69 | return nil, fmt.Errorf("decoding version info: %s", err) 70 | } 71 | if info.CNIVersion_ == "" { 72 | return nil, fmt.Errorf("decoding version info: missing field cniVersion") 73 | } 74 | if len(info.SupportedVersions_) == 0 { 75 | if info.CNIVersion_ == "0.2.0" { 76 | return PluginSupports("0.1.0", "0.2.0"), nil 77 | } 78 | return nil, fmt.Errorf("decoding version info: missing field supportedVersions") 79 | } 80 | return &info, nil 81 | } 82 | -------------------------------------------------------------------------------- /vendor/github.com/containernetworking/cni/pkg/version/reconcile.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 CNI authors 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 version 16 | 17 | import "fmt" 18 | 19 | type ErrorIncompatible struct { 20 | Config string 21 | Supported []string 22 | } 23 | 24 | func (e *ErrorIncompatible) Details() string { 25 | return fmt.Sprintf("config is %q, plugin supports %q", e.Config, e.Supported) 26 | } 27 | 28 | func (e *ErrorIncompatible) Error() string { 29 | return fmt.Sprintf("incompatible CNI versions: %s", e.Details()) 30 | } 31 | 32 | type Reconciler struct{} 33 | 34 | func (r *Reconciler) Check(configVersion string, pluginInfo PluginInfo) *ErrorIncompatible { 35 | return r.CheckRaw(configVersion, pluginInfo.SupportedVersions()) 36 | } 37 | 38 | func (*Reconciler) CheckRaw(configVersion string, supportedVersions []string) *ErrorIncompatible { 39 | for _, supportedVersion := range supportedVersions { 40 | if configVersion == supportedVersion { 41 | return nil 42 | } 43 | } 44 | 45 | return &ErrorIncompatible{ 46 | Config: configVersion, 47 | Supported: supportedVersions, 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /vendor/github.com/containernetworking/cni/pkg/version/version.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 CNI authors 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 version 16 | 17 | import ( 18 | "fmt" 19 | 20 | "github.com/containernetworking/cni/pkg/types" 21 | "github.com/containernetworking/cni/pkg/types/020" 22 | "github.com/containernetworking/cni/pkg/types/current" 23 | ) 24 | 25 | // Current reports the version of the CNI spec implemented by this library 26 | func Current() string { 27 | return "0.3.1" 28 | } 29 | 30 | // Legacy PluginInfo describes a plugin that is backwards compatible with the 31 | // CNI spec version 0.1.0. In particular, a runtime compiled against the 0.1.0 32 | // library ought to work correctly with a plugin that reports support for 33 | // Legacy versions. 34 | // 35 | // Any future CNI spec versions which meet this definition should be added to 36 | // this list. 37 | var Legacy = PluginSupports("0.1.0", "0.2.0") 38 | var All = PluginSupports("0.1.0", "0.2.0", "0.3.0", "0.3.1") 39 | 40 | var resultFactories = []struct { 41 | supportedVersions []string 42 | newResult types.ResultFactoryFunc 43 | }{ 44 | {current.SupportedVersions, current.NewResult}, 45 | {types020.SupportedVersions, types020.NewResult}, 46 | } 47 | 48 | // Finds a Result object matching the requested version (if any) and asks 49 | // that object to parse the plugin result, returning an error if parsing failed. 50 | func NewResult(version string, resultBytes []byte) (types.Result, error) { 51 | reconciler := &Reconciler{} 52 | for _, resultFactory := range resultFactories { 53 | err := reconciler.CheckRaw(version, resultFactory.supportedVersions) 54 | if err == nil { 55 | // Result supports this version 56 | return resultFactory.newResult(resultBytes) 57 | } 58 | } 59 | 60 | return nil, fmt.Errorf("unsupported CNI result version %q", version) 61 | } 62 | -------------------------------------------------------------------------------- /vendor/github.com/containernetworking/plugins/pkg/ip/addr.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 CNI authors 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 ip 16 | 17 | import ( 18 | "fmt" 19 | "syscall" 20 | "time" 21 | 22 | "github.com/vishvananda/netlink" 23 | ) 24 | 25 | const SETTLE_INTERVAL = 50 * time.Millisecond 26 | 27 | // SettleAddresses waits for all addresses on a link to leave tentative state. 28 | // This is particularly useful for ipv6, where all addresses need to do DAD. 29 | // There is no easy way to wait for this as an event, so just loop until the 30 | // addresses are no longer tentative. 31 | // If any addresses are still tentative after timeout seconds, then error. 32 | func SettleAddresses(ifName string, timeout int) error { 33 | link, err := netlink.LinkByName(ifName) 34 | if err != nil { 35 | return fmt.Errorf("failed to retrieve link: %v", err) 36 | } 37 | 38 | deadline := time.Now().Add(time.Duration(timeout) * time.Second) 39 | for { 40 | addrs, err := netlink.AddrList(link, netlink.FAMILY_ALL) 41 | if err != nil { 42 | return fmt.Errorf("could not list addresses: %v", err) 43 | } 44 | 45 | if len(addrs) == 0 { 46 | return nil 47 | } 48 | 49 | ok := true 50 | for _, addr := range addrs { 51 | if addr.Flags&(syscall.IFA_F_TENTATIVE|syscall.IFA_F_DADFAILED) > 0 { 52 | ok = false 53 | break // Break out of the `range addrs`, not the `for` 54 | } 55 | } 56 | 57 | if ok { 58 | return nil 59 | } 60 | if time.Now().After(deadline) { 61 | return fmt.Errorf("link %s still has tentative addresses after %d seconds", 62 | ifName, 63 | timeout) 64 | } 65 | 66 | time.Sleep(SETTLE_INTERVAL) 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /vendor/github.com/containernetworking/plugins/pkg/ip/cidr.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 CNI authors 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 ip 16 | 17 | import ( 18 | "math/big" 19 | "net" 20 | ) 21 | 22 | // NextIP returns IP incremented by 1 23 | func NextIP(ip net.IP) net.IP { 24 | i := ipToInt(ip) 25 | return intToIP(i.Add(i, big.NewInt(1))) 26 | } 27 | 28 | // PrevIP returns IP decremented by 1 29 | func PrevIP(ip net.IP) net.IP { 30 | i := ipToInt(ip) 31 | return intToIP(i.Sub(i, big.NewInt(1))) 32 | } 33 | 34 | // Cmp compares two IPs, returning the usual ordering: 35 | // a < b : -1 36 | // a == b : 0 37 | // a > b : 1 38 | func Cmp(a, b net.IP) int { 39 | aa := ipToInt(a) 40 | bb := ipToInt(b) 41 | return aa.Cmp(bb) 42 | } 43 | 44 | func ipToInt(ip net.IP) *big.Int { 45 | if v := ip.To4(); v != nil { 46 | return big.NewInt(0).SetBytes(v) 47 | } 48 | return big.NewInt(0).SetBytes(ip.To16()) 49 | } 50 | 51 | func intToIP(i *big.Int) net.IP { 52 | return net.IP(i.Bytes()) 53 | } 54 | 55 | // Network masks off the host portion of the IP 56 | func Network(ipn *net.IPNet) *net.IPNet { 57 | return &net.IPNet{ 58 | IP: ipn.IP.Mask(ipn.Mask), 59 | Mask: ipn.Mask, 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /vendor/github.com/containernetworking/plugins/pkg/ip/ipforward.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 CNI authors 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 ip 16 | 17 | import ( 18 | "io/ioutil" 19 | 20 | "github.com/containernetworking/cni/pkg/types/current" 21 | ) 22 | 23 | func EnableIP4Forward() error { 24 | return echo1("/proc/sys/net/ipv4/ip_forward") 25 | } 26 | 27 | func EnableIP6Forward() error { 28 | return echo1("/proc/sys/net/ipv6/conf/all/forwarding") 29 | } 30 | 31 | // EnableForward will enable forwarding for all configured 32 | // address families 33 | func EnableForward(ips []*current.IPConfig) error { 34 | v4 := false 35 | v6 := false 36 | 37 | for _, ip := range ips { 38 | if ip.Version == "4" && !v4 { 39 | if err := EnableIP4Forward(); err != nil { 40 | return err 41 | } 42 | v4 = true 43 | } else if ip.Version == "6" && !v6 { 44 | if err := EnableIP6Forward(); err != nil { 45 | return err 46 | } 47 | v6 = true 48 | } 49 | } 50 | return nil 51 | } 52 | 53 | func echo1(f string) error { 54 | return ioutil.WriteFile(f, []byte("1"), 0644) 55 | } 56 | -------------------------------------------------------------------------------- /vendor/github.com/containernetworking/plugins/pkg/ip/route.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 CNI authors 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 ip 16 | 17 | import ( 18 | "net" 19 | 20 | "github.com/vishvananda/netlink" 21 | ) 22 | 23 | // AddDefaultRoute sets the default route on the given gateway. 24 | func AddDefaultRoute(gw net.IP, dev netlink.Link) error { 25 | _, defNet, _ := net.ParseCIDR("0.0.0.0/0") 26 | return AddRoute(defNet, gw, dev) 27 | } 28 | -------------------------------------------------------------------------------- /vendor/github.com/containernetworking/plugins/pkg/ip/route_linux.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015-2017 CNI authors 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 ip 16 | 17 | import ( 18 | "net" 19 | 20 | "github.com/vishvananda/netlink" 21 | ) 22 | 23 | // AddRoute adds a universally-scoped route to a device. 24 | func AddRoute(ipn *net.IPNet, gw net.IP, dev netlink.Link) error { 25 | return netlink.RouteAdd(&netlink.Route{ 26 | LinkIndex: dev.Attrs().Index, 27 | Scope: netlink.SCOPE_UNIVERSE, 28 | Dst: ipn, 29 | Gw: gw, 30 | }) 31 | } 32 | 33 | // AddHostRoute adds a host-scoped route to a device. 34 | func AddHostRoute(ipn *net.IPNet, gw net.IP, dev netlink.Link) error { 35 | return netlink.RouteAdd(&netlink.Route{ 36 | LinkIndex: dev.Attrs().Index, 37 | Scope: netlink.SCOPE_HOST, 38 | Dst: ipn, 39 | Gw: gw, 40 | }) 41 | } 42 | -------------------------------------------------------------------------------- /vendor/github.com/containernetworking/plugins/pkg/ip/route_unspecified.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015-2017 CNI authors 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 | // +build !linux 16 | 17 | package ip 18 | 19 | import ( 20 | "net" 21 | 22 | "github.com/containernetworking/cni/pkg/types" 23 | "github.com/vishvananda/netlink" 24 | ) 25 | 26 | // AddRoute adds a universally-scoped route to a device. 27 | func AddRoute(ipn *net.IPNet, gw net.IP, dev netlink.Link) error { 28 | return types.NotImplementedError 29 | } 30 | 31 | // AddHostRoute adds a host-scoped route to a device. 32 | func AddHostRoute(ipn *net.IPNet, gw net.IP, dev netlink.Link) error { 33 | return types.NotImplementedError 34 | } 35 | -------------------------------------------------------------------------------- /vendor/github.com/containernetworking/plugins/pkg/ns/ns_unspecified.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015-2017 CNI authors 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 | // +build !linux 16 | 17 | package ns 18 | 19 | import "github.com/containernetworking/cni/pkg/types" 20 | 21 | // Returns an object representing the current OS thread's network namespace 22 | func GetCurrentNS() (NetNS, error) { 23 | return nil, types.NotImplementedError 24 | } 25 | 26 | func NewNS() (NetNS, error) { 27 | return nil, types.NotImplementedError 28 | } 29 | 30 | func (ns *netNS) Close() error { 31 | return types.NotImplementedError 32 | } 33 | 34 | func (ns *netNS) Set() error { 35 | return types.NotImplementedError 36 | } 37 | -------------------------------------------------------------------------------- /vendor/github.com/containernetworking/plugins/pkg/utils/hwaddr/hwaddr.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 CNI authors 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 hwaddr 16 | 17 | import ( 18 | "fmt" 19 | "net" 20 | ) 21 | 22 | const ( 23 | ipRelevantByteLen = 4 24 | PrivateMACPrefixString = "0a:58" 25 | ) 26 | 27 | var ( 28 | // private mac prefix safe to use 29 | PrivateMACPrefix = []byte{0x0a, 0x58} 30 | ) 31 | 32 | type SupportIp4OnlyErr struct{ msg string } 33 | 34 | func (e SupportIp4OnlyErr) Error() string { return e.msg } 35 | 36 | type MacParseErr struct{ msg string } 37 | 38 | func (e MacParseErr) Error() string { return e.msg } 39 | 40 | type InvalidPrefixLengthErr struct{ msg string } 41 | 42 | func (e InvalidPrefixLengthErr) Error() string { return e.msg } 43 | 44 | // GenerateHardwareAddr4 generates 48 bit virtual mac addresses based on the IP4 input. 45 | func GenerateHardwareAddr4(ip net.IP, prefix []byte) (net.HardwareAddr, error) { 46 | switch { 47 | 48 | case ip.To4() == nil: 49 | return nil, SupportIp4OnlyErr{msg: "GenerateHardwareAddr4 only supports valid IPv4 address as input"} 50 | 51 | case len(prefix) != len(PrivateMACPrefix): 52 | return nil, InvalidPrefixLengthErr{msg: fmt.Sprintf( 53 | "Prefix has length %d instead of %d", len(prefix), len(PrivateMACPrefix)), 54 | } 55 | } 56 | 57 | ipByteLen := len(ip) 58 | return (net.HardwareAddr)( 59 | append( 60 | prefix, 61 | ip[ipByteLen-ipRelevantByteLen:ipByteLen]...), 62 | ), nil 63 | } 64 | -------------------------------------------------------------------------------- /vendor/github.com/containernetworking/plugins/pkg/utils/utils.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 CNI authors 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 utils 16 | 17 | import ( 18 | "crypto/sha512" 19 | "fmt" 20 | ) 21 | 22 | const ( 23 | maxChainLength = 28 24 | chainPrefix = "CNI-" 25 | prefixLength = len(chainPrefix) 26 | ) 27 | 28 | // Generates a chain name to be used with iptables. 29 | // Ensures that the generated chain name is exactly 30 | // maxChainLength chars in length 31 | func FormatChainName(name string, id string) string { 32 | chainBytes := sha512.Sum512([]byte(name + id)) 33 | chain := fmt.Sprintf("%s%x", chainPrefix, chainBytes) 34 | return chain[:maxChainLength] 35 | } 36 | 37 | // FormatComment returns a comment used for easier 38 | // rule identification within iptables. 39 | func FormatComment(name string, id string) string { 40 | return fmt.Sprintf("name: %q id: %q", name, id) 41 | } 42 | -------------------------------------------------------------------------------- /vendor/github.com/coreos/go-iptables/iptables/lock.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 iptables 16 | 17 | import ( 18 | "os" 19 | "sync" 20 | "syscall" 21 | ) 22 | 23 | const ( 24 | // In earlier versions of iptables, the xtables lock was implemented 25 | // via a Unix socket, but now flock is used via this lockfile: 26 | // http://git.netfilter.org/iptables/commit/?id=aa562a660d1555b13cffbac1e744033e91f82707 27 | // Note the LSB-conforming "/run" directory does not exist on old 28 | // distributions, so assume "/var" is symlinked 29 | xtablesLockFilePath = "/var/run/xtables.lock" 30 | 31 | defaultFilePerm = 0600 32 | ) 33 | 34 | type Unlocker interface { 35 | Unlock() error 36 | } 37 | 38 | type nopUnlocker struct{} 39 | 40 | func (_ nopUnlocker) Unlock() error { return nil } 41 | 42 | type fileLock struct { 43 | // mu is used to protect against concurrent invocations from within this process 44 | mu sync.Mutex 45 | fd int 46 | } 47 | 48 | // tryLock takes an exclusive lock on the xtables lock file without blocking. 49 | // This is best-effort only: if the exclusive lock would block (i.e. because 50 | // another process already holds it), no error is returned. Otherwise, any 51 | // error encountered during the locking operation is returned. 52 | // The returned Unlocker should be used to release the lock when the caller is 53 | // done invoking iptables commands. 54 | func (l *fileLock) tryLock() (Unlocker, error) { 55 | l.mu.Lock() 56 | err := syscall.Flock(l.fd, syscall.LOCK_EX|syscall.LOCK_NB) 57 | switch err { 58 | case syscall.EWOULDBLOCK: 59 | l.mu.Unlock() 60 | return nopUnlocker{}, nil 61 | case nil: 62 | return l, nil 63 | default: 64 | l.mu.Unlock() 65 | return nil, err 66 | } 67 | } 68 | 69 | // Unlock closes the underlying file, which implicitly unlocks it as well. It 70 | // also unlocks the associated mutex. 71 | func (l *fileLock) Unlock() error { 72 | defer l.mu.Unlock() 73 | return syscall.Close(l.fd) 74 | } 75 | 76 | // newXtablesFileLock opens a new lock on the xtables lockfile without 77 | // acquiring the lock 78 | func newXtablesFileLock() (*fileLock, error) { 79 | fd, err := syscall.Open(xtablesLockFilePath, os.O_CREATE, defaultFilePerm) 80 | if err != nil { 81 | return nil, err 82 | } 83 | return &fileLock{fd: fd}, nil 84 | } 85 | -------------------------------------------------------------------------------- /vendor/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 | -------------------------------------------------------------------------------- /vendor/github.com/sirupsen/logrus/alt_exit.go: -------------------------------------------------------------------------------- 1 | package logrus 2 | 3 | // The following code was sourced and modified from the 4 | // https://github.com/tebeka/atexit package governed by the following license: 5 | // 6 | // Copyright (c) 2012 Miki Tebeka . 7 | // 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 9 | // this software and associated documentation files (the "Software"), to deal in 10 | // the Software without restriction, including without limitation the rights to 11 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 12 | // the Software, and to permit persons to whom the Software is furnished to do so, 13 | // subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in all 16 | // copies or substantial portions of the Software. 17 | // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 20 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 21 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 22 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 23 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 | 25 | import ( 26 | "fmt" 27 | "os" 28 | ) 29 | 30 | var handlers = []func(){} 31 | 32 | func runHandler(handler func()) { 33 | defer func() { 34 | if err := recover(); err != nil { 35 | fmt.Fprintln(os.Stderr, "Error: Logrus exit handler error:", err) 36 | } 37 | }() 38 | 39 | handler() 40 | } 41 | 42 | func runHandlers() { 43 | for _, handler := range handlers { 44 | runHandler(handler) 45 | } 46 | } 47 | 48 | // Exit runs all the Logrus atexit handlers and then terminates the program using os.Exit(code) 49 | func Exit(code int) { 50 | runHandlers() 51 | os.Exit(code) 52 | } 53 | 54 | // RegisterExitHandler adds a Logrus Exit handler, call logrus.Exit to invoke 55 | // all handlers. The handlers will also be invoked when any Fatal log entry is 56 | // made. 57 | // 58 | // This method is useful when a caller wishes to use logrus to log a fatal 59 | // message but also needs to gracefully shutdown. An example usecase could be 60 | // closing database connections, or sending a alert that the application is 61 | // closing. 62 | func RegisterExitHandler(handler func()) { 63 | handlers = append(handlers, handler) 64 | } 65 | -------------------------------------------------------------------------------- /vendor/github.com/sirupsen/logrus/appveyor.yml: -------------------------------------------------------------------------------- 1 | version: "{build}" 2 | platform: x64 3 | clone_folder: c:\gopath\src\github.com\sirupsen\logrus 4 | environment: 5 | GOPATH: c:\gopath 6 | branches: 7 | only: 8 | - master 9 | install: 10 | - set PATH=%GOPATH%\bin;c:\go\bin;%PATH% 11 | - go version 12 | build_script: 13 | - go get -t 14 | - go test 15 | -------------------------------------------------------------------------------- /vendor/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 | -------------------------------------------------------------------------------- /vendor/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 | -------------------------------------------------------------------------------- /vendor/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 | -------------------------------------------------------------------------------- /vendor/github.com/sirupsen/logrus/json_formatter.go: -------------------------------------------------------------------------------- 1 | package logrus 2 | 3 | import ( 4 | "encoding/json" 5 | "fmt" 6 | ) 7 | 8 | type fieldKey string 9 | 10 | // FieldMap allows customization of the key names for default fields. 11 | type FieldMap map[fieldKey]string 12 | 13 | // Default key names for the default fields 14 | const ( 15 | FieldKeyMsg = "msg" 16 | FieldKeyLevel = "level" 17 | FieldKeyTime = "time" 18 | ) 19 | 20 | func (f FieldMap) resolve(key fieldKey) string { 21 | if k, ok := f[key]; ok { 22 | return k 23 | } 24 | 25 | return string(key) 26 | } 27 | 28 | // JSONFormatter formats logs into parsable json 29 | type JSONFormatter struct { 30 | // TimestampFormat sets the format used for marshaling timestamps. 31 | TimestampFormat string 32 | 33 | // DisableTimestamp allows disabling automatic timestamps in output 34 | DisableTimestamp bool 35 | 36 | // FieldMap allows users to customize the names of keys for default fields. 37 | // As an example: 38 | // formatter := &JSONFormatter{ 39 | // FieldMap: FieldMap{ 40 | // FieldKeyTime: "@timestamp", 41 | // FieldKeyLevel: "@level", 42 | // FieldKeyMsg: "@message", 43 | // }, 44 | // } 45 | FieldMap FieldMap 46 | } 47 | 48 | // Format renders a single log entry 49 | func (f *JSONFormatter) Format(entry *Entry) ([]byte, error) { 50 | data := make(Fields, len(entry.Data)+3) 51 | for k, v := range entry.Data { 52 | switch v := v.(type) { 53 | case error: 54 | // Otherwise errors are ignored by `encoding/json` 55 | // https://github.com/sirupsen/logrus/issues/137 56 | data[k] = v.Error() 57 | default: 58 | data[k] = v 59 | } 60 | } 61 | prefixFieldClashes(data) 62 | 63 | timestampFormat := f.TimestampFormat 64 | if timestampFormat == "" { 65 | timestampFormat = defaultTimestampFormat 66 | } 67 | 68 | if !f.DisableTimestamp { 69 | data[f.FieldMap.resolve(FieldKeyTime)] = entry.Time.Format(timestampFormat) 70 | } 71 | data[f.FieldMap.resolve(FieldKeyMsg)] = entry.Message 72 | data[f.FieldMap.resolve(FieldKeyLevel)] = entry.Level.String() 73 | 74 | serialized, err := json.Marshal(data) 75 | if err != nil { 76 | return nil, fmt.Errorf("Failed to marshal fields to JSON, %v", err) 77 | } 78 | return append(serialized, '\n'), nil 79 | } 80 | -------------------------------------------------------------------------------- /vendor/github.com/sirupsen/logrus/terminal_bsd.go: -------------------------------------------------------------------------------- 1 | // +build darwin freebsd openbsd netbsd dragonfly 2 | // +build !appengine 3 | 4 | package logrus 5 | 6 | import "golang.org/x/sys/unix" 7 | 8 | const ioctlReadTermios = unix.TIOCGETA 9 | 10 | type Termios unix.Termios 11 | -------------------------------------------------------------------------------- /vendor/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 | // +build !appengine 7 | 8 | package logrus 9 | 10 | import "golang.org/x/sys/unix" 11 | 12 | const ioctlReadTermios = unix.TCGETS 13 | 14 | type Termios unix.Termios 15 | -------------------------------------------------------------------------------- /vendor/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 | return NewEntry(logger).WriterLevel(level) 15 | } 16 | 17 | func (entry *Entry) Writer() *io.PipeWriter { 18 | return entry.WriterLevel(InfoLevel) 19 | } 20 | 21 | func (entry *Entry) WriterLevel(level Level) *io.PipeWriter { 22 | reader, writer := io.Pipe() 23 | 24 | var printFunc func(args ...interface{}) 25 | 26 | switch level { 27 | case DebugLevel: 28 | printFunc = entry.Debug 29 | case InfoLevel: 30 | printFunc = entry.Info 31 | case WarnLevel: 32 | printFunc = entry.Warn 33 | case ErrorLevel: 34 | printFunc = entry.Error 35 | case FatalLevel: 36 | printFunc = entry.Fatal 37 | case PanicLevel: 38 | printFunc = entry.Panic 39 | default: 40 | printFunc = entry.Print 41 | } 42 | 43 | go entry.writerScanner(reader, printFunc) 44 | runtime.SetFinalizer(writer, writerFinalizer) 45 | 46 | return writer 47 | } 48 | 49 | func (entry *Entry) writerScanner(reader *io.PipeReader, printFunc func(args ...interface{})) { 50 | scanner := bufio.NewScanner(reader) 51 | for scanner.Scan() { 52 | printFunc(scanner.Text()) 53 | } 54 | if err := scanner.Err(); err != nil { 55 | entry.Errorf("Error while reading from Writer: %s", err) 56 | } 57 | reader.Close() 58 | } 59 | 60 | func writerFinalizer(writer *io.PipeWriter) { 61 | writer.Close() 62 | } 63 | -------------------------------------------------------------------------------- /vendor/github.com/socketplane/libovsdb/MAINTAINERS: -------------------------------------------------------------------------------- 1 | # libovsdb maintainers file 2 | # 3 | # This file describes who runs the socketplane/libovsdb project and how. 4 | # This is a living document - if you see something out of date or missing, speak up! 5 | # 6 | # It is structured to be consumable by both humans and programs. 7 | # To extract its contents programmatically, use any TOML-compliant parser. 8 | # 9 | [Org] 10 | [Org."Core maintainers"] 11 | people = [ 12 | "dave-tucker", 13 | "mavenugo", 14 | "shaleman", 15 | ] 16 | 17 | [people] 18 | 19 | # A reference list of all people associated with the project. 20 | # All other sections should refer to people by their canonical key 21 | # in the people section. 22 | 23 | # ADD YOURSELF HERE IN ALPHABETICAL ORDER 24 | [people.dave-tucker] 25 | Name = "Dave Tucker" 26 | Email = "dt@docker.com" 27 | GitHub = "dave-tucker" 28 | 29 | [people.mavenugo] 30 | Name = "Madhu Venugopal" 31 | Email = "madhu@docker.com" 32 | GitHub = "mavenugo" 33 | 34 | [people.shaleman] 35 | Name = "Sukhesh Halemane" 36 | GitHub = "shaleman" 37 | -------------------------------------------------------------------------------- /vendor/github.com/socketplane/libovsdb/Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: all test test-local test-ci install-deps lint fmt vet 2 | 3 | all: test 4 | 5 | test-local: install-deps fmt lint vet 6 | @echo "+ $@" 7 | @go test -race -v ./... 8 | 9 | test: 10 | @docker-compose run --rm test 11 | 12 | # Because CircleCI fails to rm a container 13 | test-ci: 14 | @docker-compose run test 15 | 16 | install-deps: 17 | @echo "+ $@" 18 | @go get -u github.com/golang/lint/golint 19 | @go get -d ./... 20 | 21 | lint: 22 | @echo "+ $@" 23 | @test -z "$$(golint ./... | tee /dev/stderr)" 24 | 25 | fmt: 26 | @echo "+ $@" 27 | @test -z "$$(gofmt -s -l . | tee /dev/stderr)" 28 | 29 | vet: 30 | @echo "+ $@" 31 | @go vet ./... 32 | 33 | -------------------------------------------------------------------------------- /vendor/github.com/socketplane/libovsdb/README.md: -------------------------------------------------------------------------------- 1 | libovsdb 2 | ======== 3 | 4 | [![Circle CI](https://circleci.com/gh/socketplane/libovsdb.png?style=badge&circle-token=17838d6362be941ed8478bf9d10de5307d4b917d)](https://circleci.com/gh/socketplane/libovsdb) [![Coverage Status](https://coveralls.io/repos/socketplane/libovsdb/badge.png?branch=master)](https://coveralls.io/r/socketplane/libovsdb?branch=master) 5 | 6 | An OVSDB Library written in Go 7 | 8 | ## What is OVSDB? 9 | 10 | OVSDB is the Open vSwitch Database Protocol. 11 | It's defined in [RFC 7047](http://tools.ietf.org/html/rfc7047) 12 | It's used mainly for managing the configuration of Open vSwitch, but it could also be used to manage your stamp collection. Philatelists Rejoice! 13 | 14 | ## Running the tests 15 | 16 | To run integration tests, you'll need access to docker to run an Open vSwitch container. 17 | Mac users can use [boot2docker](http://boot2docker.io) 18 | 19 | export DOCKER_IP=$(boot2docker ip) 20 | 21 | docker-compose run test /bin/sh 22 | # make test-local 23 | ... 24 | # exit 25 | docker-compose down 26 | 27 | By invoking the command **make**, you will automatically get the same behaviour as what 28 | is shown above. In other words, it will start the two containers and execute 29 | **make test-local** from the test container. 30 | 31 | ## Dependency Management 32 | 33 | We use [godep](https://github.com/tools/godep) for dependency management with rewritten import paths. 34 | This allows the repo to be `go get`able. 35 | 36 | To bump the version of a dependency, follow these [instructions](https://github.com/tools/godep#update-a-dependency) 37 | -------------------------------------------------------------------------------- /vendor/github.com/socketplane/libovsdb/circle.yml: -------------------------------------------------------------------------------- 1 | --- 2 | machine: 3 | services: 4 | - docker 5 | 6 | dependencies: 7 | override: 8 | - echo "Nothing to see here.." 9 | 10 | test: 11 | override: 12 | - make test-ci 13 | -------------------------------------------------------------------------------- /vendor/github.com/socketplane/libovsdb/docker-compose.yml: -------------------------------------------------------------------------------- 1 | ovs: 2 | image: socketplane/openvswitch:2.4.0 3 | ports: 4 | - "6640:6640" 5 | command: "/usr/bin/supervisord -n" 6 | privileged: true 7 | 8 | test: 9 | image: golang:1.6 10 | links: 11 | - ovs 12 | volumes: 13 | - .:/go/src/github.com/socketplane/libovsdb 14 | working_dir: /go/src/github.com/socketplane/libovsdb 15 | environment: 16 | DOCKER_IP: "ovs" 17 | command: "make test-local" 18 | -------------------------------------------------------------------------------- /vendor/github.com/socketplane/libovsdb/map.go: -------------------------------------------------------------------------------- 1 | package libovsdb 2 | 3 | import ( 4 | "encoding/json" 5 | "errors" 6 | "reflect" 7 | ) 8 | 9 | // OvsMap is the JSON map structure used for OVSDB 10 | // RFC 7047 uses the following notation for map as JSON doesnt support non-string keys for maps. 11 | // A 2-element JSON array that represents a database map value. The 12 | // first element of the array must be the string "map", and the 13 | // second element must be an array of zero or more s giving the 14 | // values in the map. All of the s must have the same key and 15 | // value types. 16 | type OvsMap struct { 17 | GoMap map[interface{}]interface{} 18 | } 19 | 20 | // MarshalJSON marshalls an OVSDB style Map to a byte array 21 | func (o OvsMap) MarshalJSON() ([]byte, error) { 22 | var ovsMap, innerMap []interface{} 23 | ovsMap = append(ovsMap, "map") 24 | for key, val := range o.GoMap { 25 | var mapSeg []interface{} 26 | mapSeg = append(mapSeg, key) 27 | mapSeg = append(mapSeg, val) 28 | innerMap = append(innerMap, mapSeg) 29 | } 30 | ovsMap = append(ovsMap, innerMap) 31 | return json.Marshal(ovsMap) 32 | } 33 | 34 | // UnmarshalJSON unmarshalls an OVSDB style Map from a byte array 35 | func (o *OvsMap) UnmarshalJSON(b []byte) (err error) { 36 | var oMap []interface{} 37 | o.GoMap = make(map[interface{}]interface{}) 38 | if err := json.Unmarshal(b, &oMap); err == nil && len(oMap) > 1 { 39 | innerSlice := oMap[1].([]interface{}) 40 | for _, val := range innerSlice { 41 | f := val.([]interface{}) 42 | o.GoMap[f[0]] = f[1] 43 | } 44 | } 45 | return err 46 | } 47 | 48 | // NewOvsMap will return an OVSDB style map from a provided Golang Map 49 | func NewOvsMap(goMap interface{}) (*OvsMap, error) { 50 | v := reflect.ValueOf(goMap) 51 | if v.Kind() != reflect.Map { 52 | return nil, errors.New("OvsMap supports only Go Map types") 53 | } 54 | 55 | genMap := make(map[interface{}]interface{}) 56 | keys := v.MapKeys() 57 | for _, key := range keys { 58 | genMap[key.Interface()] = v.MapIndex(key).Interface() 59 | } 60 | return &OvsMap{genMap}, nil 61 | } 62 | -------------------------------------------------------------------------------- /vendor/github.com/socketplane/libovsdb/row.go: -------------------------------------------------------------------------------- 1 | package libovsdb 2 | 3 | import "encoding/json" 4 | 5 | // Row is a table Row according to RFC7047 6 | type Row struct { 7 | Fields map[string]interface{} 8 | } 9 | 10 | // UnmarshalJSON unmarshalls a byte array to an OVSDB Row 11 | func (r *Row) UnmarshalJSON(b []byte) (err error) { 12 | r.Fields = make(map[string]interface{}) 13 | var raw map[string]interface{} 14 | err = json.Unmarshal(b, &raw) 15 | for key, val := range raw { 16 | val, err = ovsSliceToGoNotation(val) 17 | if err != nil { 18 | return err 19 | } 20 | r.Fields[key] = val 21 | } 22 | return err 23 | } 24 | -------------------------------------------------------------------------------- /vendor/github.com/socketplane/libovsdb/rpc.go: -------------------------------------------------------------------------------- 1 | package libovsdb 2 | 3 | // NewGetSchemaArgs creates a new set of arguments for a get_schemas RPC 4 | func NewGetSchemaArgs(schema string) []interface{} { 5 | return []interface{}{schema} 6 | } 7 | 8 | // NewTransactArgs creates a new set of arguments for a transact RPC 9 | func NewTransactArgs(database string, operations ...Operation) []interface{} { 10 | dbSlice := make([]interface{}, 1) 11 | dbSlice[0] = database 12 | 13 | opsSlice := make([]interface{}, len(operations)) 14 | for i, d := range operations { 15 | opsSlice[i] = d 16 | } 17 | 18 | ops := append(dbSlice, opsSlice...) 19 | return ops 20 | } 21 | 22 | // NewCancelArgs creates a new set of arguments for a cancel RPC 23 | func NewCancelArgs(id interface{}) []interface{} { 24 | return []interface{}{id} 25 | } 26 | 27 | // NewMonitorArgs creates a new set of arguments for a monitor RPC 28 | func NewMonitorArgs(database string, value interface{}, requests map[string]MonitorRequest) []interface{} { 29 | return []interface{}{database, value, requests} 30 | } 31 | 32 | // NewMonitorCancelArgs creates a new set of arguments for a monitor_cancel RPC 33 | func NewMonitorCancelArgs(value interface{}) []interface{} { 34 | return []interface{}{value} 35 | } 36 | 37 | // NewLockArgs creates a new set of arguments for a lock, steal or unlock RPC 38 | func NewLockArgs(id interface{}) []interface{} { 39 | return []interface{}{id} 40 | } 41 | -------------------------------------------------------------------------------- /vendor/github.com/socketplane/libovsdb/schema.go: -------------------------------------------------------------------------------- 1 | package libovsdb 2 | 3 | import ( 4 | "fmt" 5 | "io" 6 | ) 7 | 8 | // DatabaseSchema is a database schema according to RFC7047 9 | type DatabaseSchema struct { 10 | Name string `json:"name"` 11 | Version string `json:"version"` 12 | Tables map[string]TableSchema `json:"tables"` 13 | } 14 | 15 | // TableSchema is a table schema according to RFC7047 16 | type TableSchema struct { 17 | Columns map[string]ColumnSchema `json:"columns"` 18 | Indexes [][]string `json:"indexes,omitempty"` 19 | } 20 | 21 | // ColumnSchema is a column schema according to RFC7047 22 | type ColumnSchema struct { 23 | Name string `json:"name"` 24 | Type interface{} `json:"type"` 25 | Ephemeral bool `json:"ephemeral,omitempty"` 26 | Mutable bool `json:"mutable,omitempty"` 27 | } 28 | 29 | // Print will print the contents of the DatabaseSchema 30 | func (schema DatabaseSchema) Print(w io.Writer) { 31 | fmt.Fprintf(w, "%s, (%s)\n", schema.Name, schema.Version) 32 | for table, tableSchema := range schema.Tables { 33 | fmt.Fprintf(w, "\t %s\n", table) 34 | for column, columnSchema := range tableSchema.Columns { 35 | fmt.Fprintf(w, "\t\t %s => %v\n", column, columnSchema) 36 | } 37 | } 38 | } 39 | 40 | // Basic validation for operations against Database Schema 41 | func (schema DatabaseSchema) validateOperations(operations ...Operation) bool { 42 | for _, op := range operations { 43 | table, ok := schema.Tables[op.Table] 44 | if ok { 45 | for column := range op.Row { 46 | if _, ok := table.Columns[column]; !ok { 47 | return false 48 | } 49 | } 50 | for _, row := range op.Rows { 51 | for column := range row { 52 | if _, ok := table.Columns[column]; !ok { 53 | return false 54 | } 55 | } 56 | } 57 | for _, column := range op.Columns { 58 | if _, ok := table.Columns[column]; !ok { 59 | return false 60 | } 61 | } 62 | } else { 63 | return false 64 | } 65 | } 66 | return true 67 | } 68 | -------------------------------------------------------------------------------- /vendor/github.com/socketplane/libovsdb/set.go: -------------------------------------------------------------------------------- 1 | package libovsdb 2 | 3 | import ( 4 | "encoding/json" 5 | "errors" 6 | "reflect" 7 | ) 8 | 9 | // OvsSet is an OVSDB style set 10 | // RFC 7047 has a wierd (but understandable) notation for set as described as : 11 | // Either an , representing a set with exactly one element, or 12 | // a 2-element JSON array that represents a database set value. The 13 | // first element of the array must be the string "set", and the 14 | // second element must be an array of zero or more s giving the 15 | // values in the set. All of the s must have the same type. 16 | type OvsSet struct { 17 | GoSet []interface{} 18 | } 19 | 20 | // NewOvsSet creates a new OVSDB style set from a Go slice 21 | func NewOvsSet(goSlice interface{}) (*OvsSet, error) { 22 | v := reflect.ValueOf(goSlice) 23 | if v.Kind() != reflect.Slice { 24 | return nil, errors.New("OvsSet supports only Go Slice types") 25 | } 26 | 27 | var ovsSet []interface{} 28 | for i := 0; i < v.Len(); i++ { 29 | ovsSet = append(ovsSet, v.Index(i).Interface()) 30 | } 31 | return &OvsSet{ovsSet}, nil 32 | } 33 | 34 | // MarshalJSON wil marshal an OVSDB style set in to a JSON byte array 35 | func (o OvsSet) MarshalJSON() ([]byte, error) { 36 | var oSet []interface{} 37 | oSet = append(oSet, "set") 38 | oSet = append(oSet, o.GoSet) 39 | return json.Marshal(oSet) 40 | } 41 | 42 | // UnmarshalJSON will unmarshal a JSON byte array to an OVSDB style set 43 | func (o *OvsSet) UnmarshalJSON(b []byte) (err error) { 44 | var oSet []interface{} 45 | if err = json.Unmarshal(b, &oSet); err == nil && len(oSet) > 1 { 46 | innerSet := oSet[1].([]interface{}) 47 | for _, val := range innerSet { 48 | goVal, err := ovsSliceToGoNotation(val) 49 | if err == nil { 50 | o.GoSet = append(o.GoSet, goVal) 51 | } 52 | } 53 | } 54 | return err 55 | } 56 | -------------------------------------------------------------------------------- /vendor/github.com/socketplane/libovsdb/uuid.go: -------------------------------------------------------------------------------- 1 | package libovsdb 2 | 3 | import ( 4 | "encoding/json" 5 | "errors" 6 | "regexp" 7 | ) 8 | 9 | // UUID is a UUID according to RFC7047 10 | type UUID struct { 11 | GoUUID string `json:"uuid"` 12 | } 13 | 14 | // MarshalJSON will marshal an OVSDB style UUID to a JSON encoded byte array 15 | func (u UUID) MarshalJSON() ([]byte, error) { 16 | var uuidSlice []string 17 | err := u.validateUUID() 18 | if err == nil { 19 | uuidSlice = []string{"uuid", u.GoUUID} 20 | } else { 21 | uuidSlice = []string{"named-uuid", u.GoUUID} 22 | } 23 | 24 | return json.Marshal(uuidSlice) 25 | } 26 | 27 | // UnmarshalJSON will unmarshal a JSON encoded byte array to a OVSDB style UUID 28 | func (u *UUID) UnmarshalJSON(b []byte) (err error) { 29 | var ovsUUID []string 30 | if err := json.Unmarshal(b, &ovsUUID); err == nil { 31 | u.GoUUID = ovsUUID[1] 32 | } 33 | return err 34 | } 35 | 36 | func (u UUID) validateUUID() error { 37 | if len(u.GoUUID) != 36 { 38 | return errors.New("uuid exceeds 36 characters") 39 | } 40 | 41 | var validUUID = regexp.MustCompile(`^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$`) 42 | 43 | if !validUUID.MatchString(u.GoUUID) { 44 | return errors.New("uuid does not match regexp") 45 | } 46 | 47 | return nil 48 | } 49 | -------------------------------------------------------------------------------- /vendor/github.com/vishvananda/netlink/Makefile: -------------------------------------------------------------------------------- 1 | DIRS := \ 2 | . \ 3 | nl 4 | 5 | DEPS = \ 6 | github.com/vishvananda/netns 7 | 8 | uniq = $(if $1,$(firstword $1) $(call uniq,$(filter-out $(firstword $1),$1))) 9 | testdirs = $(call uniq,$(foreach d,$(1),$(dir $(wildcard $(d)/*_test.go)))) 10 | goroot = $(addprefix ../../../,$(1)) 11 | unroot = $(subst ../../../,,$(1)) 12 | fmt = $(addprefix fmt-,$(1)) 13 | 14 | all: test 15 | 16 | $(call goroot,$(DEPS)): 17 | go get $(call unroot,$@) 18 | 19 | .PHONY: $(call testdirs,$(DIRS)) 20 | $(call testdirs,$(DIRS)): 21 | sudo -E go test -test.parallel 4 -timeout 60s -v github.com/vishvananda/netlink/$@ 22 | 23 | $(call fmt,$(call testdirs,$(DIRS))): 24 | ! gofmt -l $(subst fmt-,,$@)/*.go | grep -q . 25 | 26 | .PHONY: fmt 27 | fmt: $(call fmt,$(call testdirs,$(DIRS))) 28 | 29 | test: fmt $(call goroot,$(DEPS)) $(call testdirs,$(DIRS)) 30 | -------------------------------------------------------------------------------- /vendor/github.com/vishvananda/netlink/addr.go: -------------------------------------------------------------------------------- 1 | package netlink 2 | 3 | import ( 4 | "fmt" 5 | "net" 6 | "strings" 7 | ) 8 | 9 | // Addr represents an IP address from netlink. Netlink ip addresses 10 | // include a mask, so it stores the address as a net.IPNet. 11 | type Addr struct { 12 | *net.IPNet 13 | Label string 14 | Flags int 15 | Scope int 16 | Peer *net.IPNet 17 | Broadcast net.IP 18 | PreferedLft int 19 | ValidLft int 20 | } 21 | 22 | // String returns $ip/$netmask $label 23 | func (a Addr) String() string { 24 | return strings.TrimSpace(fmt.Sprintf("%s %s", a.IPNet, a.Label)) 25 | } 26 | 27 | // ParseAddr parses the string representation of an address in the 28 | // form $ip/$netmask $label. The label portion is optional 29 | func ParseAddr(s string) (*Addr, error) { 30 | label := "" 31 | parts := strings.Split(s, " ") 32 | if len(parts) > 1 { 33 | s = parts[0] 34 | label = parts[1] 35 | } 36 | m, err := ParseIPNet(s) 37 | if err != nil { 38 | return nil, err 39 | } 40 | return &Addr{IPNet: m, Label: label}, nil 41 | } 42 | 43 | // Equal returns true if both Addrs have the same net.IPNet value. 44 | func (a Addr) Equal(x Addr) bool { 45 | sizea, _ := a.Mask.Size() 46 | sizeb, _ := x.Mask.Size() 47 | // ignore label for comparison 48 | return a.IP.Equal(x.IP) && sizea == sizeb 49 | } 50 | 51 | func (a Addr) PeerEqual(x Addr) bool { 52 | sizea, _ := a.Peer.Mask.Size() 53 | sizeb, _ := x.Peer.Mask.Size() 54 | // ignore label for comparison 55 | return a.Peer.IP.Equal(x.Peer.IP) && sizea == sizeb 56 | } 57 | -------------------------------------------------------------------------------- /vendor/github.com/vishvananda/netlink/bpf_linux.go: -------------------------------------------------------------------------------- 1 | package netlink 2 | 3 | /* 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | static int load_simple_bpf(int prog_type, int ret) { 12 | #ifdef __NR_bpf 13 | // { return ret; } 14 | __u64 __attribute__((aligned(8))) insns[] = { 15 | 0x00000000000000b7ull | ((__u64)ret<<32), 16 | 0x0000000000000095ull, 17 | }; 18 | __u8 __attribute__((aligned(8))) license[] = "ASL2"; 19 | // Copied from a header file since libc is notoriously slow to update. 20 | // The call will succeed or fail and that will be our indication on 21 | // whether or not it is supported. 22 | struct { 23 | __u32 prog_type; 24 | __u32 insn_cnt; 25 | __u64 insns; 26 | __u64 license; 27 | __u32 log_level; 28 | __u32 log_size; 29 | __u64 log_buf; 30 | __u32 kern_version; 31 | } __attribute__((aligned(8))) attr = { 32 | .prog_type = prog_type, 33 | .insn_cnt = 2, 34 | .insns = (uintptr_t)&insns, 35 | .license = (uintptr_t)&license, 36 | }; 37 | return syscall(__NR_bpf, 5, &attr, sizeof(attr)); 38 | #else 39 | errno = EINVAL; 40 | return -1; 41 | #endif 42 | } 43 | */ 44 | import "C" 45 | 46 | type BpfProgType C.int 47 | 48 | const ( 49 | BPF_PROG_TYPE_UNSPEC BpfProgType = iota 50 | BPF_PROG_TYPE_SOCKET_FILTER 51 | BPF_PROG_TYPE_KPROBE 52 | BPF_PROG_TYPE_SCHED_CLS 53 | BPF_PROG_TYPE_SCHED_ACT 54 | BPF_PROG_TYPE_TRACEPOINT 55 | BPF_PROG_TYPE_XDP 56 | ) 57 | 58 | // loadSimpleBpf loads a trivial bpf program for testing purposes 59 | func loadSimpleBpf(progType BpfProgType, ret int) (int, error) { 60 | fd, err := C.load_simple_bpf(C.int(progType), C.int(ret)) 61 | return int(fd), err 62 | } 63 | -------------------------------------------------------------------------------- /vendor/github.com/vishvananda/netlink/class.go: -------------------------------------------------------------------------------- 1 | package netlink 2 | 3 | import ( 4 | "fmt" 5 | ) 6 | 7 | type Class interface { 8 | Attrs() *ClassAttrs 9 | Type() string 10 | } 11 | 12 | // ClassAttrs represents a netlink class. A filter is associated with a link, 13 | // has a handle and a parent. The root filter of a device should have a 14 | // parent == HANDLE_ROOT. 15 | type ClassAttrs struct { 16 | LinkIndex int 17 | Handle uint32 18 | Parent uint32 19 | Leaf uint32 20 | } 21 | 22 | func (q ClassAttrs) String() string { 23 | return fmt.Sprintf("{LinkIndex: %d, Handle: %s, Parent: %s, Leaf: %d}", q.LinkIndex, HandleStr(q.Handle), HandleStr(q.Parent), q.Leaf) 24 | } 25 | 26 | type HtbClassAttrs struct { 27 | // TODO handle all attributes 28 | Rate uint64 29 | Ceil uint64 30 | Buffer uint32 31 | Cbuffer uint32 32 | Quantum uint32 33 | Level uint32 34 | Prio uint32 35 | } 36 | 37 | func (q HtbClassAttrs) String() string { 38 | return fmt.Sprintf("{Rate: %d, Ceil: %d, Buffer: %d, Cbuffer: %d}", q.Rate, q.Ceil, q.Buffer, q.Cbuffer) 39 | } 40 | 41 | // HtbClass represents an Htb class 42 | type HtbClass struct { 43 | ClassAttrs 44 | Rate uint64 45 | Ceil uint64 46 | Buffer uint32 47 | Cbuffer uint32 48 | Quantum uint32 49 | Level uint32 50 | Prio uint32 51 | } 52 | 53 | func (q HtbClass) String() string { 54 | return fmt.Sprintf("{Rate: %d, Ceil: %d, Buffer: %d, Cbuffer: %d}", q.Rate, q.Ceil, q.Buffer, q.Cbuffer) 55 | } 56 | 57 | func (q *HtbClass) Attrs() *ClassAttrs { 58 | return &q.ClassAttrs 59 | } 60 | 61 | func (q *HtbClass) Type() string { 62 | return "htb" 63 | } 64 | 65 | // GenericClass classes represent types that are not currently understood 66 | // by this netlink library. 67 | type GenericClass struct { 68 | ClassAttrs 69 | ClassType string 70 | } 71 | 72 | func (class *GenericClass) Attrs() *ClassAttrs { 73 | return &class.ClassAttrs 74 | } 75 | 76 | func (class *GenericClass) Type() string { 77 | return class.ClassType 78 | } 79 | -------------------------------------------------------------------------------- /vendor/github.com/vishvananda/netlink/conntrack_unspecified.go: -------------------------------------------------------------------------------- 1 | // +build !linux 2 | 3 | package netlink 4 | 5 | // ConntrackTableType Conntrack table for the netlink operation 6 | type ConntrackTableType uint8 7 | 8 | // InetFamily Family type 9 | type InetFamily uint8 10 | 11 | // ConntrackFlow placeholder 12 | type ConntrackFlow struct{} 13 | 14 | // ConntrackFilter placeholder 15 | type ConntrackFilter struct{} 16 | 17 | // ConntrackTableList returns the flow list of a table of a specific family 18 | // conntrack -L [table] [options] List conntrack or expectation table 19 | func ConntrackTableList(table ConntrackTableType, family InetFamily) ([]*ConntrackFlow, error) { 20 | return nil, ErrNotImplemented 21 | } 22 | 23 | // ConntrackTableFlush flushes all the flows of a specified table 24 | // conntrack -F [table] Flush table 25 | // The flush operation applies to all the family types 26 | func ConntrackTableFlush(table ConntrackTableType) error { 27 | return ErrNotImplemented 28 | } 29 | 30 | // ConntrackDeleteFilter deletes entries on the specified table on the base of the filter 31 | // conntrack -D [table] parameters Delete conntrack or expectation 32 | func ConntrackDeleteFilter(table ConntrackTableType, family InetFamily, filter *ConntrackFilter) (uint, error) { 33 | return 0, ErrNotImplemented 34 | } 35 | 36 | // ConntrackTableList returns the flow list of a table of a specific family using the netlink handle passed 37 | // conntrack -L [table] [options] List conntrack or expectation table 38 | func (h *Handle) ConntrackTableList(table ConntrackTableType, family InetFamily) ([]*ConntrackFlow, error) { 39 | return nil, ErrNotImplemented 40 | } 41 | 42 | // ConntrackTableFlush flushes all the flows of a specified table using the netlink handle passed 43 | // conntrack -F [table] Flush table 44 | // The flush operation applies to all the family types 45 | func (h *Handle) ConntrackTableFlush(table ConntrackTableType) error { 46 | return ErrNotImplemented 47 | } 48 | 49 | // ConntrackDeleteFilter deletes entries on the specified table on the base of the filter using the netlink handle passed 50 | // conntrack -D [table] parameters Delete conntrack or expectation 51 | func (h *Handle) ConntrackDeleteFilter(table ConntrackTableType, family InetFamily, filter *ConntrackFilter) (uint, error) { 52 | return 0, ErrNotImplemented 53 | } 54 | -------------------------------------------------------------------------------- /vendor/github.com/vishvananda/netlink/genetlink_unspecified.go: -------------------------------------------------------------------------------- 1 | // +build !linux 2 | 3 | package netlink 4 | 5 | type GenlOp struct{} 6 | 7 | type GenlMulticastGroup struct{} 8 | 9 | type GenlFamily struct{} 10 | 11 | func (h *Handle) GenlFamilyList() ([]*GenlFamily, error) { 12 | return nil, ErrNotImplemented 13 | } 14 | 15 | func GenlFamilyList() ([]*GenlFamily, error) { 16 | return nil, ErrNotImplemented 17 | } 18 | 19 | func (h *Handle) GenlFamilyGet(name string) (*GenlFamily, error) { 20 | return nil, ErrNotImplemented 21 | } 22 | 23 | func GenlFamilyGet(name string) (*GenlFamily, error) { 24 | return nil, ErrNotImplemented 25 | } 26 | -------------------------------------------------------------------------------- /vendor/github.com/vishvananda/netlink/link_tuntap_linux.go: -------------------------------------------------------------------------------- 1 | package netlink 2 | 3 | // ideally golang.org/x/sys/unix would define IfReq but it only has 4 | // IFNAMSIZ, hence this minimalistic implementation 5 | const ( 6 | SizeOfIfReq = 40 7 | IFNAMSIZ = 16 8 | ) 9 | 10 | type ifReq struct { 11 | Name [IFNAMSIZ]byte 12 | Flags uint16 13 | pad [SizeOfIfReq - IFNAMSIZ - 2]byte 14 | } 15 | -------------------------------------------------------------------------------- /vendor/github.com/vishvananda/netlink/neigh.go: -------------------------------------------------------------------------------- 1 | package netlink 2 | 3 | import ( 4 | "fmt" 5 | "net" 6 | ) 7 | 8 | // Neigh represents a link layer neighbor from netlink. 9 | type Neigh struct { 10 | LinkIndex int 11 | Family int 12 | State int 13 | Type int 14 | Flags int 15 | IP net.IP 16 | HardwareAddr net.HardwareAddr 17 | } 18 | 19 | // String returns $ip/$hwaddr $label 20 | func (neigh *Neigh) String() string { 21 | return fmt.Sprintf("%s %s", neigh.IP, neigh.HardwareAddr) 22 | } 23 | -------------------------------------------------------------------------------- /vendor/github.com/vishvananda/netlink/netlink.go: -------------------------------------------------------------------------------- 1 | // Package netlink provides a simple library for netlink. Netlink is 2 | // the interface a user-space program in linux uses to communicate with 3 | // the kernel. It can be used to add and remove interfaces, set up ip 4 | // addresses and routes, and confiugre ipsec. Netlink communication 5 | // requires elevated privileges, so in most cases this code needs to 6 | // be run as root. The low level primitives for netlink are contained 7 | // in the nl subpackage. This package attempts to provide a high-level 8 | // interface that is loosly modeled on the iproute2 cli. 9 | package netlink 10 | 11 | import ( 12 | "errors" 13 | "net" 14 | ) 15 | 16 | var ( 17 | // ErrNotImplemented is returned when a requested feature is not implemented. 18 | ErrNotImplemented = errors.New("not implemented") 19 | ) 20 | 21 | // ParseIPNet parses a string in ip/net format and returns a net.IPNet. 22 | // This is valuable because addresses in netlink are often IPNets and 23 | // ParseCIDR returns an IPNet with the IP part set to the base IP of the 24 | // range. 25 | func ParseIPNet(s string) (*net.IPNet, error) { 26 | ip, ipNet, err := net.ParseCIDR(s) 27 | if err != nil { 28 | return nil, err 29 | } 30 | return &net.IPNet{IP: ip, Mask: ipNet.Mask}, nil 31 | } 32 | 33 | // NewIPNet generates an IPNet from an ip address using a netmask of 32 or 128. 34 | func NewIPNet(ip net.IP) *net.IPNet { 35 | if ip.To4() != nil { 36 | return &net.IPNet{IP: ip, Mask: net.CIDRMask(32, 32)} 37 | } 38 | return &net.IPNet{IP: ip, Mask: net.CIDRMask(128, 128)} 39 | } 40 | -------------------------------------------------------------------------------- /vendor/github.com/vishvananda/netlink/netlink_linux.go: -------------------------------------------------------------------------------- 1 | package netlink 2 | 3 | import "github.com/vishvananda/netlink/nl" 4 | 5 | // Family type definitions 6 | const ( 7 | FAMILY_ALL = nl.FAMILY_ALL 8 | FAMILY_V4 = nl.FAMILY_V4 9 | FAMILY_V6 = nl.FAMILY_V6 10 | FAMILY_MPLS = nl.FAMILY_MPLS 11 | ) 12 | -------------------------------------------------------------------------------- /vendor/github.com/vishvananda/netlink/nl/addr_linux.go: -------------------------------------------------------------------------------- 1 | package nl 2 | 3 | import ( 4 | "syscall" 5 | "unsafe" 6 | ) 7 | 8 | type IfAddrmsg struct { 9 | syscall.IfAddrmsg 10 | } 11 | 12 | func NewIfAddrmsg(family int) *IfAddrmsg { 13 | return &IfAddrmsg{ 14 | IfAddrmsg: syscall.IfAddrmsg{ 15 | Family: uint8(family), 16 | }, 17 | } 18 | } 19 | 20 | // struct ifaddrmsg { 21 | // __u8 ifa_family; 22 | // __u8 ifa_prefixlen; /* The prefix length */ 23 | // __u8 ifa_flags; /* Flags */ 24 | // __u8 ifa_scope; /* Address scope */ 25 | // __u32 ifa_index; /* Link index */ 26 | // }; 27 | 28 | // type IfAddrmsg struct { 29 | // Family uint8 30 | // Prefixlen uint8 31 | // Flags uint8 32 | // Scope uint8 33 | // Index uint32 34 | // } 35 | // SizeofIfAddrmsg = 0x8 36 | 37 | func DeserializeIfAddrmsg(b []byte) *IfAddrmsg { 38 | return (*IfAddrmsg)(unsafe.Pointer(&b[0:syscall.SizeofIfAddrmsg][0])) 39 | } 40 | 41 | func (msg *IfAddrmsg) Serialize() []byte { 42 | return (*(*[syscall.SizeofIfAddrmsg]byte)(unsafe.Pointer(msg)))[:] 43 | } 44 | 45 | func (msg *IfAddrmsg) Len() int { 46 | return syscall.SizeofIfAddrmsg 47 | } 48 | 49 | // struct ifa_cacheinfo { 50 | // __u32 ifa_prefered; 51 | // __u32 ifa_valid; 52 | // __u32 cstamp; /* created timestamp, hundredths of seconds */ 53 | // __u32 tstamp; /* updated timestamp, hundredths of seconds */ 54 | // }; 55 | 56 | const IFA_CACHEINFO = 6 57 | const SizeofIfaCacheInfo = 0x10 58 | 59 | type IfaCacheInfo struct { 60 | IfaPrefered uint32 61 | IfaValid uint32 62 | Cstamp uint32 63 | Tstamp uint32 64 | } 65 | 66 | func (msg *IfaCacheInfo) Len() int { 67 | return SizeofIfaCacheInfo 68 | } 69 | 70 | func DeserializeIfaCacheInfo(b []byte) *IfaCacheInfo { 71 | return (*IfaCacheInfo)(unsafe.Pointer(&b[0:SizeofIfaCacheInfo][0])) 72 | } 73 | 74 | func (msg *IfaCacheInfo) Serialize() []byte { 75 | return (*(*[SizeofIfaCacheInfo]byte)(unsafe.Pointer(msg)))[:] 76 | } 77 | -------------------------------------------------------------------------------- /vendor/github.com/vishvananda/netlink/nl/bridge_linux.go: -------------------------------------------------------------------------------- 1 | package nl 2 | 3 | import ( 4 | "fmt" 5 | "unsafe" 6 | ) 7 | 8 | const ( 9 | SizeofBridgeVlanInfo = 0x04 10 | ) 11 | 12 | /* Bridge Flags */ 13 | const ( 14 | BRIDGE_FLAGS_MASTER = iota /* Bridge command to/from master */ 15 | BRIDGE_FLAGS_SELF /* Bridge command to/from lowerdev */ 16 | ) 17 | 18 | /* Bridge management nested attributes 19 | * [IFLA_AF_SPEC] = { 20 | * [IFLA_BRIDGE_FLAGS] 21 | * [IFLA_BRIDGE_MODE] 22 | * [IFLA_BRIDGE_VLAN_INFO] 23 | * } 24 | */ 25 | const ( 26 | IFLA_BRIDGE_FLAGS = iota 27 | IFLA_BRIDGE_MODE 28 | IFLA_BRIDGE_VLAN_INFO 29 | ) 30 | 31 | const ( 32 | BRIDGE_VLAN_INFO_MASTER = 1 << iota 33 | BRIDGE_VLAN_INFO_PVID 34 | BRIDGE_VLAN_INFO_UNTAGGED 35 | BRIDGE_VLAN_INFO_RANGE_BEGIN 36 | BRIDGE_VLAN_INFO_RANGE_END 37 | ) 38 | 39 | // struct bridge_vlan_info { 40 | // __u16 flags; 41 | // __u16 vid; 42 | // }; 43 | 44 | type BridgeVlanInfo struct { 45 | Flags uint16 46 | Vid uint16 47 | } 48 | 49 | func (b *BridgeVlanInfo) Serialize() []byte { 50 | return (*(*[SizeofBridgeVlanInfo]byte)(unsafe.Pointer(b)))[:] 51 | } 52 | 53 | func DeserializeBridgeVlanInfo(b []byte) *BridgeVlanInfo { 54 | return (*BridgeVlanInfo)(unsafe.Pointer(&b[0:SizeofBridgeVlanInfo][0])) 55 | } 56 | 57 | func (b *BridgeVlanInfo) PortVID() bool { 58 | return b.Flags&BRIDGE_VLAN_INFO_PVID > 0 59 | } 60 | 61 | func (b *BridgeVlanInfo) EngressUntag() bool { 62 | return b.Flags&BRIDGE_VLAN_INFO_UNTAGGED > 0 63 | } 64 | 65 | func (b *BridgeVlanInfo) String() string { 66 | return fmt.Sprintf("%+v", *b) 67 | } 68 | 69 | /* New extended info filters for IFLA_EXT_MASK */ 70 | const ( 71 | RTEXT_FILTER_VF = 1 << iota 72 | RTEXT_FILTER_BRVLAN 73 | RTEXT_FILTER_BRVLAN_COMPRESSED 74 | ) 75 | -------------------------------------------------------------------------------- /vendor/github.com/vishvananda/netlink/nl/genetlink_linux.go: -------------------------------------------------------------------------------- 1 | package nl 2 | 3 | import ( 4 | "unsafe" 5 | ) 6 | 7 | const SizeofGenlmsg = 4 8 | 9 | const ( 10 | GENL_ID_CTRL = 0x10 11 | GENL_CTRL_VERSION = 2 12 | GENL_CTRL_NAME = "nlctrl" 13 | ) 14 | 15 | const ( 16 | GENL_CTRL_CMD_GETFAMILY = 3 17 | ) 18 | 19 | const ( 20 | GENL_CTRL_ATTR_UNSPEC = iota 21 | GENL_CTRL_ATTR_FAMILY_ID 22 | GENL_CTRL_ATTR_FAMILY_NAME 23 | GENL_CTRL_ATTR_VERSION 24 | GENL_CTRL_ATTR_HDRSIZE 25 | GENL_CTRL_ATTR_MAXATTR 26 | GENL_CTRL_ATTR_OPS 27 | GENL_CTRL_ATTR_MCAST_GROUPS 28 | ) 29 | 30 | const ( 31 | GENL_CTRL_ATTR_OP_UNSPEC = iota 32 | GENL_CTRL_ATTR_OP_ID 33 | GENL_CTRL_ATTR_OP_FLAGS 34 | ) 35 | 36 | const ( 37 | GENL_ADMIN_PERM = 1 << iota 38 | GENL_CMD_CAP_DO 39 | GENL_CMD_CAP_DUMP 40 | GENL_CMD_CAP_HASPOL 41 | ) 42 | 43 | const ( 44 | GENL_CTRL_ATTR_MCAST_GRP_UNSPEC = iota 45 | GENL_CTRL_ATTR_MCAST_GRP_NAME 46 | GENL_CTRL_ATTR_MCAST_GRP_ID 47 | ) 48 | 49 | const ( 50 | GENL_GTP_VERSION = 0 51 | GENL_GTP_NAME = "gtp" 52 | ) 53 | 54 | const ( 55 | GENL_GTP_CMD_NEWPDP = iota 56 | GENL_GTP_CMD_DELPDP 57 | GENL_GTP_CMD_GETPDP 58 | ) 59 | 60 | const ( 61 | GENL_GTP_ATTR_UNSPEC = iota 62 | GENL_GTP_ATTR_LINK 63 | GENL_GTP_ATTR_VERSION 64 | GENL_GTP_ATTR_TID 65 | GENL_GTP_ATTR_PEER_ADDRESS 66 | GENL_GTP_ATTR_MS_ADDRESS 67 | GENL_GTP_ATTR_FLOW 68 | GENL_GTP_ATTR_NET_NS_FD 69 | GENL_GTP_ATTR_I_TEI 70 | GENL_GTP_ATTR_O_TEI 71 | GENL_GTP_ATTR_PAD 72 | ) 73 | 74 | type Genlmsg struct { 75 | Command uint8 76 | Version uint8 77 | } 78 | 79 | func (msg *Genlmsg) Len() int { 80 | return SizeofGenlmsg 81 | } 82 | 83 | func DeserializeGenlmsg(b []byte) *Genlmsg { 84 | return (*Genlmsg)(unsafe.Pointer(&b[0:SizeofGenlmsg][0])) 85 | } 86 | 87 | func (msg *Genlmsg) Serialize() []byte { 88 | return (*(*[SizeofGenlmsg]byte)(unsafe.Pointer(msg)))[:] 89 | } 90 | -------------------------------------------------------------------------------- /vendor/github.com/vishvananda/netlink/nl/mpls_linux.go: -------------------------------------------------------------------------------- 1 | package nl 2 | 3 | import "encoding/binary" 4 | 5 | const ( 6 | MPLS_LS_LABEL_SHIFT = 12 7 | MPLS_LS_S_SHIFT = 8 8 | ) 9 | 10 | func EncodeMPLSStack(labels ...int) []byte { 11 | b := make([]byte, 4*len(labels)) 12 | for idx, label := range labels { 13 | l := label << MPLS_LS_LABEL_SHIFT 14 | if idx == len(labels)-1 { 15 | l |= 1 << MPLS_LS_S_SHIFT 16 | } 17 | binary.BigEndian.PutUint32(b[idx*4:], uint32(l)) 18 | } 19 | return b 20 | } 21 | 22 | func DecodeMPLSStack(buf []byte) []int { 23 | if len(buf)%4 != 0 { 24 | return nil 25 | } 26 | stack := make([]int, 0, len(buf)/4) 27 | for len(buf) > 0 { 28 | l := binary.BigEndian.Uint32(buf[:4]) 29 | buf = buf[4:] 30 | stack = append(stack, int(l)>>MPLS_LS_LABEL_SHIFT) 31 | if (l>>MPLS_LS_S_SHIFT)&1 > 0 { 32 | break 33 | } 34 | } 35 | return stack 36 | } 37 | -------------------------------------------------------------------------------- /vendor/github.com/vishvananda/netlink/nl/nl_unspecified.go: -------------------------------------------------------------------------------- 1 | // +build !linux 2 | 3 | package nl 4 | 5 | import "encoding/binary" 6 | 7 | var SupportedNlFamilies = []int{} 8 | 9 | func NativeEndian() binary.ByteOrder { 10 | return nil 11 | } 12 | -------------------------------------------------------------------------------- /vendor/github.com/vishvananda/netlink/nl/route_linux.go: -------------------------------------------------------------------------------- 1 | package nl 2 | 3 | import ( 4 | "syscall" 5 | "unsafe" 6 | ) 7 | 8 | type RtMsg struct { 9 | syscall.RtMsg 10 | } 11 | 12 | func NewRtMsg() *RtMsg { 13 | return &RtMsg{ 14 | RtMsg: syscall.RtMsg{ 15 | Table: syscall.RT_TABLE_MAIN, 16 | Scope: syscall.RT_SCOPE_UNIVERSE, 17 | Protocol: syscall.RTPROT_BOOT, 18 | Type: syscall.RTN_UNICAST, 19 | }, 20 | } 21 | } 22 | 23 | func NewRtDelMsg() *RtMsg { 24 | return &RtMsg{ 25 | RtMsg: syscall.RtMsg{ 26 | Table: syscall.RT_TABLE_MAIN, 27 | Scope: syscall.RT_SCOPE_NOWHERE, 28 | }, 29 | } 30 | } 31 | 32 | func (msg *RtMsg) Len() int { 33 | return syscall.SizeofRtMsg 34 | } 35 | 36 | func DeserializeRtMsg(b []byte) *RtMsg { 37 | return (*RtMsg)(unsafe.Pointer(&b[0:syscall.SizeofRtMsg][0])) 38 | } 39 | 40 | func (msg *RtMsg) Serialize() []byte { 41 | return (*(*[syscall.SizeofRtMsg]byte)(unsafe.Pointer(msg)))[:] 42 | } 43 | 44 | type RtNexthop struct { 45 | syscall.RtNexthop 46 | Children []NetlinkRequestData 47 | } 48 | 49 | func DeserializeRtNexthop(b []byte) *RtNexthop { 50 | return (*RtNexthop)(unsafe.Pointer(&b[0:syscall.SizeofRtNexthop][0])) 51 | } 52 | 53 | func (msg *RtNexthop) Len() int { 54 | if len(msg.Children) == 0 { 55 | return syscall.SizeofRtNexthop 56 | } 57 | 58 | l := 0 59 | for _, child := range msg.Children { 60 | l += rtaAlignOf(child.Len()) 61 | } 62 | l += syscall.SizeofRtNexthop 63 | return rtaAlignOf(l) 64 | } 65 | 66 | func (msg *RtNexthop) Serialize() []byte { 67 | length := msg.Len() 68 | msg.RtNexthop.Len = uint16(length) 69 | buf := make([]byte, length) 70 | copy(buf, (*(*[syscall.SizeofRtNexthop]byte)(unsafe.Pointer(msg)))[:]) 71 | next := rtaAlignOf(syscall.SizeofRtNexthop) 72 | if len(msg.Children) > 0 { 73 | for _, child := range msg.Children { 74 | childBuf := child.Serialize() 75 | copy(buf[next:], childBuf) 76 | next += rtaAlignOf(len(childBuf)) 77 | } 78 | } 79 | return buf 80 | } 81 | -------------------------------------------------------------------------------- /vendor/github.com/vishvananda/netlink/nl/syscall.go: -------------------------------------------------------------------------------- 1 | package nl 2 | 3 | // syscall package lack of rule atributes type. 4 | // Thus there are defined below 5 | const ( 6 | FRA_UNSPEC = iota 7 | FRA_DST /* destination address */ 8 | FRA_SRC /* source address */ 9 | FRA_IIFNAME /* interface name */ 10 | FRA_GOTO /* target to jump to (FR_ACT_GOTO) */ 11 | FRA_UNUSED2 12 | FRA_PRIORITY /* priority/preference */ 13 | FRA_UNUSED3 14 | FRA_UNUSED4 15 | FRA_UNUSED5 16 | FRA_FWMARK /* mark */ 17 | FRA_FLOW /* flow/class id */ 18 | FRA_TUN_ID 19 | FRA_SUPPRESS_IFGROUP 20 | FRA_SUPPRESS_PREFIXLEN 21 | FRA_TABLE /* Extended table id */ 22 | FRA_FWMASK /* mask for netfilter mark */ 23 | FRA_OIFNAME 24 | ) 25 | 26 | // ip rule netlink request types 27 | const ( 28 | FR_ACT_UNSPEC = iota 29 | FR_ACT_TO_TBL /* Pass to fixed table */ 30 | FR_ACT_GOTO /* Jump to another rule */ 31 | FR_ACT_NOP /* No operation */ 32 | FR_ACT_RES3 33 | FR_ACT_RES4 34 | FR_ACT_BLACKHOLE /* Drop without notification */ 35 | FR_ACT_UNREACHABLE /* Drop with ENETUNREACH */ 36 | FR_ACT_PROHIBIT /* Drop with EACCES */ 37 | ) 38 | 39 | // socket diags related 40 | const ( 41 | SOCK_DIAG_BY_FAMILY = 20 /* linux.sock_diag.h */ 42 | TCPDIAG_NOCOOKIE = 0xFFFFFFFF /* TCPDIAG_NOCOOKIE in net/ipv4/tcp_diag.h*/ 43 | ) 44 | 45 | const ( 46 | AF_MPLS = 28 47 | ) 48 | 49 | const ( 50 | RTA_NEWDST = 0x13 51 | RTA_ENCAP_TYPE = 0x15 52 | RTA_ENCAP = 0x16 53 | ) 54 | 55 | // RTA_ENCAP subtype 56 | const ( 57 | MPLS_IPTUNNEL_UNSPEC = iota 58 | MPLS_IPTUNNEL_DST 59 | ) 60 | 61 | // light weight tunnel encap types 62 | const ( 63 | LWTUNNEL_ENCAP_NONE = iota 64 | LWTUNNEL_ENCAP_MPLS 65 | LWTUNNEL_ENCAP_IP 66 | LWTUNNEL_ENCAP_ILA 67 | LWTUNNEL_ENCAP_IP6 68 | ) 69 | -------------------------------------------------------------------------------- /vendor/github.com/vishvananda/netlink/nl/xfrm_monitor_linux.go: -------------------------------------------------------------------------------- 1 | package nl 2 | 3 | import ( 4 | "unsafe" 5 | ) 6 | 7 | const ( 8 | SizeofXfrmUserExpire = 0xe8 9 | ) 10 | 11 | // struct xfrm_user_expire { 12 | // struct xfrm_usersa_info state; 13 | // __u8 hard; 14 | // }; 15 | 16 | type XfrmUserExpire struct { 17 | XfrmUsersaInfo XfrmUsersaInfo 18 | Hard uint8 19 | Pad [7]byte 20 | } 21 | 22 | func (msg *XfrmUserExpire) Len() int { 23 | return SizeofXfrmUserExpire 24 | } 25 | 26 | func DeserializeXfrmUserExpire(b []byte) *XfrmUserExpire { 27 | return (*XfrmUserExpire)(unsafe.Pointer(&b[0:SizeofXfrmUserExpire][0])) 28 | } 29 | 30 | func (msg *XfrmUserExpire) Serialize() []byte { 31 | return (*(*[SizeofXfrmUserExpire]byte)(unsafe.Pointer(msg)))[:] 32 | } 33 | -------------------------------------------------------------------------------- /vendor/github.com/vishvananda/netlink/order.go: -------------------------------------------------------------------------------- 1 | package netlink 2 | 3 | import ( 4 | "encoding/binary" 5 | 6 | "github.com/vishvananda/netlink/nl" 7 | ) 8 | 9 | var ( 10 | native = nl.NativeEndian() 11 | networkOrder = binary.BigEndian 12 | ) 13 | 14 | func htonl(val uint32) []byte { 15 | bytes := make([]byte, 4) 16 | binary.BigEndian.PutUint32(bytes, val) 17 | return bytes 18 | } 19 | 20 | func htons(val uint16) []byte { 21 | bytes := make([]byte, 2) 22 | binary.BigEndian.PutUint16(bytes, val) 23 | return bytes 24 | } 25 | 26 | func ntohl(buf []byte) uint32 { 27 | return binary.BigEndian.Uint32(buf) 28 | } 29 | 30 | func ntohs(buf []byte) uint16 { 31 | return binary.BigEndian.Uint16(buf) 32 | } 33 | -------------------------------------------------------------------------------- /vendor/github.com/vishvananda/netlink/protinfo.go: -------------------------------------------------------------------------------- 1 | package netlink 2 | 3 | import ( 4 | "strings" 5 | ) 6 | 7 | // Protinfo represents bridge flags from netlink. 8 | type Protinfo struct { 9 | Hairpin bool 10 | Guard bool 11 | FastLeave bool 12 | RootBlock bool 13 | Learning bool 14 | Flood bool 15 | ProxyArp bool 16 | ProxyArpWiFi bool 17 | } 18 | 19 | // String returns a list of enabled flags 20 | func (prot *Protinfo) String() string { 21 | var boolStrings []string 22 | if prot.Hairpin { 23 | boolStrings = append(boolStrings, "Hairpin") 24 | } 25 | if prot.Guard { 26 | boolStrings = append(boolStrings, "Guard") 27 | } 28 | if prot.FastLeave { 29 | boolStrings = append(boolStrings, "FastLeave") 30 | } 31 | if prot.RootBlock { 32 | boolStrings = append(boolStrings, "RootBlock") 33 | } 34 | if prot.Learning { 35 | boolStrings = append(boolStrings, "Learning") 36 | } 37 | if prot.Flood { 38 | boolStrings = append(boolStrings, "Flood") 39 | } 40 | if prot.ProxyArp { 41 | boolStrings = append(boolStrings, "ProxyArp") 42 | } 43 | if prot.ProxyArpWiFi { 44 | boolStrings = append(boolStrings, "ProxyArpWiFi") 45 | } 46 | return strings.Join(boolStrings, " ") 47 | } 48 | 49 | func boolToByte(x bool) []byte { 50 | if x { 51 | return []byte{1} 52 | } 53 | return []byte{0} 54 | } 55 | 56 | func byteToBool(x byte) bool { 57 | return uint8(x) != 0 58 | } 59 | -------------------------------------------------------------------------------- /vendor/github.com/vishvananda/netlink/protinfo_linux.go: -------------------------------------------------------------------------------- 1 | package netlink 2 | 3 | import ( 4 | "fmt" 5 | "syscall" 6 | 7 | "github.com/vishvananda/netlink/nl" 8 | ) 9 | 10 | func LinkGetProtinfo(link Link) (Protinfo, error) { 11 | return pkgHandle.LinkGetProtinfo(link) 12 | } 13 | 14 | func (h *Handle) LinkGetProtinfo(link Link) (Protinfo, error) { 15 | base := link.Attrs() 16 | h.ensureIndex(base) 17 | var pi Protinfo 18 | req := h.newNetlinkRequest(syscall.RTM_GETLINK, syscall.NLM_F_DUMP) 19 | msg := nl.NewIfInfomsg(syscall.AF_BRIDGE) 20 | req.AddData(msg) 21 | msgs, err := req.Execute(syscall.NETLINK_ROUTE, 0) 22 | if err != nil { 23 | return pi, err 24 | } 25 | 26 | for _, m := range msgs { 27 | ans := nl.DeserializeIfInfomsg(m) 28 | if int(ans.Index) != base.Index { 29 | continue 30 | } 31 | attrs, err := nl.ParseRouteAttr(m[ans.Len():]) 32 | if err != nil { 33 | return pi, err 34 | } 35 | for _, attr := range attrs { 36 | if attr.Attr.Type != syscall.IFLA_PROTINFO|syscall.NLA_F_NESTED { 37 | continue 38 | } 39 | infos, err := nl.ParseRouteAttr(attr.Value) 40 | if err != nil { 41 | return pi, err 42 | } 43 | pi = *parseProtinfo(infos) 44 | 45 | return pi, nil 46 | } 47 | } 48 | return pi, fmt.Errorf("Device with index %d not found", base.Index) 49 | } 50 | 51 | func parseProtinfo(infos []syscall.NetlinkRouteAttr) *Protinfo { 52 | var pi Protinfo 53 | for _, info := range infos { 54 | switch info.Attr.Type { 55 | case nl.IFLA_BRPORT_MODE: 56 | pi.Hairpin = byteToBool(info.Value[0]) 57 | case nl.IFLA_BRPORT_GUARD: 58 | pi.Guard = byteToBool(info.Value[0]) 59 | case nl.IFLA_BRPORT_FAST_LEAVE: 60 | pi.FastLeave = byteToBool(info.Value[0]) 61 | case nl.IFLA_BRPORT_PROTECT: 62 | pi.RootBlock = byteToBool(info.Value[0]) 63 | case nl.IFLA_BRPORT_LEARNING: 64 | pi.Learning = byteToBool(info.Value[0]) 65 | case nl.IFLA_BRPORT_UNICAST_FLOOD: 66 | pi.Flood = byteToBool(info.Value[0]) 67 | case nl.IFLA_BRPORT_PROXYARP: 68 | pi.ProxyArp = byteToBool(info.Value[0]) 69 | case nl.IFLA_BRPORT_PROXYARP_WIFI: 70 | pi.ProxyArpWiFi = byteToBool(info.Value[0]) 71 | } 72 | } 73 | return &pi 74 | } 75 | -------------------------------------------------------------------------------- /vendor/github.com/vishvananda/netlink/route_unspecified.go: -------------------------------------------------------------------------------- 1 | // +build !linux 2 | 3 | package netlink 4 | 5 | func (r *Route) ListFlags() []string { 6 | return []string{} 7 | } 8 | 9 | func (n *NexthopInfo) ListFlags() []string { 10 | return []string{} 11 | } 12 | -------------------------------------------------------------------------------- /vendor/github.com/vishvananda/netlink/rule.go: -------------------------------------------------------------------------------- 1 | package netlink 2 | 3 | import ( 4 | "fmt" 5 | "net" 6 | ) 7 | 8 | // Rule represents a netlink rule. 9 | type Rule struct { 10 | Priority int 11 | Table int 12 | Mark int 13 | Mask int 14 | TunID uint 15 | Goto int 16 | Src *net.IPNet 17 | Dst *net.IPNet 18 | Flow int 19 | IifName string 20 | OifName string 21 | SuppressIfgroup int 22 | SuppressPrefixlen int 23 | } 24 | 25 | func (r Rule) String() string { 26 | return fmt.Sprintf("ip rule %d: from %s table %d", r.Priority, r.Src, r.Table) 27 | } 28 | 29 | // NewRule return empty rules. 30 | func NewRule() *Rule { 31 | return &Rule{ 32 | SuppressIfgroup: -1, 33 | SuppressPrefixlen: -1, 34 | Priority: -1, 35 | Mark: -1, 36 | Mask: -1, 37 | Goto: -1, 38 | Flow: -1, 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /vendor/github.com/vishvananda/netlink/socket.go: -------------------------------------------------------------------------------- 1 | package netlink 2 | 3 | import "net" 4 | 5 | // SocketID identifies a single socket. 6 | type SocketID struct { 7 | SourcePort uint16 8 | DestinationPort uint16 9 | Source net.IP 10 | Destination net.IP 11 | Interface uint32 12 | Cookie [2]uint32 13 | } 14 | 15 | // Socket represents a netlink socket. 16 | type Socket struct { 17 | Family uint8 18 | State uint8 19 | Timer uint8 20 | Retrans uint8 21 | ID SocketID 22 | Expires uint32 23 | RQueue uint32 24 | WQueue uint32 25 | UID uint32 26 | INode uint32 27 | } 28 | -------------------------------------------------------------------------------- /vendor/github.com/vishvananda/netlink/xfrm.go: -------------------------------------------------------------------------------- 1 | package netlink 2 | 3 | import ( 4 | "fmt" 5 | "syscall" 6 | ) 7 | 8 | // Proto is an enum representing an ipsec protocol. 9 | type Proto uint8 10 | 11 | const ( 12 | XFRM_PROTO_ROUTE2 Proto = syscall.IPPROTO_ROUTING 13 | XFRM_PROTO_ESP Proto = syscall.IPPROTO_ESP 14 | XFRM_PROTO_AH Proto = syscall.IPPROTO_AH 15 | XFRM_PROTO_HAO Proto = syscall.IPPROTO_DSTOPTS 16 | XFRM_PROTO_COMP Proto = 0x6c // NOTE not defined on darwin 17 | XFRM_PROTO_IPSEC_ANY Proto = syscall.IPPROTO_RAW 18 | ) 19 | 20 | func (p Proto) String() string { 21 | switch p { 22 | case XFRM_PROTO_ROUTE2: 23 | return "route2" 24 | case XFRM_PROTO_ESP: 25 | return "esp" 26 | case XFRM_PROTO_AH: 27 | return "ah" 28 | case XFRM_PROTO_HAO: 29 | return "hao" 30 | case XFRM_PROTO_COMP: 31 | return "comp" 32 | case XFRM_PROTO_IPSEC_ANY: 33 | return "ipsec-any" 34 | } 35 | return fmt.Sprintf("%d", p) 36 | } 37 | 38 | // Mode is an enum representing an ipsec transport. 39 | type Mode uint8 40 | 41 | const ( 42 | XFRM_MODE_TRANSPORT Mode = iota 43 | XFRM_MODE_TUNNEL 44 | XFRM_MODE_ROUTEOPTIMIZATION 45 | XFRM_MODE_IN_TRIGGER 46 | XFRM_MODE_BEET 47 | XFRM_MODE_MAX 48 | ) 49 | 50 | func (m Mode) String() string { 51 | switch m { 52 | case XFRM_MODE_TRANSPORT: 53 | return "transport" 54 | case XFRM_MODE_TUNNEL: 55 | return "tunnel" 56 | case XFRM_MODE_ROUTEOPTIMIZATION: 57 | return "ro" 58 | case XFRM_MODE_IN_TRIGGER: 59 | return "in_trigger" 60 | case XFRM_MODE_BEET: 61 | return "beet" 62 | } 63 | return fmt.Sprintf("%d", m) 64 | } 65 | 66 | // XfrmMark represents the mark associated to the state or policy 67 | type XfrmMark struct { 68 | Value uint32 69 | Mask uint32 70 | } 71 | 72 | func (m *XfrmMark) String() string { 73 | return fmt.Sprintf("(0x%x,0x%x)", m.Value, m.Mask) 74 | } 75 | -------------------------------------------------------------------------------- /vendor/github.com/vishvananda/netlink/xfrm_monitor_linux.go: -------------------------------------------------------------------------------- 1 | package netlink 2 | 3 | import ( 4 | "fmt" 5 | "syscall" 6 | 7 | "github.com/vishvananda/netns" 8 | 9 | "github.com/vishvananda/netlink/nl" 10 | ) 11 | 12 | type XfrmMsg interface { 13 | Type() nl.XfrmMsgType 14 | } 15 | 16 | type XfrmMsgExpire struct { 17 | XfrmState *XfrmState 18 | Hard bool 19 | } 20 | 21 | func (ue *XfrmMsgExpire) Type() nl.XfrmMsgType { 22 | return nl.XFRM_MSG_EXPIRE 23 | } 24 | 25 | func parseXfrmMsgExpire(b []byte) *XfrmMsgExpire { 26 | var e XfrmMsgExpire 27 | 28 | msg := nl.DeserializeXfrmUserExpire(b) 29 | e.XfrmState = xfrmStateFromXfrmUsersaInfo(&msg.XfrmUsersaInfo) 30 | e.Hard = msg.Hard == 1 31 | 32 | return &e 33 | } 34 | 35 | func XfrmMonitor(ch chan<- XfrmMsg, done <-chan struct{}, errorChan chan<- error, 36 | types ...nl.XfrmMsgType) error { 37 | 38 | groups, err := xfrmMcastGroups(types) 39 | if err != nil { 40 | return nil 41 | } 42 | s, err := nl.SubscribeAt(netns.None(), netns.None(), syscall.NETLINK_XFRM, groups...) 43 | if err != nil { 44 | return err 45 | } 46 | 47 | if done != nil { 48 | go func() { 49 | <-done 50 | s.Close() 51 | }() 52 | 53 | } 54 | 55 | go func() { 56 | defer close(ch) 57 | for { 58 | msgs, err := s.Receive() 59 | if err != nil { 60 | errorChan <- err 61 | return 62 | } 63 | for _, m := range msgs { 64 | switch m.Header.Type { 65 | case nl.XFRM_MSG_EXPIRE: 66 | ch <- parseXfrmMsgExpire(m.Data) 67 | default: 68 | errorChan <- fmt.Errorf("unsupported msg type: %x", m.Header.Type) 69 | } 70 | } 71 | } 72 | }() 73 | 74 | return nil 75 | } 76 | 77 | func xfrmMcastGroups(types []nl.XfrmMsgType) ([]uint, error) { 78 | groups := make([]uint, 0) 79 | 80 | if len(types) == 0 { 81 | return nil, fmt.Errorf("no xfrm msg type specified") 82 | } 83 | 84 | for _, t := range types { 85 | var group uint 86 | 87 | switch t { 88 | case nl.XFRM_MSG_EXPIRE: 89 | group = nl.XFRMNLGRP_EXPIRE 90 | default: 91 | return nil, fmt.Errorf("unsupported group: %x", t) 92 | } 93 | 94 | groups = append(groups, group) 95 | } 96 | 97 | return groups, nil 98 | } 99 | -------------------------------------------------------------------------------- /vendor/github.com/vishvananda/netlink/xfrm_policy.go: -------------------------------------------------------------------------------- 1 | package netlink 2 | 3 | import ( 4 | "fmt" 5 | "net" 6 | ) 7 | 8 | // Dir is an enum representing an ipsec template direction. 9 | type Dir uint8 10 | 11 | const ( 12 | XFRM_DIR_IN Dir = iota 13 | XFRM_DIR_OUT 14 | XFRM_DIR_FWD 15 | XFRM_SOCKET_IN 16 | XFRM_SOCKET_OUT 17 | XFRM_SOCKET_FWD 18 | ) 19 | 20 | func (d Dir) String() string { 21 | switch d { 22 | case XFRM_DIR_IN: 23 | return "dir in" 24 | case XFRM_DIR_OUT: 25 | return "dir out" 26 | case XFRM_DIR_FWD: 27 | return "dir fwd" 28 | case XFRM_SOCKET_IN: 29 | return "socket in" 30 | case XFRM_SOCKET_OUT: 31 | return "socket out" 32 | case XFRM_SOCKET_FWD: 33 | return "socket fwd" 34 | } 35 | return fmt.Sprintf("socket %d", d-XFRM_SOCKET_IN) 36 | } 37 | 38 | // XfrmPolicyTmpl encapsulates a rule for the base addresses of an ipsec 39 | // policy. These rules are matched with XfrmState to determine encryption 40 | // and authentication algorithms. 41 | type XfrmPolicyTmpl struct { 42 | Dst net.IP 43 | Src net.IP 44 | Proto Proto 45 | Mode Mode 46 | Spi int 47 | Reqid int 48 | } 49 | 50 | func (t XfrmPolicyTmpl) String() string { 51 | return fmt.Sprintf("{Dst: %v, Src: %v, Proto: %s, Mode: %s, Spi: 0x%x, Reqid: 0x%x}", 52 | t.Dst, t.Src, t.Proto, t.Mode, t.Spi, t.Reqid) 53 | } 54 | 55 | // XfrmPolicy represents an ipsec policy. It represents the overlay network 56 | // and has a list of XfrmPolicyTmpls representing the base addresses of 57 | // the policy. 58 | type XfrmPolicy struct { 59 | Dst *net.IPNet 60 | Src *net.IPNet 61 | Proto Proto 62 | DstPort int 63 | SrcPort int 64 | Dir Dir 65 | Priority int 66 | Index int 67 | Mark *XfrmMark 68 | Tmpls []XfrmPolicyTmpl 69 | } 70 | 71 | func (p XfrmPolicy) String() string { 72 | return fmt.Sprintf("{Dst: %v, Src: %v, Proto: %s, DstPort: %d, SrcPort: %d, Dir: %s, Priority: %d, Index: %d, Mark: %s, Tmpls: %s}", 73 | p.Dst, p.Src, p.Proto, p.DstPort, p.SrcPort, p.Dir, p.Priority, p.Index, p.Mark, p.Tmpls) 74 | } 75 | -------------------------------------------------------------------------------- /vendor/github.com/vishvananda/netns/README.md: -------------------------------------------------------------------------------- 1 | # netns - network namespaces in go # 2 | 3 | The netns package provides an ultra-simple interface for handling 4 | network namespaces in go. Changing namespaces requires elevated 5 | privileges, so in most cases this code needs to be run as root. 6 | 7 | ## Local Build and Test ## 8 | 9 | You can use go get command: 10 | 11 | go get github.com/vishvananda/netns 12 | 13 | Testing (requires root): 14 | 15 | sudo -E go test github.com/vishvananda/netns 16 | 17 | ## Example ## 18 | 19 | ```go 20 | package main 21 | 22 | import ( 23 | "fmt" 24 | "net" 25 | "runtime" 26 | "github.com/vishvananda/netns" 27 | ) 28 | 29 | func main() { 30 | // Lock the OS Thread so we don't accidentally switch namespaces 31 | runtime.LockOSThread() 32 | defer runtime.UnlockOSThread() 33 | 34 | // Save the current network namespace 35 | origns, _ := netns.Get() 36 | defer origns.Close() 37 | 38 | // Create a new network namespace 39 | newns, _ := netns.New() 40 | netns.Set(newns) 41 | defer newns.Close() 42 | 43 | // Do something with the network namespace 44 | ifaces, _ := net.Interfaces() 45 | fmt.Printf("Interfaces: %v\n", ifaces) 46 | 47 | // Switch back to the original namespace 48 | netns.Set(origns) 49 | } 50 | 51 | ``` 52 | -------------------------------------------------------------------------------- /vendor/github.com/vishvananda/netns/netns.go: -------------------------------------------------------------------------------- 1 | // Package netns allows ultra-simple network namespace handling. NsHandles 2 | // can be retrieved and set. Note that the current namespace is thread 3 | // local so actions that set and reset namespaces should use LockOSThread 4 | // to make sure the namespace doesn't change due to a goroutine switch. 5 | // It is best to close NsHandles when you are done with them. This can be 6 | // accomplished via a `defer ns.Close()` on the handle. Changing namespaces 7 | // requires elevated privileges, so in most cases this code needs to be run 8 | // as root. 9 | package netns 10 | 11 | import ( 12 | "fmt" 13 | "syscall" 14 | ) 15 | 16 | // NsHandle is a handle to a network namespace. It can be cast directly 17 | // to an int and used as a file descriptor. 18 | type NsHandle int 19 | 20 | // Equal determines if two network handles refer to the same network 21 | // namespace. This is done by comparing the device and inode that the 22 | // file descriptors point to. 23 | func (ns NsHandle) Equal(other NsHandle) bool { 24 | if ns == other { 25 | return true 26 | } 27 | var s1, s2 syscall.Stat_t 28 | if err := syscall.Fstat(int(ns), &s1); err != nil { 29 | return false 30 | } 31 | if err := syscall.Fstat(int(other), &s2); err != nil { 32 | return false 33 | } 34 | return (s1.Dev == s2.Dev) && (s1.Ino == s2.Ino) 35 | } 36 | 37 | // String shows the file descriptor number and its dev and inode. 38 | func (ns NsHandle) String() string { 39 | var s syscall.Stat_t 40 | if ns == -1 { 41 | return "NS(None)" 42 | } 43 | if err := syscall.Fstat(int(ns), &s); err != nil { 44 | return fmt.Sprintf("NS(%d: unknown)", ns) 45 | } 46 | return fmt.Sprintf("NS(%d: %d, %d)", ns, s.Dev, s.Ino) 47 | } 48 | 49 | // UniqueId returns a string which uniquely identifies the namespace 50 | // associated with the network handle. 51 | func (ns NsHandle) UniqueId() string { 52 | var s syscall.Stat_t 53 | if ns == -1 { 54 | return "NS(none)" 55 | } 56 | if err := syscall.Fstat(int(ns), &s); err != nil { 57 | return "NS(unknown)" 58 | } 59 | return fmt.Sprintf("NS(%d:%d)", s.Dev, s.Ino) 60 | } 61 | 62 | // IsOpen returns true if Close() has not been called. 63 | func (ns NsHandle) IsOpen() bool { 64 | return ns != -1 65 | } 66 | 67 | // Close closes the NsHandle and resets its file descriptor to -1. 68 | // It is not safe to use an NsHandle after Close() is called. 69 | func (ns *NsHandle) Close() error { 70 | if err := syscall.Close(int(*ns)); err != nil { 71 | return err 72 | } 73 | (*ns) = -1 74 | return nil 75 | } 76 | 77 | // None gets an empty (closed) NsHandle. 78 | func None() NsHandle { 79 | return NsHandle(-1) 80 | } 81 | -------------------------------------------------------------------------------- /vendor/github.com/vishvananda/netns/netns_unspecified.go: -------------------------------------------------------------------------------- 1 | // +build !linux 2 | 3 | package netns 4 | 5 | import ( 6 | "errors" 7 | ) 8 | 9 | var ( 10 | ErrNotImplemented = errors.New("not implemented") 11 | ) 12 | 13 | func Set(ns NsHandle) (err error) { 14 | return ErrNotImplemented 15 | } 16 | 17 | func New() (ns NsHandle, err error) { 18 | return -1, ErrNotImplemented 19 | } 20 | 21 | func Get() (NsHandle, error) { 22 | return -1, ErrNotImplemented 23 | } 24 | 25 | func GetFromPath(path string) (NsHandle, error) { 26 | return -1, ErrNotImplemented 27 | } 28 | 29 | func GetFromName(name string) (NsHandle, error) { 30 | return -1, ErrNotImplemented 31 | } 32 | 33 | func GetFromPid(pid int) (NsHandle, error) { 34 | return -1, ErrNotImplemented 35 | } 36 | 37 | func GetFromThread(pid, tid int) (NsHandle, error) { 38 | return -1, ErrNotImplemented 39 | } 40 | 41 | func GetFromDocker(id string) (NsHandle, error) { 42 | return -1, ErrNotImplemented 43 | } 44 | -------------------------------------------------------------------------------- /vendor/golang.org/x/crypto/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2009 The Go Authors. All rights reserved. 2 | 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions are 5 | met: 6 | 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above 10 | copyright notice, this list of conditions and the following disclaimer 11 | in the documentation and/or other materials provided with the 12 | distribution. 13 | * Neither the name of Google Inc. nor the names of its 14 | contributors may be used to endorse or promote products derived from 15 | this software without specific prior written permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | -------------------------------------------------------------------------------- /vendor/golang.org/x/crypto/PATENTS: -------------------------------------------------------------------------------- 1 | Additional IP Rights Grant (Patents) 2 | 3 | "This implementation" means the copyrightable works distributed by 4 | Google as part of the Go project. 5 | 6 | Google hereby grants to You a perpetual, worldwide, non-exclusive, 7 | no-charge, royalty-free, irrevocable (except as stated in this section) 8 | patent license to make, have made, use, offer to sell, sell, import, 9 | transfer and otherwise run, modify and propagate the contents of this 10 | implementation of Go, where such license applies only to those patent 11 | claims, both currently owned or controlled by Google and acquired in 12 | the future, licensable by Google that are necessarily infringed by this 13 | implementation of Go. This grant does not include claims that would be 14 | infringed only as a consequence of further modification of this 15 | implementation. If you or your agent or exclusive licensee institute or 16 | order or agree to the institution of patent litigation against any 17 | entity (including a cross-claim or counterclaim in a lawsuit) alleging 18 | that this implementation of Go or any code incorporated within this 19 | implementation of Go constitutes direct or contributory patent 20 | infringement, or inducement of patent infringement, then any patent 21 | rights granted to you under this License for this implementation of Go 22 | shall terminate as of the date such litigation is filed. 23 | -------------------------------------------------------------------------------- /vendor/golang.org/x/crypto/ssh/terminal/util_bsd.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build darwin dragonfly freebsd netbsd openbsd 6 | 7 | package terminal 8 | 9 | import "golang.org/x/sys/unix" 10 | 11 | const ioctlReadTermios = unix.TIOCGETA 12 | const ioctlWriteTermios = unix.TIOCSETA 13 | -------------------------------------------------------------------------------- /vendor/golang.org/x/crypto/ssh/terminal/util_linux.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package terminal 6 | 7 | import "golang.org/x/sys/unix" 8 | 9 | const ioctlReadTermios = unix.TCGETS 10 | const ioctlWriteTermios = unix.TCSETS 11 | -------------------------------------------------------------------------------- /vendor/golang.org/x/crypto/ssh/terminal/util_plan9.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // Package terminal provides support functions for dealing with terminals, as 6 | // commonly found on UNIX systems. 7 | // 8 | // Putting a terminal into raw mode is the most common requirement: 9 | // 10 | // oldState, err := terminal.MakeRaw(0) 11 | // if err != nil { 12 | // panic(err) 13 | // } 14 | // defer terminal.Restore(0, oldState) 15 | package terminal 16 | 17 | import ( 18 | "fmt" 19 | "runtime" 20 | ) 21 | 22 | type State struct{} 23 | 24 | // IsTerminal returns true if the given file descriptor is a terminal. 25 | func IsTerminal(fd int) bool { 26 | return false 27 | } 28 | 29 | // MakeRaw put the terminal connected to the given file descriptor into raw 30 | // mode and returns the previous state of the terminal so that it can be 31 | // restored. 32 | func MakeRaw(fd int) (*State, error) { 33 | return nil, fmt.Errorf("terminal: MakeRaw not implemented on %s/%s", runtime.GOOS, runtime.GOARCH) 34 | } 35 | 36 | // GetState returns the current state of a terminal which may be useful to 37 | // restore the terminal after a signal. 38 | func GetState(fd int) (*State, error) { 39 | return nil, fmt.Errorf("terminal: GetState not implemented on %s/%s", runtime.GOOS, runtime.GOARCH) 40 | } 41 | 42 | // Restore restores the terminal connected to the given file descriptor to a 43 | // previous state. 44 | func Restore(fd int, state *State) error { 45 | return fmt.Errorf("terminal: Restore not implemented on %s/%s", runtime.GOOS, runtime.GOARCH) 46 | } 47 | 48 | // GetSize returns the dimensions of the given terminal. 49 | func GetSize(fd int) (width, height int, err error) { 50 | return 0, 0, fmt.Errorf("terminal: GetSize not implemented on %s/%s", runtime.GOOS, runtime.GOARCH) 51 | } 52 | 53 | // ReadPassword reads a line of input from a terminal without local echo. This 54 | // is commonly used for inputting passwords and other sensitive data. The slice 55 | // returned does not include the \n. 56 | func ReadPassword(fd int) ([]byte, error) { 57 | return nil, fmt.Errorf("terminal: ReadPassword not implemented on %s/%s", runtime.GOOS, runtime.GOARCH) 58 | } 59 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2009 The Go Authors. All rights reserved. 2 | 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions are 5 | met: 6 | 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above 10 | copyright notice, this list of conditions and the following disclaimer 11 | in the documentation and/or other materials provided with the 12 | distribution. 13 | * Neither the name of Google Inc. nor the names of its 14 | contributors may be used to endorse or promote products derived from 15 | this software without specific prior written permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/PATENTS: -------------------------------------------------------------------------------- 1 | Additional IP Rights Grant (Patents) 2 | 3 | "This implementation" means the copyrightable works distributed by 4 | Google as part of the Go project. 5 | 6 | Google hereby grants to You a perpetual, worldwide, non-exclusive, 7 | no-charge, royalty-free, irrevocable (except as stated in this section) 8 | patent license to make, have made, use, offer to sell, sell, import, 9 | transfer and otherwise run, modify and propagate the contents of this 10 | implementation of Go, where such license applies only to those patent 11 | claims, both currently owned or controlled by Google and acquired in 12 | the future, licensable by Google that are necessarily infringed by this 13 | implementation of Go. This grant does not include claims that would be 14 | infringed only as a consequence of further modification of this 15 | implementation. If you or your agent or exclusive licensee institute or 16 | order or agree to the institution of patent litigation against any 17 | entity (including a cross-claim or counterclaim in a lawsuit) alleging 18 | that this implementation of Go or any code incorporated within this 19 | implementation of Go constitutes direct or contributory patent 20 | infringement, or inducement of patent infringement, then any patent 21 | rights granted to you under this License for this implementation of Go 22 | shall terminate as of the date such litigation is filed. 23 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_darwin_386.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for 386, Darwin 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-28 17 | JMP syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-40 20 | JMP syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-52 23 | JMP syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28 26 | JMP syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 29 | JMP syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_darwin_amd64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for AMD64, Darwin 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-56 17 | JMP syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 20 | JMP syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-104 23 | JMP syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 26 | JMP syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 29 | JMP syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_darwin_arm.s: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | // +build arm,darwin 7 | 8 | #include "textflag.h" 9 | 10 | // 11 | // System call support for ARM, Darwin 12 | // 13 | 14 | // Just jump to package syscall's implementation for all these functions. 15 | // The runtime may know about them. 16 | 17 | TEXT ·Syscall(SB),NOSPLIT,$0-28 18 | B syscall·Syscall(SB) 19 | 20 | TEXT ·Syscall6(SB),NOSPLIT,$0-40 21 | B syscall·Syscall6(SB) 22 | 23 | TEXT ·Syscall9(SB),NOSPLIT,$0-52 24 | B syscall·Syscall9(SB) 25 | 26 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28 27 | B syscall·RawSyscall(SB) 28 | 29 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 30 | B syscall·RawSyscall6(SB) 31 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_darwin_arm64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | // +build arm64,darwin 7 | 8 | #include "textflag.h" 9 | 10 | // 11 | // System call support for AMD64, Darwin 12 | // 13 | 14 | // Just jump to package syscall's implementation for all these functions. 15 | // The runtime may know about them. 16 | 17 | TEXT ·Syscall(SB),NOSPLIT,$0-56 18 | B syscall·Syscall(SB) 19 | 20 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 21 | B syscall·Syscall6(SB) 22 | 23 | TEXT ·Syscall9(SB),NOSPLIT,$0-104 24 | B syscall·Syscall9(SB) 25 | 26 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 27 | B syscall·RawSyscall(SB) 28 | 29 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 30 | B syscall·RawSyscall6(SB) 31 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_dragonfly_amd64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for AMD64, DragonFly 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-64 17 | JMP syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-88 20 | JMP syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-112 23 | JMP syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-64 26 | JMP syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-88 29 | JMP syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_freebsd_386.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for 386, FreeBSD 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-28 17 | JMP syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-40 20 | JMP syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-52 23 | JMP syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28 26 | JMP syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 29 | JMP syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_freebsd_amd64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for AMD64, FreeBSD 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-56 17 | JMP syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 20 | JMP syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-104 23 | JMP syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 26 | JMP syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 29 | JMP syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_freebsd_arm.s: -------------------------------------------------------------------------------- 1 | // Copyright 2012 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for ARM, FreeBSD 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-28 17 | B syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-40 20 | B syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-52 23 | B syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28 26 | B syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 29 | B syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_linux_386.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System calls for 386, Linux 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-28 17 | JMP syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-40 20 | JMP syscall·Syscall6(SB) 21 | 22 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28 23 | JMP syscall·RawSyscall(SB) 24 | 25 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 26 | JMP syscall·RawSyscall6(SB) 27 | 28 | TEXT ·socketcall(SB),NOSPLIT,$0-36 29 | JMP syscall·socketcall(SB) 30 | 31 | TEXT ·rawsocketcall(SB),NOSPLIT,$0-36 32 | JMP syscall·rawsocketcall(SB) 33 | 34 | TEXT ·seek(SB),NOSPLIT,$0-28 35 | JMP syscall·seek(SB) 36 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_linux_amd64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System calls for AMD64, Linux 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-56 17 | JMP syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 20 | JMP syscall·Syscall6(SB) 21 | 22 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 23 | JMP syscall·RawSyscall(SB) 24 | 25 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 26 | JMP syscall·RawSyscall6(SB) 27 | 28 | TEXT ·gettimeofday(SB),NOSPLIT,$0-16 29 | JMP syscall·gettimeofday(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_linux_arm.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System calls for arm, Linux 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-28 17 | B syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-40 20 | B syscall·Syscall6(SB) 21 | 22 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28 23 | B syscall·RawSyscall(SB) 24 | 25 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 26 | B syscall·RawSyscall6(SB) 27 | 28 | TEXT ·seek(SB),NOSPLIT,$0-32 29 | B syscall·seek(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_linux_arm64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build linux 6 | // +build arm64 7 | // +build !gccgo 8 | 9 | #include "textflag.h" 10 | 11 | // Just jump to package syscall's implementation for all these functions. 12 | // The runtime may know about them. 13 | 14 | TEXT ·Syscall(SB),NOSPLIT,$0-56 15 | B syscall·Syscall(SB) 16 | 17 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 18 | B syscall·Syscall6(SB) 19 | 20 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 21 | B syscall·RawSyscall(SB) 22 | 23 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 24 | B syscall·RawSyscall6(SB) 25 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_linux_mips64x.s: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build linux 6 | // +build mips64 mips64le 7 | // +build !gccgo 8 | 9 | #include "textflag.h" 10 | 11 | // 12 | // System calls for mips64, Linux 13 | // 14 | 15 | // Just jump to package syscall's implementation for all these functions. 16 | // The runtime may know about them. 17 | 18 | TEXT ·Syscall(SB),NOSPLIT,$0-56 19 | JMP syscall·Syscall(SB) 20 | 21 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 22 | JMP syscall·Syscall6(SB) 23 | 24 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 25 | JMP syscall·RawSyscall(SB) 26 | 27 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 28 | JMP syscall·RawSyscall6(SB) 29 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_linux_mipsx.s: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build linux 6 | // +build mips mipsle 7 | // +build !gccgo 8 | 9 | #include "textflag.h" 10 | 11 | // 12 | // System calls for mips, 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-28 19 | JMP syscall·Syscall(SB) 20 | 21 | TEXT ·Syscall6(SB),NOSPLIT,$0-40 22 | JMP syscall·Syscall6(SB) 23 | 24 | TEXT ·Syscall9(SB),NOSPLIT,$0-52 25 | JMP syscall·Syscall9(SB) 26 | 27 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28 28 | JMP syscall·RawSyscall(SB) 29 | 30 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 31 | JMP syscall·RawSyscall6(SB) 32 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_linux_ppc64x.s: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build linux 6 | // +build ppc64 ppc64le 7 | // +build !gccgo 8 | 9 | #include "textflag.h" 10 | 11 | // 12 | // System calls for ppc64, Linux 13 | // 14 | 15 | // Just jump to package syscall's implementation for all these functions. 16 | // The runtime may know about them. 17 | 18 | TEXT ·Syscall(SB),NOSPLIT,$0-56 19 | BR syscall·Syscall(SB) 20 | 21 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 22 | BR syscall·Syscall6(SB) 23 | 24 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 25 | BR syscall·RawSyscall(SB) 26 | 27 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 28 | BR syscall·RawSyscall6(SB) 29 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_linux_s390x.s: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build s390x 6 | // +build linux 7 | // +build !gccgo 8 | 9 | #include "textflag.h" 10 | 11 | // 12 | // System calls for s390x, Linux 13 | // 14 | 15 | // Just jump to package syscall's implementation for all these functions. 16 | // The runtime may know about them. 17 | 18 | TEXT ·Syscall(SB),NOSPLIT,$0-56 19 | BR syscall·Syscall(SB) 20 | 21 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 22 | BR syscall·Syscall6(SB) 23 | 24 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 25 | BR syscall·RawSyscall(SB) 26 | 27 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 28 | BR syscall·RawSyscall6(SB) 29 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_netbsd_386.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for 386, NetBSD 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-28 17 | JMP syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-40 20 | JMP syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-52 23 | JMP syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28 26 | JMP syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 29 | JMP syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_netbsd_amd64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for AMD64, NetBSD 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-56 17 | JMP syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 20 | JMP syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-104 23 | JMP syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 26 | JMP syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 29 | JMP syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_netbsd_arm.s: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for ARM, NetBSD 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-28 17 | B syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-40 20 | B syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-52 23 | B syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28 26 | B syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 29 | B syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_openbsd_386.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for 386, OpenBSD 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-28 17 | JMP syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-40 20 | JMP syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-52 23 | JMP syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28 26 | JMP syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 29 | JMP syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_openbsd_amd64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for AMD64, OpenBSD 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-56 17 | JMP syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 20 | JMP syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-104 23 | JMP syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 26 | JMP syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 29 | JMP syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_solaris_amd64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System calls for amd64, Solaris are implemented in runtime/syscall_solaris.go 11 | // 12 | 13 | TEXT ·sysvicall6(SB),NOSPLIT,$0-88 14 | JMP syscall·sysvicall6(SB) 15 | 16 | TEXT ·rawSysvicall6(SB),NOSPLIT,$0-88 17 | JMP syscall·rawSysvicall6(SB) 18 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/bluetooth_linux.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // Bluetooth sockets and messages 6 | 7 | package unix 8 | 9 | // Bluetooth Protocols 10 | const ( 11 | BTPROTO_L2CAP = 0 12 | BTPROTO_HCI = 1 13 | BTPROTO_SCO = 2 14 | BTPROTO_RFCOMM = 3 15 | BTPROTO_BNEP = 4 16 | BTPROTO_CMTP = 5 17 | BTPROTO_HIDP = 6 18 | BTPROTO_AVDTP = 7 19 | ) 20 | 21 | const ( 22 | HCI_CHANNEL_RAW = 0 23 | HCI_CHANNEL_USER = 1 24 | HCI_CHANNEL_MONITOR = 2 25 | HCI_CHANNEL_CONTROL = 3 26 | ) 27 | 28 | // Socketoption Level 29 | const ( 30 | SOL_BLUETOOTH = 0x112 31 | SOL_HCI = 0x0 32 | SOL_L2CAP = 0x6 33 | SOL_RFCOMM = 0x12 34 | SOL_SCO = 0x11 35 | ) 36 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/constants.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build darwin dragonfly freebsd linux netbsd openbsd solaris 6 | 7 | package unix 8 | 9 | const ( 10 | R_OK = 0x4 11 | W_OK = 0x2 12 | X_OK = 0x1 13 | ) 14 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/dev_linux.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // Functions to access/create device major and minor numbers matching the 6 | // encoding used by the Linux kernel and glibc. 7 | // 8 | // The information below is extracted and adapted from bits/sysmacros.h in the 9 | // glibc sources: 10 | // 11 | // dev_t in glibc is 64-bit, with 32-bit major and minor numbers. glibc's 12 | // default encoding is MMMM Mmmm mmmM MMmm, where M is a hex digit of the major 13 | // number and m is a hex digit of the minor number. This is backward compatible 14 | // with legacy systems where dev_t is 16 bits wide, encoded as MMmm. It is also 15 | // backward compatible with the Linux kernel, which for some architectures uses 16 | // 32-bit dev_t, encoded as mmmM MMmm. 17 | 18 | package unix 19 | 20 | // Major returns the major component of a Linux device number. 21 | func Major(dev uint64) uint32 { 22 | major := uint32((dev & 0x00000000000fff00) >> 8) 23 | major |= uint32((dev & 0xfffff00000000000) >> 32) 24 | return major 25 | } 26 | 27 | // Minor returns the minor component of a Linux device number. 28 | func Minor(dev uint64) uint32 { 29 | minor := uint32((dev & 0x00000000000000ff) >> 0) 30 | minor |= uint32((dev & 0x00000ffffff00000) >> 12) 31 | return minor 32 | } 33 | 34 | // Mkdev returns a Linux device number generated from the given major and minor 35 | // components. 36 | func Mkdev(major, minor uint32) uint64 { 37 | dev := uint64((major & 0x00000fff) << 8) 38 | dev |= uint64((major & 0xfffff000) << 32) 39 | dev |= uint64((minor & 0x000000ff) << 0) 40 | dev |= uint64((minor & 0xffffff00) << 12) 41 | return dev 42 | } 43 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/endian_big.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 ppc64 s390x mips mips64 6 | 7 | package unix 8 | 9 | const isBigEndian = true 10 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/endian_little.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 386 amd64 amd64p32 arm arm64 ppc64le mipsle mips64le 6 | 7 | package unix 8 | 9 | const isBigEndian = false 10 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/env_unix.go: -------------------------------------------------------------------------------- 1 | // Copyright 2010 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build darwin dragonfly freebsd linux netbsd openbsd solaris 6 | 7 | // Unix environment variables. 8 | 9 | package unix 10 | 11 | import "syscall" 12 | 13 | func Getenv(key string) (value string, found bool) { 14 | return syscall.Getenv(key) 15 | } 16 | 17 | func Setenv(key, value string) error { 18 | return syscall.Setenv(key, value) 19 | } 20 | 21 | func Clearenv() { 22 | syscall.Clearenv() 23 | } 24 | 25 | func Environ() []string { 26 | return syscall.Environ() 27 | } 28 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/env_unset.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build go1.4 6 | 7 | package unix 8 | 9 | import "syscall" 10 | 11 | func Unsetenv(key string) error { 12 | // This was added in Go 1.4. 13 | return syscall.Unsetenv(key) 14 | } 15 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/file_unix.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package unix 6 | 7 | import ( 8 | "os" 9 | "syscall" 10 | ) 11 | 12 | // FIXME: unexported function from os 13 | // syscallMode returns the syscall-specific mode bits from Go's portable mode bits. 14 | func syscallMode(i os.FileMode) (o uint32) { 15 | o |= uint32(i.Perm()) 16 | if i&os.ModeSetuid != 0 { 17 | o |= syscall.S_ISUID 18 | } 19 | if i&os.ModeSetgid != 0 { 20 | o |= syscall.S_ISGID 21 | } 22 | if i&os.ModeSticky != 0 { 23 | o |= syscall.S_ISVTX 24 | } 25 | // No mapping for Go's ModeTemporary (plan9 only). 26 | return 27 | } 28 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/flock.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build darwin dragonfly freebsd linux netbsd openbsd 6 | 7 | package unix 8 | 9 | import "unsafe" 10 | 11 | // fcntl64Syscall is usually SYS_FCNTL, but is overridden on 32-bit Linux 12 | // systems by flock_linux_32bit.go to be SYS_FCNTL64. 13 | var fcntl64Syscall uintptr = SYS_FCNTL 14 | 15 | // FcntlFlock performs a fcntl syscall for the F_GETLK, F_SETLK or F_SETLKW command. 16 | func FcntlFlock(fd uintptr, cmd int, lk *Flock_t) error { 17 | _, _, errno := Syscall(fcntl64Syscall, fd, uintptr(cmd), uintptr(unsafe.Pointer(lk))) 18 | if errno == 0 { 19 | return nil 20 | } 21 | return errno 22 | } 23 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/flock_linux_32bit.go: -------------------------------------------------------------------------------- 1 | // +build linux,386 linux,arm linux,mips linux,mipsle 2 | 3 | // Copyright 2014 The Go Authors. All rights reserved. 4 | // Use of this source code is governed by a BSD-style 5 | // license that can be found in the LICENSE file. 6 | 7 | package unix 8 | 9 | func init() { 10 | // On 32-bit Linux systems, the fcntl syscall that matches Go's 11 | // Flock_t type is SYS_FCNTL64, not SYS_FCNTL. 12 | fcntl64Syscall = SYS_FCNTL64 13 | } 14 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/gccgo.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build gccgo 6 | 7 | package unix 8 | 9 | import "syscall" 10 | 11 | // We can't use the gc-syntax .s files for gccgo. On the plus side 12 | // much of the functionality can be written directly in Go. 13 | 14 | //extern gccgoRealSyscall 15 | func realSyscall(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r, errno uintptr) 16 | 17 | func Syscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.Errno) { 18 | syscall.Entersyscall() 19 | r, errno := realSyscall(trap, a1, a2, a3, 0, 0, 0, 0, 0, 0) 20 | syscall.Exitsyscall() 21 | return r, 0, syscall.Errno(errno) 22 | } 23 | 24 | func Syscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err syscall.Errno) { 25 | syscall.Entersyscall() 26 | r, errno := realSyscall(trap, a1, a2, a3, a4, a5, a6, 0, 0, 0) 27 | syscall.Exitsyscall() 28 | return r, 0, syscall.Errno(errno) 29 | } 30 | 31 | func Syscall9(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) { 32 | syscall.Entersyscall() 33 | r, errno := realSyscall(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9) 34 | syscall.Exitsyscall() 35 | return r, 0, syscall.Errno(errno) 36 | } 37 | 38 | func RawSyscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.Errno) { 39 | r, errno := realSyscall(trap, a1, a2, a3, 0, 0, 0, 0, 0, 0) 40 | return r, 0, syscall.Errno(errno) 41 | } 42 | 43 | func RawSyscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err syscall.Errno) { 44 | r, errno := realSyscall(trap, a1, a2, a3, a4, a5, a6, 0, 0, 0) 45 | return r, 0, syscall.Errno(errno) 46 | } 47 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/gccgo_c.c: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build gccgo 6 | 7 | #include 8 | #include 9 | #include 10 | 11 | #define _STRINGIFY2_(x) #x 12 | #define _STRINGIFY_(x) _STRINGIFY2_(x) 13 | #define GOSYM_PREFIX _STRINGIFY_(__USER_LABEL_PREFIX__) 14 | 15 | // Call syscall from C code because the gccgo support for calling from 16 | // Go to C does not support varargs functions. 17 | 18 | struct ret { 19 | uintptr_t r; 20 | uintptr_t err; 21 | }; 22 | 23 | struct ret 24 | gccgoRealSyscall(uintptr_t trap, uintptr_t a1, uintptr_t a2, uintptr_t a3, uintptr_t a4, uintptr_t a5, uintptr_t a6, uintptr_t a7, uintptr_t a8, uintptr_t a9) 25 | { 26 | struct ret r; 27 | 28 | errno = 0; 29 | r.r = syscall(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9); 30 | r.err = errno; 31 | return r; 32 | } 33 | 34 | // Define the use function in C so that it is not inlined. 35 | 36 | extern void use(void *) __asm__ (GOSYM_PREFIX GOPKGPATH ".use") __attribute__((noinline)); 37 | 38 | void 39 | use(void *p __attribute__ ((unused))) 40 | { 41 | } 42 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/gccgo_linux_amd64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build gccgo,linux,amd64 6 | 7 | package unix 8 | 9 | import "syscall" 10 | 11 | //extern gettimeofday 12 | func realGettimeofday(*Timeval, *byte) int32 13 | 14 | func gettimeofday(tv *Timeval) (err syscall.Errno) { 15 | r := realGettimeofday(tv, nil) 16 | if r < 0 { 17 | return syscall.GetErrno() 18 | } 19 | return 0 20 | } 21 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/gccgo_linux_sparc64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build gccgo,linux,sparc64 6 | 7 | package unix 8 | 9 | import "syscall" 10 | 11 | //extern sysconf 12 | func realSysconf(name int) int64 13 | 14 | func sysconf(name int) (n int64, err syscall.Errno) { 15 | r := realSysconf(name) 16 | if r < 0 { 17 | return 0, syscall.GetErrno() 18 | } 19 | return r, 0 20 | } 21 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/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 | 44 | print " $name = $num; // $proto\n"; 45 | } 46 | } 47 | 48 | print <){ 31 | if($line =~ /^(.*)\\$/) { 32 | # Handle continuation 33 | $line = $1; 34 | $_ =~ s/^\s+//; 35 | $line .= $_; 36 | } else { 37 | # New line 38 | $line = $_; 39 | } 40 | next if $line =~ /\\$/; 41 | if($line =~ /^([0-9]+)\s+((STD)|(NOERR))\s+(RUMP\s+)?({\s+\S+\s*\*?\s*\|(\S+)\|(\S*)\|(\w+).*\s+})(\s+(\S+))?$/) { 42 | my $num = $1; 43 | my $proto = $6; 44 | my $compat = $8; 45 | my $name = "$7_$9"; 46 | 47 | $name = "$7_$11" if $11 ne ''; 48 | $name =~ y/a-z/A-Z/; 49 | 50 | if($compat eq '' || $compat eq '30' || $compat eq '50') { 51 | print " $name = $num; // $proto\n"; 52 | } 53 | } 54 | } 55 | 56 | print <){ 30 | if(/^([0-9]+)\s+STD\s+(NOLOCK\s+)?({ \S+\s+\*?(\w+).*)$/){ 31 | my $num = $1; 32 | my $proto = $3; 33 | my $name = $4; 34 | $name =~ y/a-z/A-Z/; 35 | 36 | # There are multiple entries for enosys and nosys, so comment them out. 37 | if($name =~ /^SYS_E?NOSYS$/){ 38 | $name = "// $name"; 39 | } 40 | if($name eq 'SYS_SYS_EXIT'){ 41 | $name = 'SYS_EXIT'; 42 | } 43 | 44 | print " $name = $num; // $proto\n"; 45 | } 46 | } 47 | 48 | print <= 10 { 20 | buf[i] = byte(val%10 + '0') 21 | i-- 22 | val /= 10 23 | } 24 | buf[i] = byte(val + '0') 25 | return string(buf[i:]) 26 | } 27 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall.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 // import "golang.org/x/sys/unix" 23 | 24 | // ByteSliceFromString returns a NUL-terminated slice of bytes 25 | // containing the text of s. If s contains a NUL byte at any 26 | // location, it returns (nil, EINVAL). 27 | func ByteSliceFromString(s string) ([]byte, error) { 28 | for i := 0; i < len(s); i++ { 29 | if s[i] == 0 { 30 | return nil, EINVAL 31 | } 32 | } 33 | a := make([]byte, len(s)+1) 34 | copy(a, s) 35 | return a, nil 36 | } 37 | 38 | // BytePtrFromString returns a pointer to a NUL-terminated array of 39 | // bytes containing the text of s. If s contains a NUL byte at any 40 | // location, it returns (nil, EINVAL). 41 | func BytePtrFromString(s string) (*byte, error) { 42 | a, err := ByteSliceFromString(s) 43 | if err != nil { 44 | return nil, err 45 | } 46 | return &a[0], nil 47 | } 48 | 49 | // Single-word zero for use when we need a valid pointer to 0 bytes. 50 | // See mkunix.pl. 51 | var _zero uintptr 52 | 53 | func (ts *Timespec) Unix() (sec int64, nsec int64) { 54 | return int64(ts.Sec), int64(ts.Nsec) 55 | } 56 | 57 | func (tv *Timeval) Unix() (sec int64, nsec int64) { 58 | return int64(tv.Sec), int64(tv.Usec) * 1000 59 | } 60 | 61 | func (ts *Timespec) Nano() int64 { 62 | return int64(ts.Sec)*1e9 + int64(ts.Nsec) 63 | } 64 | 65 | func (tv *Timeval) Nano() int64 { 66 | return int64(tv.Sec)*1e9 + int64(tv.Usec)*1000 67 | } 68 | 69 | func TimevalToNsec(tv Timeval) int64 { return int64(tv.Sec)*1e9 + int64(tv.Usec)*1e3 } 70 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_darwin_386.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build 386,darwin 6 | 7 | package unix 8 | 9 | import ( 10 | "syscall" 11 | "unsafe" 12 | ) 13 | 14 | func Getpagesize() int { return 4096 } 15 | 16 | func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) } 17 | 18 | func NsecToTimespec(nsec int64) (ts Timespec) { 19 | ts.Sec = int32(nsec / 1e9) 20 | ts.Nsec = int32(nsec % 1e9) 21 | return 22 | } 23 | 24 | func NsecToTimeval(nsec int64) (tv Timeval) { 25 | nsec += 999 // round up to microsecond 26 | tv.Usec = int32(nsec % 1e9 / 1e3) 27 | tv.Sec = int32(nsec / 1e9) 28 | return 29 | } 30 | 31 | //sysnb gettimeofday(tp *Timeval) (sec int32, usec int32, err error) 32 | func Gettimeofday(tv *Timeval) (err error) { 33 | // The tv passed to gettimeofday must be non-nil 34 | // but is otherwise unused. The answers come back 35 | // in the two registers. 36 | sec, usec, err := gettimeofday(tv) 37 | tv.Sec = int32(sec) 38 | tv.Usec = int32(usec) 39 | return err 40 | } 41 | 42 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 43 | k.Ident = uint32(fd) 44 | k.Filter = int16(mode) 45 | k.Flags = uint16(flags) 46 | } 47 | 48 | func (iov *Iovec) SetLen(length int) { 49 | iov.Len = uint32(length) 50 | } 51 | 52 | func (msghdr *Msghdr) SetControllen(length int) { 53 | msghdr.Controllen = uint32(length) 54 | } 55 | 56 | func (cmsg *Cmsghdr) SetLen(length int) { 57 | cmsg.Len = uint32(length) 58 | } 59 | 60 | func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) { 61 | var length = uint64(count) 62 | 63 | _, _, e1 := Syscall9(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr(*offset>>32), uintptr(unsafe.Pointer(&length)), 0, 0, 0, 0) 64 | 65 | written = int(length) 66 | 67 | if e1 != 0 { 68 | err = e1 69 | } 70 | return 71 | } 72 | 73 | func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) 74 | 75 | // SYS___SYSCTL is used by syscall_bsd.go for all BSDs, but in modern versions 76 | // of darwin/386 the syscall is called sysctl instead of __sysctl. 77 | const SYS___SYSCTL = SYS_SYSCTL 78 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_darwin_amd64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build amd64,darwin 6 | 7 | package unix 8 | 9 | import ( 10 | "syscall" 11 | "unsafe" 12 | ) 13 | 14 | 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 = 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) 74 | 75 | // SYS___SYSCTL is used by syscall_bsd.go for all BSDs, but in modern versions 76 | // of darwin/amd64 the syscall is called sysctl instead of __sysctl. 77 | const SYS___SYSCTL = SYS_SYSCTL 78 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_darwin_arm.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package unix 6 | 7 | import ( 8 | "syscall" 9 | "unsafe" 10 | ) 11 | 12 | func Getpagesize() int { return 4096 } 13 | 14 | func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) } 15 | 16 | func NsecToTimespec(nsec int64) (ts Timespec) { 17 | ts.Sec = int32(nsec / 1e9) 18 | ts.Nsec = int32(nsec % 1e9) 19 | return 20 | } 21 | 22 | func NsecToTimeval(nsec int64) (tv Timeval) { 23 | nsec += 999 // round up to microsecond 24 | tv.Usec = int32(nsec % 1e9 / 1e3) 25 | tv.Sec = int32(nsec / 1e9) 26 | return 27 | } 28 | 29 | //sysnb gettimeofday(tp *Timeval) (sec int32, usec int32, err error) 30 | func Gettimeofday(tv *Timeval) (err error) { 31 | // The tv passed to gettimeofday must be non-nil 32 | // but is otherwise unused. The answers come back 33 | // in the two registers. 34 | sec, usec, err := gettimeofday(tv) 35 | tv.Sec = int32(sec) 36 | tv.Usec = int32(usec) 37 | return err 38 | } 39 | 40 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 41 | k.Ident = uint32(fd) 42 | k.Filter = int16(mode) 43 | k.Flags = uint16(flags) 44 | } 45 | 46 | func (iov *Iovec) SetLen(length int) { 47 | iov.Len = uint32(length) 48 | } 49 | 50 | func (msghdr *Msghdr) SetControllen(length int) { 51 | msghdr.Controllen = uint32(length) 52 | } 53 | 54 | func (cmsg *Cmsghdr) SetLen(length int) { 55 | cmsg.Len = uint32(length) 56 | } 57 | 58 | func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) { 59 | var length = uint64(count) 60 | 61 | _, _, e1 := Syscall9(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr(*offset>>32), uintptr(unsafe.Pointer(&length)), 0, 0, 0, 0) 62 | 63 | written = int(length) 64 | 65 | if e1 != 0 { 66 | err = e1 67 | } 68 | return 69 | } 70 | 71 | func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) // sic 72 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_darwin_arm64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build arm64,darwin 6 | 7 | package unix 8 | 9 | import ( 10 | "syscall" 11 | "unsafe" 12 | ) 13 | 14 | func Getpagesize() int { return 16384 } 15 | 16 | func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) } 17 | 18 | func NsecToTimespec(nsec int64) (ts Timespec) { 19 | ts.Sec = nsec / 1e9 20 | ts.Nsec = nsec % 1e9 21 | return 22 | } 23 | 24 | func NsecToTimeval(nsec int64) (tv Timeval) { 25 | nsec += 999 // round up to microsecond 26 | tv.Usec = int32(nsec % 1e9 / 1e3) 27 | tv.Sec = int64(nsec / 1e9) 28 | return 29 | } 30 | 31 | //sysnb gettimeofday(tp *Timeval) (sec int64, usec int32, err error) 32 | func Gettimeofday(tv *Timeval) (err error) { 33 | // The tv passed to gettimeofday must be non-nil 34 | // but is otherwise unused. The answers come back 35 | // in the two registers. 36 | sec, usec, err := gettimeofday(tv) 37 | tv.Sec = sec 38 | tv.Usec = usec 39 | return err 40 | } 41 | 42 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 43 | k.Ident = uint64(fd) 44 | k.Filter = int16(mode) 45 | k.Flags = uint16(flags) 46 | } 47 | 48 | func (iov *Iovec) SetLen(length int) { 49 | iov.Len = uint64(length) 50 | } 51 | 52 | func (msghdr *Msghdr) SetControllen(length int) { 53 | msghdr.Controllen = uint32(length) 54 | } 55 | 56 | func (cmsg *Cmsghdr) SetLen(length int) { 57 | cmsg.Len = uint32(length) 58 | } 59 | 60 | func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) { 61 | var length = uint64(count) 62 | 63 | _, _, e1 := Syscall6(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr(unsafe.Pointer(&length)), 0, 0) 64 | 65 | written = int(length) 66 | 67 | if e1 != 0 { 68 | err = e1 69 | } 70 | return 71 | } 72 | 73 | func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) // sic 74 | 75 | // SYS___SYSCTL is used by syscall_bsd.go for all BSDs, but in modern versions 76 | // of darwin/arm64 the syscall is called sysctl instead of __sysctl. 77 | const SYS___SYSCTL = SYS_SYSCTL 78 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_dragonfly_amd64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build amd64,dragonfly 6 | 7 | package unix 8 | 9 | import ( 10 | "syscall" 11 | "unsafe" 12 | ) 13 | 14 | func Getpagesize() int { return 4096 } 15 | 16 | func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) } 17 | 18 | func NsecToTimespec(nsec int64) (ts Timespec) { 19 | ts.Sec = nsec / 1e9 20 | ts.Nsec = nsec % 1e9 21 | return 22 | } 23 | 24 | func NsecToTimeval(nsec int64) (tv Timeval) { 25 | nsec += 999 // round up to microsecond 26 | tv.Usec = nsec % 1e9 / 1e3 27 | tv.Sec = int64(nsec / 1e9) 28 | return 29 | } 30 | 31 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 32 | k.Ident = uint64(fd) 33 | k.Filter = int16(mode) 34 | k.Flags = uint16(flags) 35 | } 36 | 37 | func (iov *Iovec) SetLen(length int) { 38 | iov.Len = uint64(length) 39 | } 40 | 41 | func (msghdr *Msghdr) SetControllen(length int) { 42 | msghdr.Controllen = uint32(length) 43 | } 44 | 45 | func (cmsg *Cmsghdr) SetLen(length int) { 46 | cmsg.Len = uint32(length) 47 | } 48 | 49 | func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) { 50 | var writtenOut uint64 = 0 51 | _, _, e1 := Syscall9(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr(count), 0, uintptr(unsafe.Pointer(&writtenOut)), 0, 0, 0) 52 | 53 | written = int(writtenOut) 54 | 55 | if e1 != 0 { 56 | err = e1 57 | } 58 | return 59 | } 60 | 61 | func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) 62 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_freebsd_386.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build 386,freebsd 6 | 7 | package unix 8 | 9 | import ( 10 | "syscall" 11 | "unsafe" 12 | ) 13 | 14 | func Getpagesize() int { return 4096 } 15 | 16 | func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) } 17 | 18 | func NsecToTimespec(nsec int64) (ts Timespec) { 19 | ts.Sec = int32(nsec / 1e9) 20 | ts.Nsec = int32(nsec % 1e9) 21 | return 22 | } 23 | 24 | func NsecToTimeval(nsec int64) (tv Timeval) { 25 | nsec += 999 // round up to microsecond 26 | tv.Usec = int32(nsec % 1e9 / 1e3) 27 | tv.Sec = int32(nsec / 1e9) 28 | return 29 | } 30 | 31 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 32 | k.Ident = uint32(fd) 33 | k.Filter = int16(mode) 34 | k.Flags = uint16(flags) 35 | } 36 | 37 | func (iov *Iovec) SetLen(length int) { 38 | iov.Len = uint32(length) 39 | } 40 | 41 | func (msghdr *Msghdr) SetControllen(length int) { 42 | msghdr.Controllen = uint32(length) 43 | } 44 | 45 | func (cmsg *Cmsghdr) SetLen(length int) { 46 | cmsg.Len = uint32(length) 47 | } 48 | 49 | func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) { 50 | var writtenOut uint64 = 0 51 | _, _, e1 := Syscall9(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr((*offset)>>32), uintptr(count), 0, uintptr(unsafe.Pointer(&writtenOut)), 0, 0) 52 | 53 | written = int(writtenOut) 54 | 55 | if e1 != 0 { 56 | err = e1 57 | } 58 | return 59 | } 60 | 61 | func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) 62 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_freebsd_amd64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build amd64,freebsd 6 | 7 | package unix 8 | 9 | import ( 10 | "syscall" 11 | "unsafe" 12 | ) 13 | 14 | func Getpagesize() int { return 4096 } 15 | 16 | func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) } 17 | 18 | func NsecToTimespec(nsec int64) (ts Timespec) { 19 | ts.Sec = nsec / 1e9 20 | ts.Nsec = nsec % 1e9 21 | return 22 | } 23 | 24 | func NsecToTimeval(nsec int64) (tv Timeval) { 25 | nsec += 999 // round up to microsecond 26 | tv.Usec = nsec % 1e9 / 1e3 27 | tv.Sec = int64(nsec / 1e9) 28 | return 29 | } 30 | 31 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 32 | k.Ident = uint64(fd) 33 | k.Filter = int16(mode) 34 | k.Flags = uint16(flags) 35 | } 36 | 37 | func (iov *Iovec) SetLen(length int) { 38 | iov.Len = uint64(length) 39 | } 40 | 41 | func (msghdr *Msghdr) SetControllen(length int) { 42 | msghdr.Controllen = uint32(length) 43 | } 44 | 45 | func (cmsg *Cmsghdr) SetLen(length int) { 46 | cmsg.Len = uint32(length) 47 | } 48 | 49 | func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) { 50 | var writtenOut uint64 = 0 51 | _, _, e1 := Syscall9(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr(count), 0, uintptr(unsafe.Pointer(&writtenOut)), 0, 0, 0) 52 | 53 | written = int(writtenOut) 54 | 55 | if e1 != 0 { 56 | err = e1 57 | } 58 | return 59 | } 60 | 61 | func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) 62 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_freebsd_arm.go: -------------------------------------------------------------------------------- 1 | // Copyright 2012 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build arm,freebsd 6 | 7 | package unix 8 | 9 | import ( 10 | "syscall" 11 | "unsafe" 12 | ) 13 | 14 | func Getpagesize() int { return 4096 } 15 | 16 | func TimespecToNsec(ts Timespec) int64 { return ts.Sec*1e9 + int64(ts.Nsec) } 17 | 18 | func NsecToTimespec(nsec int64) (ts Timespec) { 19 | ts.Sec = nsec / 1e9 20 | ts.Nsec = int32(nsec % 1e9) 21 | return 22 | } 23 | 24 | func NsecToTimeval(nsec int64) (tv Timeval) { 25 | nsec += 999 // round up to microsecond 26 | tv.Usec = int32(nsec % 1e9 / 1e3) 27 | tv.Sec = nsec / 1e9 28 | return 29 | } 30 | 31 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 32 | k.Ident = uint32(fd) 33 | k.Filter = int16(mode) 34 | k.Flags = uint16(flags) 35 | } 36 | 37 | func (iov *Iovec) SetLen(length int) { 38 | iov.Len = uint32(length) 39 | } 40 | 41 | func (msghdr *Msghdr) SetControllen(length int) { 42 | msghdr.Controllen = uint32(length) 43 | } 44 | 45 | func (cmsg *Cmsghdr) SetLen(length int) { 46 | cmsg.Len = uint32(length) 47 | } 48 | 49 | func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) { 50 | var writtenOut uint64 = 0 51 | _, _, e1 := Syscall9(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr((*offset)>>32), uintptr(count), 0, uintptr(unsafe.Pointer(&writtenOut)), 0, 0) 52 | 53 | written = int(writtenOut) 54 | 55 | if e1 != 0 { 56 | err = e1 57 | } 58 | return 59 | } 60 | 61 | func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) 62 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_linux_amd64_gc.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 amd64,linux 6 | // +build !gccgo 7 | 8 | package unix 9 | 10 | import "syscall" 11 | 12 | //go:noescape 13 | func gettimeofday(tv *Timeval) (err syscall.Errno) 14 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_netbsd_386.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build 386,netbsd 6 | 7 | package unix 8 | 9 | func Getpagesize() int { return 4096 } 10 | 11 | func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) } 12 | 13 | func NsecToTimespec(nsec int64) (ts Timespec) { 14 | ts.Sec = int64(nsec / 1e9) 15 | ts.Nsec = int32(nsec % 1e9) 16 | return 17 | } 18 | 19 | func NsecToTimeval(nsec int64) (tv Timeval) { 20 | nsec += 999 // round up to microsecond 21 | tv.Usec = int32(nsec % 1e9 / 1e3) 22 | tv.Sec = int64(nsec / 1e9) 23 | return 24 | } 25 | 26 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 27 | k.Ident = uint32(fd) 28 | k.Filter = uint32(mode) 29 | k.Flags = uint32(flags) 30 | } 31 | 32 | func (iov *Iovec) SetLen(length int) { 33 | iov.Len = uint32(length) 34 | } 35 | 36 | func (msghdr *Msghdr) SetControllen(length int) { 37 | msghdr.Controllen = uint32(length) 38 | } 39 | 40 | func (cmsg *Cmsghdr) SetLen(length int) { 41 | cmsg.Len = uint32(length) 42 | } 43 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_netbsd_amd64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build amd64,netbsd 6 | 7 | package unix 8 | 9 | func Getpagesize() int { return 4096 } 10 | 11 | func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) } 12 | 13 | func NsecToTimespec(nsec int64) (ts Timespec) { 14 | ts.Sec = int64(nsec / 1e9) 15 | ts.Nsec = int64(nsec % 1e9) 16 | return 17 | } 18 | 19 | func NsecToTimeval(nsec int64) (tv Timeval) { 20 | nsec += 999 // round up to microsecond 21 | tv.Usec = int32(nsec % 1e9 / 1e3) 22 | tv.Sec = int64(nsec / 1e9) 23 | return 24 | } 25 | 26 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 27 | k.Ident = uint64(fd) 28 | k.Filter = uint32(mode) 29 | k.Flags = uint32(flags) 30 | } 31 | 32 | func (iov *Iovec) SetLen(length int) { 33 | iov.Len = uint64(length) 34 | } 35 | 36 | func (msghdr *Msghdr) SetControllen(length int) { 37 | msghdr.Controllen = uint32(length) 38 | } 39 | 40 | func (cmsg *Cmsghdr) SetLen(length int) { 41 | cmsg.Len = uint32(length) 42 | } 43 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_netbsd_arm.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build arm,netbsd 6 | 7 | package unix 8 | 9 | func Getpagesize() int { return 4096 } 10 | 11 | func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) } 12 | 13 | func NsecToTimespec(nsec int64) (ts Timespec) { 14 | ts.Sec = int64(nsec / 1e9) 15 | ts.Nsec = int32(nsec % 1e9) 16 | return 17 | } 18 | 19 | func NsecToTimeval(nsec int64) (tv Timeval) { 20 | nsec += 999 // round up to microsecond 21 | tv.Usec = int32(nsec % 1e9 / 1e3) 22 | tv.Sec = int64(nsec / 1e9) 23 | return 24 | } 25 | 26 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 27 | k.Ident = uint32(fd) 28 | k.Filter = uint32(mode) 29 | k.Flags = uint32(flags) 30 | } 31 | 32 | func (iov *Iovec) SetLen(length int) { 33 | iov.Len = uint32(length) 34 | } 35 | 36 | func (msghdr *Msghdr) SetControllen(length int) { 37 | msghdr.Controllen = uint32(length) 38 | } 39 | 40 | func (cmsg *Cmsghdr) SetLen(length int) { 41 | cmsg.Len = uint32(length) 42 | } 43 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_no_getwd.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build dragonfly freebsd netbsd openbsd 6 | 7 | package unix 8 | 9 | const ImplementsGetwd = false 10 | 11 | func Getwd() (string, error) { return "", ENOTSUP } 12 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_openbsd_386.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build 386,openbsd 6 | 7 | package unix 8 | 9 | func Getpagesize() int { return 4096 } 10 | 11 | func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) } 12 | 13 | func NsecToTimespec(nsec int64) (ts Timespec) { 14 | ts.Sec = int64(nsec / 1e9) 15 | ts.Nsec = int32(nsec % 1e9) 16 | return 17 | } 18 | 19 | func NsecToTimeval(nsec int64) (tv Timeval) { 20 | nsec += 999 // round up to microsecond 21 | tv.Usec = int32(nsec % 1e9 / 1e3) 22 | tv.Sec = int64(nsec / 1e9) 23 | return 24 | } 25 | 26 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 27 | k.Ident = uint32(fd) 28 | k.Filter = int16(mode) 29 | k.Flags = uint16(flags) 30 | } 31 | 32 | func (iov *Iovec) SetLen(length int) { 33 | iov.Len = uint32(length) 34 | } 35 | 36 | func (msghdr *Msghdr) SetControllen(length int) { 37 | msghdr.Controllen = uint32(length) 38 | } 39 | 40 | func (cmsg *Cmsghdr) SetLen(length int) { 41 | cmsg.Len = uint32(length) 42 | } 43 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_openbsd_amd64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build amd64,openbsd 6 | 7 | package unix 8 | 9 | func Getpagesize() int { return 4096 } 10 | 11 | func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) } 12 | 13 | func NsecToTimespec(nsec int64) (ts Timespec) { 14 | ts.Sec = nsec / 1e9 15 | ts.Nsec = nsec % 1e9 16 | return 17 | } 18 | 19 | func NsecToTimeval(nsec int64) (tv Timeval) { 20 | nsec += 999 // round up to microsecond 21 | tv.Usec = nsec % 1e9 / 1e3 22 | tv.Sec = nsec / 1e9 23 | return 24 | } 25 | 26 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 27 | k.Ident = uint64(fd) 28 | k.Filter = int16(mode) 29 | k.Flags = uint16(flags) 30 | } 31 | 32 | func (iov *Iovec) SetLen(length int) { 33 | iov.Len = uint64(length) 34 | } 35 | 36 | func (msghdr *Msghdr) SetControllen(length int) { 37 | msghdr.Controllen = uint32(length) 38 | } 39 | 40 | func (cmsg *Cmsghdr) SetLen(length int) { 41 | cmsg.Len = uint32(length) 42 | } 43 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_solaris_amd64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build amd64,solaris 6 | 7 | package unix 8 | 9 | func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) } 10 | 11 | func NsecToTimespec(nsec int64) (ts Timespec) { 12 | ts.Sec = nsec / 1e9 13 | ts.Nsec = nsec % 1e9 14 | return 15 | } 16 | 17 | func NsecToTimeval(nsec int64) (tv Timeval) { 18 | nsec += 999 // round up to microsecond 19 | tv.Usec = nsec % 1e9 / 1e3 20 | tv.Sec = int64(nsec / 1e9) 21 | return 22 | } 23 | 24 | func (iov *Iovec) SetLen(length int) { 25 | iov.Len = uint64(length) 26 | } 27 | 28 | func (cmsg *Cmsghdr) SetLen(length int) { 29 | cmsg.Len = uint32(length) 30 | } 31 | 32 | func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) { 33 | // TODO(aram): implement this, see issue 5847. 34 | panic("unimplemented") 35 | } 36 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_unix_gc.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build darwin dragonfly freebsd linux netbsd openbsd solaris 6 | // +build !gccgo 7 | 8 | package unix 9 | 10 | import "syscall" 11 | 12 | func Syscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.Errno) 13 | func Syscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err syscall.Errno) 14 | func RawSyscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.Errno) 15 | func RawSyscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err syscall.Errno) 16 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/zsysnum_solaris_amd64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build amd64,solaris 6 | 7 | package unix 8 | 9 | // TODO(aram): remove these before Go 1.3. 10 | const ( 11 | SYS_EXECVE = 59 12 | SYS_FCNTL = 62 13 | ) 14 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/windows/asm_windows_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 | // 6 | // System calls for 386, Windows are implemented in runtime/syscall_windows.goc 7 | // 8 | 9 | TEXT ·getprocaddress(SB), 7, $0-8 10 | JMP syscall·getprocaddress(SB) 11 | 12 | TEXT ·loadlibrary(SB), 7, $0-4 13 | JMP syscall·loadlibrary(SB) 14 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/windows/asm_windows_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 | // 6 | // System calls for amd64, Windows are implemented in runtime/syscall_windows.goc 7 | // 8 | 9 | TEXT ·getprocaddress(SB), 7, $0-32 10 | JMP syscall·getprocaddress(SB) 11 | 12 | TEXT ·loadlibrary(SB), 7, $0-8 13 | JMP syscall·loadlibrary(SB) 14 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/windows/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 windows 6 | // +build go1.4 7 | 8 | package windows 9 | 10 | import "syscall" 11 | 12 | func Unsetenv(key string) error { 13 | // This was added in Go 1.4. 14 | return syscall.Unsetenv(key) 15 | } 16 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/windows/env_windows.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 | // Windows environment variables. 6 | 7 | package windows 8 | 9 | import "syscall" 10 | 11 | func Getenv(key string) (value string, found bool) { 12 | return syscall.Getenv(key) 13 | } 14 | 15 | func Setenv(key, value string) error { 16 | return syscall.Setenv(key, value) 17 | } 18 | 19 | func Clearenv() { 20 | syscall.Clearenv() 21 | } 22 | 23 | func Environ() []string { 24 | return syscall.Environ() 25 | } 26 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/windows/eventlog.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 windows 6 | 7 | package windows 8 | 9 | const ( 10 | EVENTLOG_SUCCESS = 0 11 | EVENTLOG_ERROR_TYPE = 1 12 | EVENTLOG_WARNING_TYPE = 2 13 | EVENTLOG_INFORMATION_TYPE = 4 14 | EVENTLOG_AUDIT_SUCCESS = 8 15 | EVENTLOG_AUDIT_FAILURE = 16 16 | ) 17 | 18 | //sys RegisterEventSource(uncServerName *uint16, sourceName *uint16) (handle Handle, err error) [failretval==0] = advapi32.RegisterEventSourceW 19 | //sys DeregisterEventSource(handle Handle) (err error) = advapi32.DeregisterEventSource 20 | //sys ReportEvent(log Handle, etype uint16, category uint16, eventId uint32, usrSId uintptr, numStrings uint16, dataSize uint32, strings **uint16, rawData *byte) (err error) = advapi32.ReportEventW 21 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/windows/exec_windows.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 | // Fork, exec, wait, etc. 6 | 7 | package windows 8 | 9 | // EscapeArg rewrites command line argument s as prescribed 10 | // in http://msdn.microsoft.com/en-us/library/ms880421. 11 | // This function returns "" (2 double quotes) if s is empty. 12 | // Alternatively, these transformations are done: 13 | // - every back slash (\) is doubled, but only if immediately 14 | // followed by double quote ("); 15 | // - every double quote (") is escaped by back slash (\); 16 | // - finally, s is wrapped with double quotes (arg -> "arg"), 17 | // but only if there is space or tab inside s. 18 | func EscapeArg(s string) string { 19 | if len(s) == 0 { 20 | return "\"\"" 21 | } 22 | n := len(s) 23 | hasSpace := false 24 | for i := 0; i < len(s); i++ { 25 | switch s[i] { 26 | case '"', '\\': 27 | n++ 28 | case ' ', '\t': 29 | hasSpace = true 30 | } 31 | } 32 | if hasSpace { 33 | n += 2 34 | } 35 | if n == len(s) { 36 | return s 37 | } 38 | 39 | qs := make([]byte, n) 40 | j := 0 41 | if hasSpace { 42 | qs[j] = '"' 43 | j++ 44 | } 45 | slashes := 0 46 | for i := 0; i < len(s); i++ { 47 | switch s[i] { 48 | default: 49 | slashes = 0 50 | qs[j] = s[i] 51 | case '\\': 52 | slashes++ 53 | qs[j] = s[i] 54 | case '"': 55 | for ; slashes > 0; slashes-- { 56 | qs[j] = '\\' 57 | j++ 58 | } 59 | qs[j] = '\\' 60 | j++ 61 | qs[j] = s[i] 62 | } 63 | j++ 64 | } 65 | if hasSpace { 66 | for ; slashes > 0; slashes-- { 67 | qs[j] = '\\' 68 | j++ 69 | } 70 | qs[j] = '"' 71 | j++ 72 | } 73 | return string(qs[:j]) 74 | } 75 | 76 | func CloseOnExec(fd Handle) { 77 | SetHandleInformation(Handle(fd), HANDLE_FLAG_INHERIT, 0) 78 | } 79 | 80 | // FullPath retrieves the full path of the specified file. 81 | func FullPath(name string) (path string, err error) { 82 | p, err := UTF16PtrFromString(name) 83 | if err != nil { 84 | return "", err 85 | } 86 | n := uint32(100) 87 | for { 88 | buf := make([]uint16, n) 89 | n, err = GetFullPathName(p, uint32(len(buf)), &buf[0], nil) 90 | if err != nil { 91 | return "", err 92 | } 93 | if n <= uint32(len(buf)) { 94 | return UTF16ToString(buf[:n]), nil 95 | } 96 | } 97 | } 98 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/windows/memory_windows.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package windows 6 | 7 | const ( 8 | MEM_COMMIT = 0x00001000 9 | MEM_RESERVE = 0x00002000 10 | MEM_DECOMMIT = 0x00004000 11 | MEM_RELEASE = 0x00008000 12 | MEM_RESET = 0x00080000 13 | MEM_TOP_DOWN = 0x00100000 14 | MEM_WRITE_WATCH = 0x00200000 15 | MEM_PHYSICAL = 0x00400000 16 | MEM_RESET_UNDO = 0x01000000 17 | MEM_LARGE_PAGES = 0x20000000 18 | 19 | PAGE_NOACCESS = 0x01 20 | PAGE_READONLY = 0x02 21 | PAGE_READWRITE = 0x04 22 | PAGE_WRITECOPY = 0x08 23 | PAGE_EXECUTE_READ = 0x20 24 | PAGE_EXECUTE_READWRITE = 0x40 25 | PAGE_EXECUTE_WRITECOPY = 0x80 26 | ) 27 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/windows/mksyscall.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 windows 6 | 7 | //go:generate go run $GOROOT/src/syscall/mksyscall_windows.go -output zsyscall_windows.go eventlog.go service.go syscall_windows.go security_windows.go 8 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/windows/race.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 windows,race 6 | 7 | package windows 8 | 9 | import ( 10 | "runtime" 11 | "unsafe" 12 | ) 13 | 14 | const raceenabled = true 15 | 16 | func raceAcquire(addr unsafe.Pointer) { 17 | runtime.RaceAcquire(addr) 18 | } 19 | 20 | func raceReleaseMerge(addr unsafe.Pointer) { 21 | runtime.RaceReleaseMerge(addr) 22 | } 23 | 24 | func raceReadRange(addr unsafe.Pointer, len int) { 25 | runtime.RaceReadRange(addr, len) 26 | } 27 | 28 | func raceWriteRange(addr unsafe.Pointer, len int) { 29 | runtime.RaceWriteRange(addr, len) 30 | } 31 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/windows/race0.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 windows,!race 6 | 7 | package windows 8 | 9 | import ( 10 | "unsafe" 11 | ) 12 | 13 | const raceenabled = false 14 | 15 | func raceAcquire(addr unsafe.Pointer) { 16 | } 17 | 18 | func raceReleaseMerge(addr unsafe.Pointer) { 19 | } 20 | 21 | func raceReadRange(addr unsafe.Pointer, len int) { 22 | } 23 | 24 | func raceWriteRange(addr unsafe.Pointer, len int) { 25 | } 26 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/windows/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 windows 6 | 7 | package windows 8 | 9 | func itoa(val int) string { // do it here rather than with fmt to avoid dependency 10 | if val < 0 { 11 | return "-" + itoa(-val) 12 | } 13 | var buf [32]byte // big enough for int64 14 | i := len(buf) - 1 15 | for val >= 10 { 16 | buf[i] = byte(val%10 + '0') 17 | i-- 18 | val /= 10 19 | } 20 | buf[i] = byte(val + '0') 21 | return string(buf[i:]) 22 | } 23 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/windows/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 windows 6 | 7 | // Package windows 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 the OS-specific documentation for the current 10 | // system. If you want godoc to display syscall 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 windows // import "golang.org/x/sys/windows" 23 | 24 | import ( 25 | "syscall" 26 | ) 27 | 28 | // ByteSliceFromString returns a NUL-terminated slice of bytes 29 | // containing the text of s. If s contains a NUL byte at any 30 | // location, it returns (nil, syscall.EINVAL). 31 | func ByteSliceFromString(s string) ([]byte, error) { 32 | for i := 0; i < len(s); i++ { 33 | if s[i] == 0 { 34 | return nil, syscall.EINVAL 35 | } 36 | } 37 | a := make([]byte, len(s)+1) 38 | copy(a, s) 39 | return a, nil 40 | } 41 | 42 | // BytePtrFromString returns a pointer to a NUL-terminated array of 43 | // bytes containing the text of s. If s contains a NUL byte at any 44 | // location, it returns (nil, syscall.EINVAL). 45 | func BytePtrFromString(s string) (*byte, error) { 46 | a, err := ByteSliceFromString(s) 47 | if err != nil { 48 | return nil, err 49 | } 50 | return &a[0], nil 51 | } 52 | 53 | // Single-word zero for use when we need a valid pointer to 0 bytes. 54 | // See mksyscall.pl. 55 | var _zero uintptr 56 | 57 | func (ts *Timespec) Unix() (sec int64, nsec int64) { 58 | return int64(ts.Sec), int64(ts.Nsec) 59 | } 60 | 61 | func (tv *Timeval) Unix() (sec int64, nsec int64) { 62 | return int64(tv.Sec), int64(tv.Usec) * 1000 63 | } 64 | 65 | func (ts *Timespec) Nano() int64 { 66 | return int64(ts.Sec)*1e9 + int64(ts.Nsec) 67 | } 68 | 69 | func (tv *Timeval) Nano() int64 { 70 | return int64(tv.Sec)*1e9 + int64(tv.Usec)*1000 71 | } 72 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/windows/types_windows_386.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 windows 6 | 7 | type WSAData struct { 8 | Version uint16 9 | HighVersion uint16 10 | Description [WSADESCRIPTION_LEN + 1]byte 11 | SystemStatus [WSASYS_STATUS_LEN + 1]byte 12 | MaxSockets uint16 13 | MaxUdpDg uint16 14 | VendorInfo *byte 15 | } 16 | 17 | type Servent struct { 18 | Name *byte 19 | Aliases **byte 20 | Port uint16 21 | Proto *byte 22 | } 23 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/windows/types_windows_amd64.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 windows 6 | 7 | type WSAData struct { 8 | Version uint16 9 | HighVersion uint16 10 | MaxSockets uint16 11 | MaxUdpDg uint16 12 | VendorInfo *byte 13 | Description [WSADESCRIPTION_LEN + 1]byte 14 | SystemStatus [WSASYS_STATUS_LEN + 1]byte 15 | } 16 | 17 | type Servent struct { 18 | Name *byte 19 | Aliases **byte 20 | Proto *byte 21 | Port uint16 22 | } 23 | --------------------------------------------------------------------------------