├── .circleci └── config.yml ├── .gitignore ├── Gopkg.lock ├── Gopkg.toml ├── LICENSE ├── Makefile ├── README.md ├── anonymize-mysqldump.go ├── anonymize-mysqldump_test.go ├── bin └── test-file.sh ├── config.example.json ├── example_config.go ├── transformation-functions.go └── vendor ├── github.com ├── akamensky │ └── argparse │ │ ├── .gitignore │ │ ├── .travis.yml │ │ ├── LICENSE │ │ ├── README.md │ │ ├── argparse.go │ │ ├── argument.go │ │ ├── command.go │ │ ├── errors.go │ │ ├── extras.go │ │ └── sonar-project.properties ├── konsorten │ └── go-windows-terminal-sequences │ │ ├── LICENSE │ │ ├── README.md │ │ ├── go.mod │ │ ├── sequences.go │ │ └── sequences_dummy.go ├── sirupsen │ └── logrus │ │ ├── .gitignore │ │ ├── .travis.yml │ │ ├── CHANGELOG.md │ │ ├── LICENSE │ │ ├── README.md │ │ ├── alt_exit.go │ │ ├── appveyor.yml │ │ ├── doc.go │ │ ├── entry.go │ │ ├── exported.go │ │ ├── formatter.go │ │ ├── go.mod │ │ ├── go.sum │ │ ├── hooks.go │ │ ├── json_formatter.go │ │ ├── logger.go │ │ ├── logrus.go │ │ ├── terminal_check_appengine.go │ │ ├── terminal_check_bsd.go │ │ ├── terminal_check_no_terminal.go │ │ ├── terminal_check_notappengine.go │ │ ├── terminal_check_solaris.go │ │ ├── terminal_check_unix.go │ │ ├── terminal_check_windows.go │ │ ├── text_formatter.go │ │ └── writer.go └── xwb1989 │ └── sqlparser │ ├── .gitignore │ ├── .travis.yml │ ├── CONTRIBUTORS.md │ ├── LICENSE.md │ ├── Makefile │ ├── README.md │ ├── analyzer.go │ ├── ast.go │ ├── comments.go │ ├── dependency │ ├── bytes2 │ │ └── buffer.go │ ├── hack │ │ └── hack.go │ ├── querypb │ │ └── query.pb.go │ └── sqltypes │ │ ├── bind_variables.go │ │ ├── plan_value.go │ │ ├── testing.go │ │ ├── type.go │ │ └── value.go │ ├── encodable.go │ ├── impossible_query.go │ ├── normalizer.go │ ├── parsed_query.go │ ├── redact_query.go │ ├── sql.go │ ├── sql.y │ ├── token.go │ └── tracked_buffer.go ├── golang.org └── x │ └── sys │ ├── AUTHORS │ ├── CONTRIBUTORS │ ├── LICENSE │ ├── PATENTS │ └── unix │ ├── .gitignore │ ├── README.md │ ├── affinity_linux.go │ ├── aliases.go │ ├── asm_aix_ppc64.s │ ├── asm_darwin_386.s │ ├── asm_darwin_amd64.s │ ├── asm_darwin_arm.s │ ├── asm_darwin_arm64.s │ ├── asm_dragonfly_amd64.s │ ├── asm_freebsd_386.s │ ├── asm_freebsd_amd64.s │ ├── asm_freebsd_arm.s │ ├── asm_freebsd_arm64.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_riscv64.s │ ├── asm_linux_s390x.s │ ├── asm_netbsd_386.s │ ├── asm_netbsd_amd64.s │ ├── asm_netbsd_arm.s │ ├── asm_netbsd_arm64.s │ ├── asm_openbsd_386.s │ ├── asm_openbsd_amd64.s │ ├── asm_openbsd_arm.s │ ├── asm_openbsd_arm64.s │ ├── asm_solaris_amd64.s │ ├── bluetooth_linux.go │ ├── cap_freebsd.go │ ├── constants.go │ ├── dev_aix_ppc.go │ ├── dev_aix_ppc64.go │ ├── dev_darwin.go │ ├── dev_dragonfly.go │ ├── dev_freebsd.go │ ├── dev_linux.go │ ├── dev_netbsd.go │ ├── dev_openbsd.go │ ├── dirent.go │ ├── endian_big.go │ ├── endian_little.go │ ├── env_unix.go │ ├── errors_freebsd_386.go │ ├── errors_freebsd_amd64.go │ ├── errors_freebsd_arm.go │ ├── fcntl.go │ ├── fcntl_darwin.go │ ├── fcntl_linux_32bit.go │ ├── gccgo.go │ ├── gccgo_c.c │ ├── gccgo_linux_amd64.go │ ├── ioctl.go │ ├── mkall.sh │ ├── mkasm_darwin.go │ ├── mkerrors.sh │ ├── mkpost.go │ ├── mksyscall.go │ ├── mksyscall_aix_ppc.go │ ├── mksyscall_aix_ppc64.go │ ├── mksyscall_solaris.go │ ├── mksysctl_openbsd.go │ ├── mksysnum.go │ ├── pagesize_unix.go │ ├── pledge_openbsd.go │ ├── race.go │ ├── race0.go │ ├── readdirent_getdents.go │ ├── readdirent_getdirentries.go │ ├── sockcmsg_dragonfly.go │ ├── sockcmsg_linux.go │ ├── sockcmsg_unix.go │ ├── sockcmsg_unix_other.go │ ├── str.go │ ├── syscall.go │ ├── syscall_aix.go │ ├── syscall_aix_ppc.go │ ├── syscall_aix_ppc64.go │ ├── syscall_bsd.go │ ├── syscall_darwin.1_12.go │ ├── syscall_darwin.1_13.go │ ├── syscall_darwin.go │ ├── syscall_darwin_386.1_11.go │ ├── syscall_darwin_386.go │ ├── syscall_darwin_amd64.1_11.go │ ├── syscall_darwin_amd64.go │ ├── syscall_darwin_arm.1_11.go │ ├── syscall_darwin_arm.go │ ├── syscall_darwin_arm64.1_11.go │ ├── syscall_darwin_arm64.go │ ├── syscall_darwin_libSystem.go │ ├── syscall_dragonfly.go │ ├── syscall_dragonfly_amd64.go │ ├── syscall_freebsd.go │ ├── syscall_freebsd_386.go │ ├── syscall_freebsd_amd64.go │ ├── syscall_freebsd_arm.go │ ├── syscall_freebsd_arm64.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_gc.go │ ├── syscall_linux_gc_386.go │ ├── syscall_linux_gccgo_386.go │ ├── syscall_linux_gccgo_arm.go │ ├── syscall_linux_mips64x.go │ ├── syscall_linux_mipsx.go │ ├── syscall_linux_ppc64x.go │ ├── syscall_linux_riscv64.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_netbsd_arm64.go │ ├── syscall_openbsd.go │ ├── syscall_openbsd_386.go │ ├── syscall_openbsd_amd64.go │ ├── syscall_openbsd_arm.go │ ├── syscall_openbsd_arm64.go │ ├── syscall_solaris.go │ ├── syscall_solaris_amd64.go │ ├── syscall_unix.go │ ├── syscall_unix_gc.go │ ├── syscall_unix_gc_ppc64x.go │ ├── timestruct.go │ ├── types_aix.go │ ├── types_darwin.go │ ├── types_dragonfly.go │ ├── types_freebsd.go │ ├── types_netbsd.go │ ├── types_openbsd.go │ ├── types_solaris.go │ ├── unveil_openbsd.go │ ├── xattr_bsd.go │ ├── zerrors_aix_ppc.go │ ├── zerrors_aix_ppc64.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_freebsd_arm64.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_riscv64.go │ ├── zerrors_linux_s390x.go │ ├── zerrors_linux_sparc64.go │ ├── zerrors_netbsd_386.go │ ├── zerrors_netbsd_amd64.go │ ├── zerrors_netbsd_arm.go │ ├── zerrors_netbsd_arm64.go │ ├── zerrors_openbsd_386.go │ ├── zerrors_openbsd_amd64.go │ ├── zerrors_openbsd_arm.go │ ├── zerrors_openbsd_arm64.go │ ├── zerrors_solaris_amd64.go │ ├── zptrace386_linux.go │ ├── zptracearm_linux.go │ ├── zptracemips_linux.go │ ├── zptracemipsle_linux.go │ ├── zsyscall_aix_ppc.go │ ├── zsyscall_aix_ppc64.go │ ├── zsyscall_aix_ppc64_gc.go │ ├── zsyscall_aix_ppc64_gccgo.go │ ├── zsyscall_darwin_386.1_11.go │ ├── zsyscall_darwin_386.1_13.go │ ├── zsyscall_darwin_386.1_13.s │ ├── zsyscall_darwin_386.go │ ├── zsyscall_darwin_386.s │ ├── zsyscall_darwin_amd64.1_11.go │ ├── zsyscall_darwin_amd64.1_13.go │ ├── zsyscall_darwin_amd64.1_13.s │ ├── zsyscall_darwin_amd64.go │ ├── zsyscall_darwin_amd64.s │ ├── zsyscall_darwin_arm.1_11.go │ ├── zsyscall_darwin_arm.1_13.go │ ├── zsyscall_darwin_arm.1_13.s │ ├── zsyscall_darwin_arm.go │ ├── zsyscall_darwin_arm.s │ ├── zsyscall_darwin_arm64.1_11.go │ ├── zsyscall_darwin_arm64.1_13.go │ ├── zsyscall_darwin_arm64.1_13.s │ ├── zsyscall_darwin_arm64.go │ ├── zsyscall_darwin_arm64.s │ ├── zsyscall_dragonfly_amd64.go │ ├── zsyscall_freebsd_386.go │ ├── zsyscall_freebsd_amd64.go │ ├── zsyscall_freebsd_arm.go │ ├── zsyscall_freebsd_arm64.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_riscv64.go │ ├── zsyscall_linux_s390x.go │ ├── zsyscall_linux_sparc64.go │ ├── zsyscall_netbsd_386.go │ ├── zsyscall_netbsd_amd64.go │ ├── zsyscall_netbsd_arm.go │ ├── zsyscall_netbsd_arm64.go │ ├── zsyscall_openbsd_386.go │ ├── zsyscall_openbsd_amd64.go │ ├── zsyscall_openbsd_arm.go │ ├── zsyscall_openbsd_arm64.go │ ├── zsyscall_solaris_amd64.go │ ├── zsysctl_openbsd_386.go │ ├── zsysctl_openbsd_amd64.go │ ├── zsysctl_openbsd_arm.go │ ├── zsysctl_openbsd_arm64.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_freebsd_arm64.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_riscv64.go │ ├── zsysnum_linux_s390x.go │ ├── zsysnum_linux_sparc64.go │ ├── zsysnum_netbsd_386.go │ ├── zsysnum_netbsd_amd64.go │ ├── zsysnum_netbsd_arm.go │ ├── zsysnum_netbsd_arm64.go │ ├── zsysnum_openbsd_386.go │ ├── zsysnum_openbsd_amd64.go │ ├── zsysnum_openbsd_arm.go │ ├── zsysnum_openbsd_arm64.go │ ├── ztypes_aix_ppc.go │ ├── ztypes_aix_ppc64.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_freebsd_arm64.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_riscv64.go │ ├── ztypes_linux_s390x.go │ ├── ztypes_linux_sparc64.go │ ├── ztypes_netbsd_386.go │ ├── ztypes_netbsd_amd64.go │ ├── ztypes_netbsd_arm.go │ ├── ztypes_netbsd_arm64.go │ ├── ztypes_openbsd_386.go │ ├── ztypes_openbsd_amd64.go │ ├── ztypes_openbsd_arm.go │ ├── ztypes_openbsd_arm64.go │ └── ztypes_solaris_amd64.go └── syreclabs.com └── go └── faker ├── .travis.yml ├── LICENSE ├── README.md ├── address.go ├── app.go ├── avatar.go ├── bitcoin.go ├── business.go ├── code.go ├── commerce.go ├── company.go ├── date.go ├── faker.go ├── finance.go ├── go.mod ├── hacker.go ├── internet.go ├── locales ├── de-at.go ├── de-ch.go ├── de.go ├── en-au-ocker.go ├── en-au.go ├── en-bork.go ├── en-ca.go ├── en-gb.go ├── en-ind.go ├── en-nep.go ├── en-us.go ├── en.go ├── es.go ├── fa.go ├── fr.go ├── it.go ├── ja.go ├── ko.go ├── nb-no.go ├── nl.go ├── pl.go ├── pt-br.go ├── ru.go ├── sk.go ├── sv.go ├── vi.go ├── zh-cn.go ├── zh-tw.go └── zz_import_path.go ├── lorem.go ├── name.go ├── number.go ├── phone_number.go ├── team.go └── time.go /.circleci/config.yml: -------------------------------------------------------------------------------- 1 | # Golang CircleCI 2.0 configuration file 2 | # 3 | # Check https://circleci.com/docs/2.0/language-go/ for more details 4 | version: 2 5 | jobs: 6 | build: 7 | docker: 8 | # specify the version 9 | - image: circleci/golang:1.12 10 | 11 | #### TEMPLATE_NOTE: go expects specific checkout path representing url 12 | #### expecting it in the form of 13 | #### /go/src/github.com/circleci/go-tool 14 | #### /go/src/bitbucket.org/circleci/go-tool 15 | working_directory: /go/src/github.com/humanmade/go-anonymize-mysqldump 16 | steps: 17 | - checkout 18 | 19 | # specify any bash command here prefixed with `run: ` 20 | - run: make vet 21 | - run: make test 22 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | build 2 | -------------------------------------------------------------------------------- /Gopkg.lock: -------------------------------------------------------------------------------- 1 | # This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'. 2 | 3 | 4 | [[projects]] 5 | branch = "master" 6 | digest = "1:1dfdb9db4498d86614fae3f80a8403ec3904f185b0aa4017f9daef4592b4ac0b" 7 | name = "github.com/akamensky/argparse" 8 | packages = ["."] 9 | pruneopts = "UT" 10 | revision = "1427fe674291a5bc6e207d6bf968cb189205dc75" 11 | 12 | [[projects]] 13 | digest = "1:31e761d97c76151dde79e9d28964a812c46efc5baee4085b86f68f0c654450de" 14 | name = "github.com/konsorten/go-windows-terminal-sequences" 15 | packages = ["."] 16 | pruneopts = "UT" 17 | revision = "f55edac94c9bbba5d6182a4be46d86a2c9b5b50e" 18 | version = "v1.0.2" 19 | 20 | [[projects]] 21 | digest = "1:04457f9f6f3ffc5fea48e71d62f2ca256637dee0a04d710288e27e05c8b41976" 22 | name = "github.com/sirupsen/logrus" 23 | packages = ["."] 24 | pruneopts = "UT" 25 | revision = "839c75faf7f98a33d445d181f3018b5c3409a45e" 26 | version = "v1.4.2" 27 | 28 | [[projects]] 29 | branch = "master" 30 | digest = "1:c364e1046df58e7c1731edd337145461011d129bbb876932d9e5bbf105d07888" 31 | name = "github.com/xwb1989/sqlparser" 32 | packages = [ 33 | ".", 34 | "dependency/bytes2", 35 | "dependency/hack", 36 | "dependency/querypb", 37 | "dependency/sqltypes", 38 | ] 39 | pruneopts = "UT" 40 | revision = "120387863bf27d04bc07db8015110a6e96d0146c" 41 | 42 | [[projects]] 43 | branch = "master" 44 | digest = "1:70b2bf25c4ed23c61dae668e4151d87a7edc5965bc3ccfecd1b9fe5f1752092a" 45 | name = "golang.org/x/sys" 46 | packages = ["unix"] 47 | pruneopts = "UT" 48 | revision = "3e7259c5e7c2076bb2728047a3df75adb1bad8e5" 49 | 50 | [[projects]] 51 | digest = "1:bfba45a9ecebca541d3918aa796b02ecd14b708bab47061b22cb5849bc9ee844" 52 | name = "syreclabs.com/go/faker" 53 | packages = [ 54 | ".", 55 | "locales", 56 | ] 57 | pruneopts = "UT" 58 | revision = "ca5d017134d0604dc3ba912dd6de98d6b27b6444" 59 | version = "v1.2.0" 60 | 61 | [solve-meta] 62 | analyzer-name = "dep" 63 | analyzer-version = 1 64 | input-imports = [ 65 | "github.com/akamensky/argparse", 66 | "github.com/sirupsen/logrus", 67 | "github.com/xwb1989/sqlparser", 68 | "syreclabs.com/go/faker", 69 | ] 70 | solver-name = "gps-cdcl" 71 | solver-version = 1 72 | -------------------------------------------------------------------------------- /Gopkg.toml: -------------------------------------------------------------------------------- 1 | # Gopkg.toml example 2 | # 3 | # Refer to https://golang.github.io/dep/docs/Gopkg.toml.html 4 | # for detailed Gopkg.toml documentation. 5 | # 6 | # required = ["github.com/user/thing/cmd/thing"] 7 | # ignored = ["github.com/user/project/pkgX", "bitbucket.org/user/project/pkgA/pkgY"] 8 | # 9 | # [[constraint]] 10 | # name = "github.com/user/project" 11 | # version = "1.0.0" 12 | # 13 | # [[constraint]] 14 | # name = "github.com/user/project2" 15 | # branch = "dev" 16 | # source = "github.com/myfork/project2" 17 | # 18 | # [[override]] 19 | # name = "github.com/x/y" 20 | # version = "2.4.0" 21 | # 22 | # [prune] 23 | # non-go = false 24 | # go-tests = true 25 | # unused-packages = true 26 | 27 | 28 | [[constraint]] 29 | branch = "master" 30 | name = "github.com/xwb1989/sqlparser" 31 | 32 | [prune] 33 | go-tests = true 34 | unused-packages = true 35 | 36 | [[constraint]] 37 | name = "github.com/sirupsen/logrus" 38 | version = "1.4.2" 39 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | BINARY = go-anonymize-mysqldump 2 | BUILDDIR = ./build 3 | 4 | all: clean vet fmt lint test build 5 | 6 | build: 7 | gox -os="linux" -os="darwin" -os="windows" -arch="amd64" -arch="386" -output="${BUILDDIR}/${BINARY}_{{.OS}}_{{.Arch}}" 8 | gzip build/* 9 | 10 | vet: 11 | go get -v -t -d ./... 12 | 13 | fmt: 14 | gofmt -s -l . | grep -v vendor | tee /dev/stderr 15 | 16 | lint: 17 | golint ./... | grep -v vendor | tee /dev/stderr 18 | 19 | test: 20 | LOG_LEVEL=debug go test -v ./... 21 | go test -bench . 22 | 23 | test-watch: 24 | fswatch -0 *.go | xargs -0 -L 1 -I % sh -c 'LOG_LEVEL=debug go test -v ./...' 25 | 26 | run-test-watch: 27 | fswatch -0 *.go | xargs -0 -L 1 -I % sh -c 'LOG_LEVEL=debug go test -v -run $(TEST)' 28 | 29 | clean: 30 | rm -rf ${BUILDDIR} 31 | 32 | .PHONY: all clean vet fmt lint test build 33 | -------------------------------------------------------------------------------- /bin/test-file.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -eu 4 | 5 | FILE="$1" 6 | 7 | PACKAGE_FILE= 8 | TEST_FILE= 9 | 10 | if [[ "$FILE" == *"_test.go"* ]]; then 11 | TEST_FILE="$FILE" 12 | PACKAGE_FILE="$(echo "$FILE" | sed -E 's/_test\.go/.go/g')" 13 | else 14 | TEST_FILE="$(echo "$FILE" | sed -E 's/\.go/_test.go/g')" 15 | PACKAGE_FILE="$FILE" 16 | fi 17 | 18 | go test -v "$TEST_FILE" "$PACKAGE_FILE" 19 | -------------------------------------------------------------------------------- /example_config.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | var ExampleWordPressConfig = Config{ 4 | Patterns: []ConfigPattern{ 5 | { 6 | TableName: "wp_users", 7 | Fields: []PatternField{ 8 | { 9 | Field: "user_login", 10 | Type: "username", 11 | Position: 2, 12 | Constraints: nil, 13 | }, 14 | { 15 | Field: "user_pass", 16 | Type: "password", 17 | Position: 3, 18 | Constraints: nil, 19 | }, 20 | { 21 | Field: "user_nicename", 22 | Type: "username", 23 | Position: 4, 24 | Constraints: nil, 25 | }, 26 | { 27 | Field: "user_email", 28 | Type: "email", 29 | Position: 5, 30 | Constraints: nil, 31 | }, 32 | { 33 | Field: "user_url", 34 | Type: "url", 35 | Position: 6, 36 | Constraints: nil, 37 | }, 38 | { 39 | Field: "display_name", 40 | Type: "name", 41 | Position: 10, 42 | Constraints: nil, 43 | }, 44 | }, 45 | }, 46 | { 47 | TableName: "wp_usermeta", 48 | Fields: []PatternField{ 49 | { 50 | Field: "meta_value", 51 | Position: 4, 52 | Type: "firstName", 53 | Constraints: []PatternFieldConstraint{ 54 | { 55 | Field: "meta_key", 56 | Position: 3, 57 | Value: "first_name", 58 | }, 59 | }, 60 | }, 61 | { 62 | Field: "meta_value", 63 | Position: 4, 64 | Type: "lastName", 65 | Constraints: []PatternFieldConstraint{ 66 | { 67 | Field: "meta_key", 68 | Position: 3, 69 | Value: "last_name", 70 | }, 71 | }, 72 | }, 73 | { 74 | Field: "meta_value", 75 | Position: 4, 76 | Type: "firstName", 77 | Constraints: []PatternFieldConstraint{ 78 | { 79 | Field: "meta_key", 80 | Position: 3, 81 | Value: "nickname", 82 | }, 83 | }, 84 | }, 85 | { 86 | Field: "meta_value", 87 | Position: 4, 88 | Type: "paragraph", 89 | Constraints: []PatternFieldConstraint{ 90 | { 91 | Field: "meta_key", 92 | Position: 3, 93 | Value: "description", 94 | }, 95 | }, 96 | }, 97 | }, 98 | }, 99 | { 100 | TableName: "wp_comments", 101 | Fields: []PatternField{ 102 | { 103 | Field: "comment_author", 104 | Type: "username", 105 | Position: 3, 106 | Constraints: nil, 107 | }, 108 | { 109 | Field: "comment_author_email", 110 | Type: "email", 111 | Position: 4, 112 | Constraints: nil, 113 | }, 114 | { 115 | Field: "comment_author_url", 116 | Type: "url", 117 | Position: 5, 118 | Constraints: nil, 119 | }, 120 | { 121 | Field: "comment_author_IP", 122 | Type: "ipv4", 123 | Position: 6, 124 | Constraints: nil, 125 | }, 126 | }, 127 | }, 128 | }, 129 | } 130 | -------------------------------------------------------------------------------- /transformation-functions.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "github.com/xwb1989/sqlparser" 5 | "syreclabs.com/go/faker" 6 | ) 7 | 8 | func generateUsername(value *sqlparser.SQLVal) *sqlparser.SQLVal { 9 | return sqlparser.NewStrVal([]byte(faker.Internet().UserName())) 10 | } 11 | 12 | func generatePassword(value *sqlparser.SQLVal) *sqlparser.SQLVal { 13 | // TODO encrypt this value 14 | return sqlparser.NewStrVal([]byte(faker.Internet().Password(8, 14))) 15 | } 16 | 17 | func generateEmail(value *sqlparser.SQLVal) *sqlparser.SQLVal { 18 | return sqlparser.NewStrVal([]byte(faker.Internet().SafeEmail())) 19 | } 20 | 21 | func generateURL(value *sqlparser.SQLVal) *sqlparser.SQLVal { 22 | return sqlparser.NewStrVal([]byte(faker.Internet().Url())) 23 | } 24 | 25 | func generateName(value *sqlparser.SQLVal) *sqlparser.SQLVal { 26 | return sqlparser.NewStrVal([]byte(faker.Name().Name())) 27 | } 28 | 29 | func generateFirstName(value *sqlparser.SQLVal) *sqlparser.SQLVal { 30 | return sqlparser.NewStrVal([]byte(faker.Name().FirstName())) 31 | } 32 | 33 | func generateLastName(value *sqlparser.SQLVal) *sqlparser.SQLVal { 34 | return sqlparser.NewStrVal([]byte(faker.Name().LastName())) 35 | } 36 | 37 | func generateParagraph(value *sqlparser.SQLVal) *sqlparser.SQLVal { 38 | return sqlparser.NewStrVal([]byte(faker.Lorem().Sentence(3))) 39 | } 40 | 41 | func generateIPv4(value *sqlparser.SQLVal) *sqlparser.SQLVal { 42 | return sqlparser.NewStrVal([]byte(faker.Internet().IpV4Address())) 43 | } 44 | -------------------------------------------------------------------------------- /vendor/github.com/akamensky/argparse/.gitignore: -------------------------------------------------------------------------------- 1 | # Binaries for programs and plugins 2 | *.exe 3 | *.dll 4 | *.so 5 | *.dylib 6 | 7 | # Test binary, build with `go test -c` 8 | *.test 9 | 10 | # Output of the go coverage tool, specifically when used with LiteIDE 11 | *.out 12 | 13 | # Project-local glide cache, RE: https://github.com/Masterminds/glide/issues/736 14 | .glide/ 15 | 16 | .idea/ -------------------------------------------------------------------------------- /vendor/github.com/akamensky/argparse/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | sudo: false 3 | addons: 4 | sonarcloud: 5 | organization: "akamensky" 6 | token: 7 | secure: "UHOX/1aKjS292jywXbx4sWBaka1Bw7xJYAKRFo5wcadJMOBWVYmchNc5brAFkxsVpswnxmjnwtcGerjOV2t6Da5xUX3ST/p7REjKSSz5RmZ/Wa88z6g2PYlmoybqLAlgPmaBX+m5ZxGtaPo3joR+pUmjmUS2VF385UQLezuFbweSYZ90acBSr6kOw0xFQtc3UdW2NjUYM2ihmTCxFh0LwirZJnJCu0Zd1NQiaJOnvHp3nD83bU9PLaZbW308Kjl/cfIdEGf6CuzbeEILUoUqN9AAbAYFfr5HM28IPdzWRrp1krpb0P/OAmRMq18tLWx+AYmI2Y+Ud1AmqHZCNH5OqQYFU6XT7mkKT+Lh3ecNdcTKXRwQAiONj5EGHkbqi0q/kxWe/DEZOVJ51NjwHpjkKV1ByuAdWKXgXAwgftkQtw9+xkHrNSMgKonmcRXqcKy24jM9xOmwcbjMgh1dUoieerDv8midOJWVB538Cw6MH7f4j4ku8WC12YcDQElLoQFTuVjcAtYYGlXgVsfeXKi/I2fXwApKX0+O8ublWLgiNF7MljBHpbIffJCMD4APksIk7PwxYZzjdYJr4UgkLOTAyOH83BTVqVCANBQMLNP03UJIrtMzncB6J/b22ydw139GLx6a8tVdH6AtC2Y87CEWcvM/kA3OC9RK39MXP95tJKo=" 8 | go: 9 | - "1.11" 10 | - "1.12" 11 | - "1.13" 12 | - "tip" 13 | before_install: 14 | - go get github.com/mattn/goveralls 15 | script: 16 | - go test -v . 17 | - $GOPATH/bin/goveralls -service=travis-ci 18 | - sonar-scanner 19 | -------------------------------------------------------------------------------- /vendor/github.com/akamensky/argparse/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Alexey Kamenskiy 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /vendor/github.com/akamensky/argparse/command.go: -------------------------------------------------------------------------------- 1 | package argparse 2 | 3 | import ( 4 | "fmt" 5 | ) 6 | 7 | func (o *Command) help() { 8 | result := &help{} 9 | 10 | a := &arg{ 11 | result: &result, 12 | sname: "h", 13 | lname: "help", 14 | size: 1, 15 | opts: &Options{Help: "Print help information"}, 16 | unique: true, 17 | } 18 | 19 | o.addArg(a) 20 | } 21 | 22 | func (o *Command) addArg(a *arg) { 23 | if a.lname != "" { 24 | if a.sname == "" || len(a.sname) == 1 { 25 | // Search parents for overlapping commands and fail silently if any 26 | current := o 27 | for current != nil { 28 | if current.args != nil { 29 | for _, v := range current.args { 30 | if (a.sname != "" && a.sname == v.sname) || a.lname == v.lname { 31 | return 32 | } 33 | } 34 | } 35 | current = current.parent 36 | } 37 | a.parent = o 38 | o.args = append(o.args, a) 39 | } 40 | } 41 | } 42 | 43 | // Will parse provided list of arguments 44 | // common usage would be to pass directly os.Args 45 | func (o *Command) parse(args *[]string) error { 46 | // If we already been parsed do nothing 47 | if o.parsed { 48 | return nil 49 | } 50 | 51 | // If no arguments left to parse do nothing 52 | if len(*args) < 1 { 53 | return nil 54 | } 55 | 56 | // Parse only matching commands 57 | // But we always have to parse top level 58 | if o.name == "" { 59 | o.name = (*args)[0] 60 | } else { 61 | if o.name != (*args)[0] && o.parent != nil { 62 | return nil 63 | } 64 | } 65 | 66 | // Set happened status to true when command happend 67 | o.happened = true 68 | 69 | // Reduce arguments by removing Command name 70 | *args = (*args)[1:] 71 | 72 | // Parse subcommands if any 73 | if o.commands != nil && len(o.commands) > 0 { 74 | // If we have subcommands and 0 args left 75 | // that is an error of SubCommandError type 76 | if len(*args) < 1 { 77 | return newSubCommandError(o) 78 | } 79 | for _, v := range o.commands { 80 | err := v.parse(args) 81 | if err != nil { 82 | return err 83 | } 84 | } 85 | } 86 | 87 | // Iterate over the args 88 | for i := 0; i < len(o.args); i++ { 89 | oarg := o.args[i] 90 | for j := 0; j < len(*args); j++ { 91 | arg := (*args)[j] 92 | if arg == "" { 93 | continue 94 | } 95 | if oarg.check(arg) { 96 | if len(*args) < j+oarg.size { 97 | return fmt.Errorf("not enough arguments for %s", oarg.name()) 98 | } 99 | err := oarg.parse((*args)[j+1 : j+oarg.size]) 100 | if err != nil { 101 | return err 102 | } 103 | oarg.reduce(j, args) 104 | continue 105 | } 106 | } 107 | 108 | // Check if arg is required and not provided 109 | if oarg.opts != nil && oarg.opts.Required && !oarg.parsed { 110 | return fmt.Errorf("[%s] is required", oarg.name()) 111 | } 112 | 113 | // Check for argument default value and if provided try to type cast and assign 114 | if oarg.opts != nil && oarg.opts.Default != nil && !oarg.parsed { 115 | err := oarg.setDefault() 116 | if err != nil { 117 | return err 118 | } 119 | } 120 | } 121 | 122 | // Set parsed status to true and return quietly 123 | o.parsed = true 124 | return nil 125 | } 126 | -------------------------------------------------------------------------------- /vendor/github.com/akamensky/argparse/errors.go: -------------------------------------------------------------------------------- 1 | package argparse 2 | 3 | type subCommandError struct { 4 | error 5 | cmd *Command 6 | } 7 | 8 | func (e subCommandError) Error() string { 9 | return "[sub]Command required" 10 | } 11 | 12 | func newSubCommandError(cmd *Command) error { 13 | return subCommandError{cmd: cmd} 14 | } 15 | -------------------------------------------------------------------------------- /vendor/github.com/akamensky/argparse/extras.go: -------------------------------------------------------------------------------- 1 | package argparse 2 | 3 | import "strings" 4 | 5 | func getLastLine(input string) string { 6 | slice := strings.Split(input, "\n") 7 | return slice[len(slice)-1] 8 | } 9 | 10 | func addToLastLine(base string, add string, width int, padding int, canSplit bool) string { 11 | // If last line has less than 10% space left, do not try to fill in by splitting else just try to split 12 | hasTen := (width - len(getLastLine(base))) > width/10 13 | if len(getLastLine(base)+" "+add) >= width { 14 | if hasTen && canSplit { 15 | adds := strings.Split(add, " ") 16 | for _, v := range adds { 17 | base = addToLastLine(base, v, width, padding, false) 18 | } 19 | return base 20 | } 21 | base = base + "\n" + strings.Repeat(" ", padding) 22 | } 23 | base = base + " " + add 24 | return base 25 | } 26 | -------------------------------------------------------------------------------- /vendor/github.com/akamensky/argparse/sonar-project.properties: -------------------------------------------------------------------------------- 1 | sonar.projectKey=akamensky_argparse 2 | # this is the name and version displayed in the SonarCloud UI. 3 | sonar.projectName=argparse 4 | sonar.projectVersion=1.0 5 | 6 | # Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows. 7 | # This property is optional if sonar.modules is set. 8 | sonar.sources=. 9 | sonar.exclusions=examples/** 10 | 11 | # Source encoding 12 | sonar.sourceEncoding=UTF-8 13 | -------------------------------------------------------------------------------- /vendor/github.com/konsorten/go-windows-terminal-sequences/LICENSE: -------------------------------------------------------------------------------- 1 | (The MIT License) 2 | 3 | Copyright (c) 2017 marvin + konsorten GmbH (open-source@konsorten.de) 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 6 | 7 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 8 | 9 | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 10 | -------------------------------------------------------------------------------- /vendor/github.com/konsorten/go-windows-terminal-sequences/README.md: -------------------------------------------------------------------------------- 1 | # Windows Terminal Sequences 2 | 3 | This library allow for enabling Windows terminal color support for Go. 4 | 5 | See [Console Virtual Terminal Sequences](https://docs.microsoft.com/en-us/windows/console/console-virtual-terminal-sequences) for details. 6 | 7 | ## Usage 8 | 9 | ```go 10 | import ( 11 | "syscall" 12 | 13 | sequences "github.com/konsorten/go-windows-terminal-sequences" 14 | ) 15 | 16 | func main() { 17 | sequences.EnableVirtualTerminalProcessing(syscall.Stdout, true) 18 | } 19 | 20 | ``` 21 | 22 | ## Authors 23 | 24 | The tool is sponsored by the [marvin + konsorten GmbH](http://www.konsorten.de). 25 | 26 | We thank all the authors who provided code to this library: 27 | 28 | * Felix Kollmann 29 | * Nicolas Perraut 30 | 31 | ## License 32 | 33 | (The MIT License) 34 | 35 | Copyright (c) 2018 marvin + konsorten GmbH (open-source@konsorten.de) 36 | 37 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 38 | 39 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 40 | 41 | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 42 | -------------------------------------------------------------------------------- /vendor/github.com/konsorten/go-windows-terminal-sequences/go.mod: -------------------------------------------------------------------------------- 1 | module github.com/konsorten/go-windows-terminal-sequences 2 | -------------------------------------------------------------------------------- /vendor/github.com/konsorten/go-windows-terminal-sequences/sequences.go: -------------------------------------------------------------------------------- 1 | // +build windows 2 | 3 | package sequences 4 | 5 | import ( 6 | "syscall" 7 | "unsafe" 8 | ) 9 | 10 | var ( 11 | kernel32Dll *syscall.LazyDLL = syscall.NewLazyDLL("Kernel32.dll") 12 | setConsoleMode *syscall.LazyProc = kernel32Dll.NewProc("SetConsoleMode") 13 | ) 14 | 15 | func EnableVirtualTerminalProcessing(stream syscall.Handle, enable bool) error { 16 | const ENABLE_VIRTUAL_TERMINAL_PROCESSING uint32 = 0x4 17 | 18 | var mode uint32 19 | err := syscall.GetConsoleMode(syscall.Stdout, &mode) 20 | if err != nil { 21 | return err 22 | } 23 | 24 | if enable { 25 | mode |= ENABLE_VIRTUAL_TERMINAL_PROCESSING 26 | } else { 27 | mode &^= ENABLE_VIRTUAL_TERMINAL_PROCESSING 28 | } 29 | 30 | ret, _, err := setConsoleMode.Call(uintptr(unsafe.Pointer(stream)), uintptr(mode)) 31 | if ret == 0 { 32 | return err 33 | } 34 | 35 | return nil 36 | } 37 | -------------------------------------------------------------------------------- /vendor/github.com/konsorten/go-windows-terminal-sequences/sequences_dummy.go: -------------------------------------------------------------------------------- 1 | // +build linux darwin 2 | 3 | package sequences 4 | 5 | import ( 6 | "fmt" 7 | ) 8 | 9 | func EnableVirtualTerminalProcessing(stream uintptr, enable bool) error { 10 | return fmt.Errorf("windows only package") 11 | } 12 | -------------------------------------------------------------------------------- /vendor/github.com/sirupsen/logrus/.gitignore: -------------------------------------------------------------------------------- 1 | logrus 2 | vendor 3 | -------------------------------------------------------------------------------- /vendor/github.com/sirupsen/logrus/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | go_import_path: github.com/sirupsen/logrus 3 | git: 4 | depth: 1 5 | env: 6 | - GO111MODULE=on 7 | - GO111MODULE=off 8 | go: [ 1.11.x, 1.12.x ] 9 | os: [ linux, osx ] 10 | matrix: 11 | exclude: 12 | - go: 1.12.x 13 | env: GO111MODULE=off 14 | - go: 1.11.x 15 | os: osx 16 | install: 17 | - ./travis/install.sh 18 | - if [[ "$GO111MODULE" == "on" ]]; then go mod download; fi 19 | - if [[ "$GO111MODULE" == "off" ]]; then go get github.com/stretchr/testify/assert golang.org/x/sys/unix github.com/konsorten/go-windows-terminal-sequences; fi 20 | script: 21 | - ./travis/cross_build.sh 22 | - export GOMAXPROCS=4 23 | - export GORACE=halt_on_error=1 24 | - go test -race -v ./... 25 | - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then go test -race -v -tags appengine ./... ; fi 26 | -------------------------------------------------------------------------------- /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 appends a Logrus Exit handler to the list of handlers, 55 | // call logrus.Exit to invoke all handlers. The handlers will also be invoked when 56 | // any Fatal log entry is 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 | 66 | // DeferExitHandler prepends a Logrus Exit handler to the list of handlers, 67 | // call logrus.Exit to invoke all handlers. The handlers will also be invoked when 68 | // any Fatal log entry is made. 69 | // 70 | // This method is useful when a caller wishes to use logrus to log a fatal 71 | // message but also needs to gracefully shutdown. An example usecase could be 72 | // closing database connections, or sending a alert that the application is 73 | // closing. 74 | func DeferExitHandler(handler func()) { 75 | handlers = append([]func(){handler}, handlers...) 76 | } 77 | -------------------------------------------------------------------------------- /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 | // Default key names for the default fields 6 | const ( 7 | defaultTimestampFormat = time.RFC3339 8 | FieldKeyMsg = "msg" 9 | FieldKeyLevel = "level" 10 | FieldKeyTime = "time" 11 | FieldKeyLogrusError = "logrus_error" 12 | FieldKeyFunc = "func" 13 | FieldKeyFile = "file" 14 | ) 15 | 16 | // The Formatter interface is used to implement a custom Formatter. It takes an 17 | // `Entry`. It exposes all the fields, including the default ones: 18 | // 19 | // * `entry.Data["msg"]`. The message passed from Info, Warn, Error .. 20 | // * `entry.Data["time"]`. The timestamp. 21 | // * `entry.Data["level"]. The level the entry was logged at. 22 | // 23 | // Any additional fields added with `WithField` or `WithFields` are also in 24 | // `entry.Data`. Format is expected to return an array of bytes which are then 25 | // logged to `logger.Out`. 26 | type Formatter interface { 27 | Format(*Entry) ([]byte, error) 28 | } 29 | 30 | // This is to not silently overwrite `time`, `msg`, `func` and `level` fields when 31 | // dumping it. If this code wasn't there doing: 32 | // 33 | // logrus.WithField("level", 1).Info("hello") 34 | // 35 | // Would just silently drop the user provided level. Instead with this code 36 | // it'll logged as: 37 | // 38 | // {"level": "info", "fields.level": 1, "msg": "hello", "time": "..."} 39 | // 40 | // It's not exported because it's still using Data in an opinionated way. It's to 41 | // avoid code duplication between the two default formatters. 42 | func prefixFieldClashes(data Fields, fieldMap FieldMap, reportCaller bool) { 43 | timeKey := fieldMap.resolve(FieldKeyTime) 44 | if t, ok := data[timeKey]; ok { 45 | data["fields."+timeKey] = t 46 | delete(data, timeKey) 47 | } 48 | 49 | msgKey := fieldMap.resolve(FieldKeyMsg) 50 | if m, ok := data[msgKey]; ok { 51 | data["fields."+msgKey] = m 52 | delete(data, msgKey) 53 | } 54 | 55 | levelKey := fieldMap.resolve(FieldKeyLevel) 56 | if l, ok := data[levelKey]; ok { 57 | data["fields."+levelKey] = l 58 | delete(data, levelKey) 59 | } 60 | 61 | logrusErrKey := fieldMap.resolve(FieldKeyLogrusError) 62 | if l, ok := data[logrusErrKey]; ok { 63 | data["fields."+logrusErrKey] = l 64 | delete(data, logrusErrKey) 65 | } 66 | 67 | // If reportCaller is not set, 'func' will not conflict. 68 | if reportCaller { 69 | funcKey := fieldMap.resolve(FieldKeyFunc) 70 | if l, ok := data[funcKey]; ok { 71 | data["fields."+funcKey] = l 72 | } 73 | fileKey := fieldMap.resolve(FieldKeyFile) 74 | if l, ok := data[fileKey]; ok { 75 | data["fields."+fileKey] = l 76 | } 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /vendor/github.com/sirupsen/logrus/go.mod: -------------------------------------------------------------------------------- 1 | module github.com/sirupsen/logrus 2 | 3 | require ( 4 | github.com/davecgh/go-spew v1.1.1 // indirect 5 | github.com/konsorten/go-windows-terminal-sequences v1.0.1 6 | github.com/pmezard/go-difflib v1.0.0 // indirect 7 | github.com/stretchr/objx v0.1.1 // indirect 8 | github.com/stretchr/testify v1.2.2 9 | golang.org/x/sys v0.0.0-20190422165155-953cdadca894 10 | ) 11 | -------------------------------------------------------------------------------- /vendor/github.com/sirupsen/logrus/go.sum: -------------------------------------------------------------------------------- 1 | github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= 2 | github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= 3 | github.com/konsorten/go-windows-terminal-sequences v0.0.0-20180402223658-b729f2633dfe h1:CHRGQ8V7OlCYtwaKPJi3iA7J+YdNKdo8j7nG5IgDhjs= 4 | github.com/konsorten/go-windows-terminal-sequences v0.0.0-20180402223658-b729f2633dfe/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= 5 | github.com/konsorten/go-windows-terminal-sequences v1.0.1 h1:mweAR1A6xJ3oS2pRaGiHgQ4OO8tzTaLawm8vnODuwDk= 6 | github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= 7 | github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= 8 | github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= 9 | github.com/stretchr/objx v0.1.1 h1:2vfRuCMp5sSVIDSqO8oNnWJq7mPa6KVP3iPIwFBuy8A= 10 | github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= 11 | github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w= 12 | github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= 13 | golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33 h1:I6FyU15t786LL7oL/hn43zqTuEGr4PN7F4XJ1p4E3Y8= 14 | golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= 15 | golang.org/x/sys v0.0.0-20190422165155-953cdadca894 h1:Cz4ceDQGXuKRnVBDTS23GTn/pU5OE2C0WrNTOYK1Uuc= 16 | golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 17 | -------------------------------------------------------------------------------- /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/terminal_check_appengine.go: -------------------------------------------------------------------------------- 1 | // +build appengine 2 | 3 | package logrus 4 | 5 | import ( 6 | "io" 7 | ) 8 | 9 | func checkIfTerminal(w io.Writer) bool { 10 | return true 11 | } 12 | -------------------------------------------------------------------------------- /vendor/github.com/sirupsen/logrus/terminal_check_bsd.go: -------------------------------------------------------------------------------- 1 | // +build darwin dragonfly freebsd netbsd openbsd 2 | 3 | package logrus 4 | 5 | import "golang.org/x/sys/unix" 6 | 7 | const ioctlReadTermios = unix.TIOCGETA 8 | 9 | func isTerminal(fd int) bool { 10 | _, err := unix.IoctlGetTermios(fd, ioctlReadTermios) 11 | return err == nil 12 | } 13 | 14 | -------------------------------------------------------------------------------- /vendor/github.com/sirupsen/logrus/terminal_check_no_terminal.go: -------------------------------------------------------------------------------- 1 | // +build js nacl plan9 2 | 3 | package logrus 4 | 5 | import ( 6 | "io" 7 | ) 8 | 9 | func checkIfTerminal(w io.Writer) bool { 10 | return false 11 | } 12 | -------------------------------------------------------------------------------- /vendor/github.com/sirupsen/logrus/terminal_check_notappengine.go: -------------------------------------------------------------------------------- 1 | // +build !appengine,!js,!windows,!nacl,!plan9 2 | 3 | package logrus 4 | 5 | import ( 6 | "io" 7 | "os" 8 | ) 9 | 10 | func checkIfTerminal(w io.Writer) bool { 11 | switch v := w.(type) { 12 | case *os.File: 13 | return isTerminal(int(v.Fd())) 14 | default: 15 | return false 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /vendor/github.com/sirupsen/logrus/terminal_check_solaris.go: -------------------------------------------------------------------------------- 1 | package logrus 2 | 3 | import ( 4 | "golang.org/x/sys/unix" 5 | ) 6 | 7 | // IsTerminal returns true if the given file descriptor is a terminal. 8 | func isTerminal(fd int) bool { 9 | _, err := unix.IoctlGetTermio(fd, unix.TCGETA) 10 | return err == nil 11 | } 12 | -------------------------------------------------------------------------------- /vendor/github.com/sirupsen/logrus/terminal_check_unix.go: -------------------------------------------------------------------------------- 1 | // +build linux aix 2 | 3 | package logrus 4 | 5 | import "golang.org/x/sys/unix" 6 | 7 | const ioctlReadTermios = unix.TCGETS 8 | 9 | func isTerminal(fd int) bool { 10 | _, err := unix.IoctlGetTermios(fd, ioctlReadTermios) 11 | return err == nil 12 | } 13 | 14 | -------------------------------------------------------------------------------- /vendor/github.com/sirupsen/logrus/terminal_check_windows.go: -------------------------------------------------------------------------------- 1 | // +build !appengine,!js,windows 2 | 3 | package logrus 4 | 5 | import ( 6 | "io" 7 | "os" 8 | "syscall" 9 | 10 | sequences "github.com/konsorten/go-windows-terminal-sequences" 11 | ) 12 | 13 | func initTerminal(w io.Writer) { 14 | switch v := w.(type) { 15 | case *os.File: 16 | sequences.EnableVirtualTerminalProcessing(syscall.Handle(v.Fd()), true) 17 | } 18 | } 19 | 20 | func checkIfTerminal(w io.Writer) bool { 21 | var ret bool 22 | switch v := w.(type) { 23 | case *os.File: 24 | var mode uint32 25 | err := syscall.GetConsoleMode(syscall.Handle(v.Fd()), &mode) 26 | ret = (err == nil) 27 | default: 28 | ret = false 29 | } 30 | if ret { 31 | initTerminal(w) 32 | } 33 | return ret 34 | } 35 | -------------------------------------------------------------------------------- /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 TraceLevel: 28 | printFunc = entry.Trace 29 | case DebugLevel: 30 | printFunc = entry.Debug 31 | case InfoLevel: 32 | printFunc = entry.Info 33 | case WarnLevel: 34 | printFunc = entry.Warn 35 | case ErrorLevel: 36 | printFunc = entry.Error 37 | case FatalLevel: 38 | printFunc = entry.Fatal 39 | case PanicLevel: 40 | printFunc = entry.Panic 41 | default: 42 | printFunc = entry.Print 43 | } 44 | 45 | go entry.writerScanner(reader, printFunc) 46 | runtime.SetFinalizer(writer, writerFinalizer) 47 | 48 | return writer 49 | } 50 | 51 | func (entry *Entry) writerScanner(reader *io.PipeReader, printFunc func(args ...interface{})) { 52 | scanner := bufio.NewScanner(reader) 53 | for scanner.Scan() { 54 | printFunc(scanner.Text()) 55 | } 56 | if err := scanner.Err(); err != nil { 57 | entry.Errorf("Error while reading from Writer: %s", err) 58 | } 59 | reader.Close() 60 | } 61 | 62 | func writerFinalizer(writer *io.PipeWriter) { 63 | writer.Close() 64 | } 65 | -------------------------------------------------------------------------------- /vendor/github.com/xwb1989/sqlparser/.gitignore: -------------------------------------------------------------------------------- 1 | y.output 2 | -------------------------------------------------------------------------------- /vendor/github.com/xwb1989/sqlparser/.travis.yml: -------------------------------------------------------------------------------- 1 | dist: trusty 2 | sudo: false 3 | 4 | language: go 5 | go: 6 | - 1.6.x 7 | - 1.7.x 8 | - 1.8.x 9 | - 1.9.x 10 | 11 | before_install: 12 | - go get github.com/mattn/goveralls 13 | - go get golang.org/x/tools/cmd/cover 14 | - go install golang.org/x/tools/cmd/goyacc 15 | 16 | script: 17 | - travis_retry $HOME/gopath/bin/goveralls -service=travis-ci 18 | -------------------------------------------------------------------------------- /vendor/github.com/xwb1989/sqlparser/CONTRIBUTORS.md: -------------------------------------------------------------------------------- 1 | This project is originally a fork of [https://github.com/youtube/vitess](https://github.com/youtube/vitess) 2 | Copyright Google Inc 3 | 4 | # Contributors 5 | Wenbin Xiao 2015 6 | Started this project and maintained it. 7 | 8 | Andrew Brampton 2017 9 | Merged in multiple upstream fixes/changes. -------------------------------------------------------------------------------- /vendor/github.com/xwb1989/sqlparser/Makefile: -------------------------------------------------------------------------------- 1 | # Copyright 2017 Google 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 | MAKEFLAGS = -s 16 | 17 | sql.go: sql.y 18 | goyacc -o sql.go sql.y 19 | gofmt -w sql.go 20 | 21 | clean: 22 | rm -f y.output sql.go 23 | -------------------------------------------------------------------------------- /vendor/github.com/xwb1989/sqlparser/dependency/bytes2/buffer.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2017 Google Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package bytes2 18 | 19 | // Buffer implements a subset of the write portion of 20 | // bytes.Buffer, but more efficiently. This is meant to 21 | // be used in very high QPS operations, especially for 22 | // WriteByte, and without abstracting it as a Writer. 23 | // Function signatures contain errors for compatibility, 24 | // but they do not return errors. 25 | type Buffer struct { 26 | bytes []byte 27 | } 28 | 29 | // NewBuffer is equivalent to bytes.NewBuffer. 30 | func NewBuffer(b []byte) *Buffer { 31 | return &Buffer{bytes: b} 32 | } 33 | 34 | // Write is equivalent to bytes.Buffer.Write. 35 | func (buf *Buffer) Write(b []byte) (int, error) { 36 | buf.bytes = append(buf.bytes, b...) 37 | return len(b), nil 38 | } 39 | 40 | // WriteString is equivalent to bytes.Buffer.WriteString. 41 | func (buf *Buffer) WriteString(s string) (int, error) { 42 | buf.bytes = append(buf.bytes, s...) 43 | return len(s), nil 44 | } 45 | 46 | // WriteByte is equivalent to bytes.Buffer.WriteByte. 47 | func (buf *Buffer) WriteByte(b byte) error { 48 | buf.bytes = append(buf.bytes, b) 49 | return nil 50 | } 51 | 52 | // Bytes is equivalent to bytes.Buffer.Bytes. 53 | func (buf *Buffer) Bytes() []byte { 54 | return buf.bytes 55 | } 56 | 57 | // Strings is equivalent to bytes.Buffer.Strings. 58 | func (buf *Buffer) String() string { 59 | return string(buf.bytes) 60 | } 61 | 62 | // Len is equivalent to bytes.Buffer.Len. 63 | func (buf *Buffer) Len() int { 64 | return len(buf.bytes) 65 | } 66 | -------------------------------------------------------------------------------- /vendor/github.com/xwb1989/sqlparser/dependency/hack/hack.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2017 Google Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Package hack gives you some efficient functionality at the cost of 18 | // breaking some Go rules. 19 | package hack 20 | 21 | import ( 22 | "reflect" 23 | "unsafe" 24 | ) 25 | 26 | // StringArena lets you consolidate allocations for a group of strings 27 | // that have similar life length 28 | type StringArena struct { 29 | buf []byte 30 | str string 31 | } 32 | 33 | // NewStringArena creates an arena of the specified size. 34 | func NewStringArena(size int) *StringArena { 35 | sa := &StringArena{buf: make([]byte, 0, size)} 36 | pbytes := (*reflect.SliceHeader)(unsafe.Pointer(&sa.buf)) 37 | pstring := (*reflect.StringHeader)(unsafe.Pointer(&sa.str)) 38 | pstring.Data = pbytes.Data 39 | pstring.Len = pbytes.Cap 40 | return sa 41 | } 42 | 43 | // NewString copies a byte slice into the arena and returns it as a string. 44 | // If the arena is full, it returns a traditional go string. 45 | func (sa *StringArena) NewString(b []byte) string { 46 | if len(b) == 0 { 47 | return "" 48 | } 49 | if len(sa.buf)+len(b) > cap(sa.buf) { 50 | return string(b) 51 | } 52 | start := len(sa.buf) 53 | sa.buf = append(sa.buf, b...) 54 | return sa.str[start : start+len(b)] 55 | } 56 | 57 | // SpaceLeft returns the amount of space left in the arena. 58 | func (sa *StringArena) SpaceLeft() int { 59 | return cap(sa.buf) - len(sa.buf) 60 | } 61 | 62 | // String force casts a []byte to a string. 63 | // USE AT YOUR OWN RISK 64 | func String(b []byte) (s string) { 65 | if len(b) == 0 { 66 | return "" 67 | } 68 | pbytes := (*reflect.SliceHeader)(unsafe.Pointer(&b)) 69 | pstring := (*reflect.StringHeader)(unsafe.Pointer(&s)) 70 | pstring.Data = pbytes.Data 71 | pstring.Len = pbytes.Len 72 | return 73 | } 74 | 75 | // StringPointer returns &s[0], which is not allowed in go 76 | func StringPointer(s string) unsafe.Pointer { 77 | pstring := (*reflect.StringHeader)(unsafe.Pointer(&s)) 78 | return unsafe.Pointer(pstring.Data) 79 | } 80 | -------------------------------------------------------------------------------- /vendor/github.com/xwb1989/sqlparser/encodable.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2017 Google Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package sqlparser 18 | 19 | import ( 20 | "bytes" 21 | 22 | "github.com/xwb1989/sqlparser/dependency/sqltypes" 23 | ) 24 | 25 | // This file contains types that are 'Encodable'. 26 | 27 | // Encodable defines the interface for types that can 28 | // be custom-encoded into SQL. 29 | type Encodable interface { 30 | EncodeSQL(buf *bytes.Buffer) 31 | } 32 | 33 | // InsertValues is a custom SQL encoder for the values of 34 | // an insert statement. 35 | type InsertValues [][]sqltypes.Value 36 | 37 | // EncodeSQL performs the SQL encoding for InsertValues. 38 | func (iv InsertValues) EncodeSQL(buf *bytes.Buffer) { 39 | for i, rows := range iv { 40 | if i != 0 { 41 | buf.WriteString(", ") 42 | } 43 | buf.WriteByte('(') 44 | for j, bv := range rows { 45 | if j != 0 { 46 | buf.WriteString(", ") 47 | } 48 | bv.EncodeSQL(buf) 49 | } 50 | buf.WriteByte(')') 51 | } 52 | } 53 | 54 | // TupleEqualityList is for generating equality constraints 55 | // for tables that have composite primary keys. 56 | type TupleEqualityList struct { 57 | Columns []ColIdent 58 | Rows [][]sqltypes.Value 59 | } 60 | 61 | // EncodeSQL generates the where clause constraints for the tuple 62 | // equality. 63 | func (tpl *TupleEqualityList) EncodeSQL(buf *bytes.Buffer) { 64 | if len(tpl.Columns) == 1 { 65 | tpl.encodeAsIn(buf) 66 | return 67 | } 68 | tpl.encodeAsEquality(buf) 69 | } 70 | 71 | func (tpl *TupleEqualityList) encodeAsIn(buf *bytes.Buffer) { 72 | Append(buf, tpl.Columns[0]) 73 | buf.WriteString(" in (") 74 | for i, r := range tpl.Rows { 75 | if i != 0 { 76 | buf.WriteString(", ") 77 | } 78 | r[0].EncodeSQL(buf) 79 | } 80 | buf.WriteByte(')') 81 | } 82 | 83 | func (tpl *TupleEqualityList) encodeAsEquality(buf *bytes.Buffer) { 84 | for i, r := range tpl.Rows { 85 | if i != 0 { 86 | buf.WriteString(" or ") 87 | } 88 | buf.WriteString("(") 89 | for j, c := range tpl.Columns { 90 | if j != 0 { 91 | buf.WriteString(" and ") 92 | } 93 | Append(buf, c) 94 | buf.WriteString(" = ") 95 | r[j].EncodeSQL(buf) 96 | } 97 | buf.WriteByte(')') 98 | } 99 | } 100 | -------------------------------------------------------------------------------- /vendor/github.com/xwb1989/sqlparser/impossible_query.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2017 Google Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreedto in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package sqlparser 18 | 19 | // FormatImpossibleQuery creates an impossible query in a TrackedBuffer. 20 | // An impossible query is a modified version of a query where all selects have where clauses that are 21 | // impossible for mysql to resolve. This is used in the vtgate and vttablet: 22 | // 23 | // - In the vtgate it's used for joins: if the first query returns no result, then vtgate uses the impossible 24 | // query just to fetch field info from vttablet 25 | // - In the vttablet, it's just an optimization: the field info is fetched once form MySQL, cached and reused 26 | // for subsequent queries 27 | func FormatImpossibleQuery(buf *TrackedBuffer, node SQLNode) { 28 | switch node := node.(type) { 29 | case *Select: 30 | buf.Myprintf("select %v from %v where 1 != 1", node.SelectExprs, node.From) 31 | if node.GroupBy != nil { 32 | node.GroupBy.Format(buf) 33 | } 34 | case *Union: 35 | buf.Myprintf("%v %s %v", node.Left, node.Type, node.Right) 36 | default: 37 | node.Format(buf) 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /vendor/github.com/xwb1989/sqlparser/redact_query.go: -------------------------------------------------------------------------------- 1 | package sqlparser 2 | 3 | import querypb "github.com/xwb1989/sqlparser/dependency/querypb" 4 | 5 | // RedactSQLQuery returns a sql string with the params stripped out for display 6 | func RedactSQLQuery(sql string) (string, error) { 7 | bv := map[string]*querypb.BindVariable{} 8 | sqlStripped, comments := SplitMarginComments(sql) 9 | 10 | stmt, err := Parse(sqlStripped) 11 | if err != nil { 12 | return "", err 13 | } 14 | 15 | prefix := "redacted" 16 | Normalize(stmt, bv, prefix) 17 | 18 | return comments.Leading + String(stmt) + comments.Trailing, nil 19 | } 20 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/AUTHORS: -------------------------------------------------------------------------------- 1 | # This source code refers to The Go Authors for copyright purposes. 2 | # The master list of authors is in the main Go distribution, 3 | # visible at http://tip.golang.org/AUTHORS. 4 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/CONTRIBUTORS: -------------------------------------------------------------------------------- 1 | # This source code was written by the Go contributors. 2 | # The master list of contributors is in the main Go distribution, 3 | # visible at http://tip.golang.org/CONTRIBUTORS. 4 | -------------------------------------------------------------------------------- /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/.gitignore: -------------------------------------------------------------------------------- 1 | _obj/ 2 | unix.test 3 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/affinity_linux.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // CPU affinity functions 6 | 7 | package unix 8 | 9 | import ( 10 | "math/bits" 11 | "unsafe" 12 | ) 13 | 14 | const cpuSetSize = _CPU_SETSIZE / _NCPUBITS 15 | 16 | // CPUSet represents a CPU affinity mask. 17 | type CPUSet [cpuSetSize]cpuMask 18 | 19 | func schedAffinity(trap uintptr, pid int, set *CPUSet) error { 20 | _, _, e := RawSyscall(trap, uintptr(pid), uintptr(unsafe.Sizeof(*set)), uintptr(unsafe.Pointer(set))) 21 | if e != 0 { 22 | return errnoErr(e) 23 | } 24 | return nil 25 | } 26 | 27 | // SchedGetaffinity gets the CPU affinity mask of the thread specified by pid. 28 | // If pid is 0 the calling thread is used. 29 | func SchedGetaffinity(pid int, set *CPUSet) error { 30 | return schedAffinity(SYS_SCHED_GETAFFINITY, pid, set) 31 | } 32 | 33 | // SchedSetaffinity sets the CPU affinity mask of the thread specified by pid. 34 | // If pid is 0 the calling thread is used. 35 | func SchedSetaffinity(pid int, set *CPUSet) error { 36 | return schedAffinity(SYS_SCHED_SETAFFINITY, pid, set) 37 | } 38 | 39 | // Zero clears the set s, so that it contains no CPUs. 40 | func (s *CPUSet) Zero() { 41 | for i := range s { 42 | s[i] = 0 43 | } 44 | } 45 | 46 | func cpuBitsIndex(cpu int) int { 47 | return cpu / _NCPUBITS 48 | } 49 | 50 | func cpuBitsMask(cpu int) cpuMask { 51 | return cpuMask(1 << (uint(cpu) % _NCPUBITS)) 52 | } 53 | 54 | // Set adds cpu to the set s. 55 | func (s *CPUSet) Set(cpu int) { 56 | i := cpuBitsIndex(cpu) 57 | if i < len(s) { 58 | s[i] |= cpuBitsMask(cpu) 59 | } 60 | } 61 | 62 | // Clear removes cpu from the set s. 63 | func (s *CPUSet) Clear(cpu int) { 64 | i := cpuBitsIndex(cpu) 65 | if i < len(s) { 66 | s[i] &^= cpuBitsMask(cpu) 67 | } 68 | } 69 | 70 | // IsSet reports whether cpu is in the set s. 71 | func (s *CPUSet) IsSet(cpu int) bool { 72 | i := cpuBitsIndex(cpu) 73 | if i < len(s) { 74 | return s[i]&cpuBitsMask(cpu) != 0 75 | } 76 | return false 77 | } 78 | 79 | // Count returns the number of CPUs in the set s. 80 | func (s *CPUSet) Count() int { 81 | c := 0 82 | for _, b := range s { 83 | c += bits.OnesCount64(uint64(b)) 84 | } 85 | return c 86 | } 87 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/aliases.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build aix darwin dragonfly freebsd linux netbsd openbsd solaris 6 | // +build go1.9 7 | 8 | package unix 9 | 10 | import "syscall" 11 | 12 | type Signal = syscall.Signal 13 | type Errno = syscall.Errno 14 | type SysProcAttr = syscall.SysProcAttr 15 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_aix_ppc64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System calls for ppc64, AIX are implemented in runtime/syscall_aix.go 11 | // 12 | 13 | TEXT ·syscall6(SB),NOSPLIT,$0-88 14 | JMP syscall·syscall6(SB) 15 | 16 | TEXT ·rawSyscall6(SB),NOSPLIT,$0-88 17 | JMP syscall·rawSyscall6(SB) 18 | -------------------------------------------------------------------------------- /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-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_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_freebsd_arm64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for ARM64, 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_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 | // See ../runtime/sys_linux_386.s for the reason why we always use int 0x80 14 | // instead of the glibc-specific "CALL 0x10(GS)". 15 | #define INVOKE_SYSCALL INT $0x80 16 | 17 | // Just jump to package syscall's implementation for all these functions. 18 | // The runtime may know about them. 19 | 20 | TEXT ·Syscall(SB),NOSPLIT,$0-28 21 | JMP syscall·Syscall(SB) 22 | 23 | TEXT ·Syscall6(SB),NOSPLIT,$0-40 24 | JMP syscall·Syscall6(SB) 25 | 26 | TEXT ·SyscallNoError(SB),NOSPLIT,$0-24 27 | CALL runtime·entersyscall(SB) 28 | MOVL trap+0(FP), AX // syscall entry 29 | MOVL a1+4(FP), BX 30 | MOVL a2+8(FP), CX 31 | MOVL a3+12(FP), DX 32 | MOVL $0, SI 33 | MOVL $0, DI 34 | INVOKE_SYSCALL 35 | MOVL AX, r1+16(FP) 36 | MOVL DX, r2+20(FP) 37 | CALL runtime·exitsyscall(SB) 38 | RET 39 | 40 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28 41 | JMP syscall·RawSyscall(SB) 42 | 43 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 44 | JMP syscall·RawSyscall6(SB) 45 | 46 | TEXT ·RawSyscallNoError(SB),NOSPLIT,$0-24 47 | MOVL trap+0(FP), AX // syscall entry 48 | MOVL a1+4(FP), BX 49 | MOVL a2+8(FP), CX 50 | MOVL a3+12(FP), DX 51 | MOVL $0, SI 52 | MOVL $0, DI 53 | INVOKE_SYSCALL 54 | MOVL AX, r1+16(FP) 55 | MOVL DX, r2+20(FP) 56 | RET 57 | 58 | TEXT ·socketcall(SB),NOSPLIT,$0-36 59 | JMP syscall·socketcall(SB) 60 | 61 | TEXT ·rawsocketcall(SB),NOSPLIT,$0-36 62 | JMP syscall·rawsocketcall(SB) 63 | 64 | TEXT ·seek(SB),NOSPLIT,$0-28 65 | JMP syscall·seek(SB) 66 | -------------------------------------------------------------------------------- /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 ·SyscallNoError(SB),NOSPLIT,$0-48 23 | CALL runtime·entersyscall(SB) 24 | MOVQ a1+8(FP), DI 25 | MOVQ a2+16(FP), SI 26 | MOVQ a3+24(FP), DX 27 | MOVQ $0, R10 28 | MOVQ $0, R8 29 | MOVQ $0, R9 30 | MOVQ trap+0(FP), AX // syscall entry 31 | SYSCALL 32 | MOVQ AX, r1+32(FP) 33 | MOVQ DX, r2+40(FP) 34 | CALL runtime·exitsyscall(SB) 35 | RET 36 | 37 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 38 | JMP syscall·RawSyscall(SB) 39 | 40 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 41 | JMP syscall·RawSyscall6(SB) 42 | 43 | TEXT ·RawSyscallNoError(SB),NOSPLIT,$0-48 44 | MOVQ a1+8(FP), DI 45 | MOVQ a2+16(FP), SI 46 | MOVQ a3+24(FP), DX 47 | MOVQ $0, R10 48 | MOVQ $0, R8 49 | MOVQ $0, R9 50 | MOVQ trap+0(FP), AX // syscall entry 51 | SYSCALL 52 | MOVQ AX, r1+32(FP) 53 | MOVQ DX, r2+40(FP) 54 | RET 55 | 56 | TEXT ·gettimeofday(SB),NOSPLIT,$0-16 57 | JMP syscall·gettimeofday(SB) 58 | -------------------------------------------------------------------------------- /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 ·SyscallNoError(SB),NOSPLIT,$0-24 23 | BL runtime·entersyscall(SB) 24 | MOVW trap+0(FP), R7 25 | MOVW a1+4(FP), R0 26 | MOVW a2+8(FP), R1 27 | MOVW a3+12(FP), R2 28 | MOVW $0, R3 29 | MOVW $0, R4 30 | MOVW $0, R5 31 | SWI $0 32 | MOVW R0, r1+16(FP) 33 | MOVW $0, R0 34 | MOVW R0, r2+20(FP) 35 | BL runtime·exitsyscall(SB) 36 | RET 37 | 38 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28 39 | B syscall·RawSyscall(SB) 40 | 41 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 42 | B syscall·RawSyscall6(SB) 43 | 44 | TEXT ·RawSyscallNoError(SB),NOSPLIT,$0-24 45 | MOVW trap+0(FP), R7 // syscall entry 46 | MOVW a1+4(FP), R0 47 | MOVW a2+8(FP), R1 48 | MOVW a3+12(FP), R2 49 | SWI $0 50 | MOVW R0, r1+16(FP) 51 | MOVW $0, R0 52 | MOVW R0, r2+20(FP) 53 | RET 54 | 55 | TEXT ·seek(SB),NOSPLIT,$0-28 56 | B syscall·seek(SB) 57 | -------------------------------------------------------------------------------- /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 ·SyscallNoError(SB),NOSPLIT,$0-48 21 | BL runtime·entersyscall(SB) 22 | MOVD a1+8(FP), R0 23 | MOVD a2+16(FP), R1 24 | MOVD a3+24(FP), R2 25 | MOVD $0, R3 26 | MOVD $0, R4 27 | MOVD $0, R5 28 | MOVD trap+0(FP), R8 // syscall entry 29 | SVC 30 | MOVD R0, r1+32(FP) // r1 31 | MOVD R1, r2+40(FP) // r2 32 | BL runtime·exitsyscall(SB) 33 | RET 34 | 35 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 36 | B syscall·RawSyscall(SB) 37 | 38 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 39 | B syscall·RawSyscall6(SB) 40 | 41 | TEXT ·RawSyscallNoError(SB),NOSPLIT,$0-48 42 | MOVD a1+8(FP), R0 43 | MOVD a2+16(FP), R1 44 | MOVD a3+24(FP), R2 45 | MOVD $0, R3 46 | MOVD $0, R4 47 | MOVD $0, R5 48 | MOVD trap+0(FP), R8 // syscall entry 49 | SVC 50 | MOVD R0, r1+32(FP) 51 | MOVD R1, r2+40(FP) 52 | RET 53 | -------------------------------------------------------------------------------- /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 ·SyscallNoError(SB),NOSPLIT,$0-48 25 | JAL runtime·entersyscall(SB) 26 | MOVV a1+8(FP), R4 27 | MOVV a2+16(FP), R5 28 | MOVV a3+24(FP), R6 29 | MOVV R0, R7 30 | MOVV R0, R8 31 | MOVV R0, R9 32 | MOVV trap+0(FP), R2 // syscall entry 33 | SYSCALL 34 | MOVV R2, r1+32(FP) 35 | MOVV R3, r2+40(FP) 36 | JAL runtime·exitsyscall(SB) 37 | RET 38 | 39 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 40 | JMP syscall·RawSyscall(SB) 41 | 42 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 43 | JMP syscall·RawSyscall6(SB) 44 | 45 | TEXT ·RawSyscallNoError(SB),NOSPLIT,$0-48 46 | MOVV a1+8(FP), R4 47 | MOVV a2+16(FP), R5 48 | MOVV a3+24(FP), R6 49 | MOVV R0, R7 50 | MOVV R0, R8 51 | MOVV R0, R9 52 | MOVV trap+0(FP), R2 // syscall entry 53 | SYSCALL 54 | MOVV R2, r1+32(FP) 55 | MOVV R3, r2+40(FP) 56 | RET 57 | -------------------------------------------------------------------------------- /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 ·SyscallNoError(SB),NOSPLIT,$0-24 28 | JAL runtime·entersyscall(SB) 29 | MOVW a1+4(FP), R4 30 | MOVW a2+8(FP), R5 31 | MOVW a3+12(FP), R6 32 | MOVW R0, R7 33 | MOVW trap+0(FP), R2 // syscall entry 34 | SYSCALL 35 | MOVW R2, r1+16(FP) // r1 36 | MOVW R3, r2+20(FP) // r2 37 | JAL runtime·exitsyscall(SB) 38 | RET 39 | 40 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28 41 | JMP syscall·RawSyscall(SB) 42 | 43 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 44 | JMP syscall·RawSyscall6(SB) 45 | 46 | TEXT ·RawSyscallNoError(SB),NOSPLIT,$0-24 47 | MOVW a1+4(FP), R4 48 | MOVW a2+8(FP), R5 49 | MOVW a3+12(FP), R6 50 | MOVW trap+0(FP), R2 // syscall entry 51 | SYSCALL 52 | MOVW R2, r1+16(FP) 53 | MOVW R3, r2+20(FP) 54 | RET 55 | -------------------------------------------------------------------------------- /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 ·SyscallNoError(SB),NOSPLIT,$0-48 19 | BL runtime·entersyscall(SB) 20 | MOVD a1+8(FP), R3 21 | MOVD a2+16(FP), R4 22 | MOVD a3+24(FP), R5 23 | MOVD R0, R6 24 | MOVD R0, R7 25 | MOVD R0, R8 26 | MOVD trap+0(FP), R9 // syscall entry 27 | SYSCALL R9 28 | MOVD R3, r1+32(FP) 29 | MOVD R4, r2+40(FP) 30 | BL runtime·exitsyscall(SB) 31 | RET 32 | 33 | TEXT ·RawSyscallNoError(SB),NOSPLIT,$0-48 34 | MOVD a1+8(FP), R3 35 | MOVD a2+16(FP), R4 36 | MOVD a3+24(FP), R5 37 | MOVD R0, R6 38 | MOVD R0, R7 39 | MOVD R0, R8 40 | MOVD trap+0(FP), R9 // syscall entry 41 | SYSCALL R9 42 | MOVD R3, r1+32(FP) 43 | MOVD R4, r2+40(FP) 44 | RET 45 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_linux_riscv64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2019 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build riscv64,!gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System calls for linux/riscv64. 11 | // 12 | // Where available, just jump to package syscall's implementation of 13 | // these functions. 14 | 15 | TEXT ·Syscall(SB),NOSPLIT,$0-56 16 | JMP syscall·Syscall(SB) 17 | 18 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 19 | JMP syscall·Syscall6(SB) 20 | 21 | TEXT ·SyscallNoError(SB),NOSPLIT,$0-48 22 | CALL runtime·entersyscall(SB) 23 | MOV a1+8(FP), A0 24 | MOV a2+16(FP), A1 25 | MOV a3+24(FP), A2 26 | MOV $0, A3 27 | MOV $0, A4 28 | MOV $0, A5 29 | MOV $0, A6 30 | MOV trap+0(FP), A7 // syscall entry 31 | ECALL 32 | MOV A0, r1+32(FP) // r1 33 | MOV A1, r2+40(FP) // r2 34 | CALL runtime·exitsyscall(SB) 35 | RET 36 | 37 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 38 | JMP syscall·RawSyscall(SB) 39 | 40 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 41 | JMP syscall·RawSyscall6(SB) 42 | 43 | TEXT ·RawSyscallNoError(SB),NOSPLIT,$0-48 44 | MOV a1+8(FP), A0 45 | MOV a2+16(FP), A1 46 | MOV a3+24(FP), A2 47 | MOV ZERO, A3 48 | MOV ZERO, A4 49 | MOV ZERO, A5 50 | MOV trap+0(FP), A7 // syscall entry 51 | ECALL 52 | MOV A0, r1+32(FP) 53 | MOV A1, r2+40(FP) 54 | RET 55 | -------------------------------------------------------------------------------- /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 ·SyscallNoError(SB),NOSPLIT,$0-48 25 | BL runtime·entersyscall(SB) 26 | MOVD a1+8(FP), R2 27 | MOVD a2+16(FP), R3 28 | MOVD a3+24(FP), R4 29 | MOVD $0, R5 30 | MOVD $0, R6 31 | MOVD $0, R7 32 | MOVD trap+0(FP), R1 // syscall entry 33 | SYSCALL 34 | MOVD R2, r1+32(FP) 35 | MOVD R3, r2+40(FP) 36 | BL runtime·exitsyscall(SB) 37 | RET 38 | 39 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 40 | BR syscall·RawSyscall(SB) 41 | 42 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 43 | BR syscall·RawSyscall6(SB) 44 | 45 | TEXT ·RawSyscallNoError(SB),NOSPLIT,$0-48 46 | MOVD a1+8(FP), R2 47 | MOVD a2+16(FP), R3 48 | MOVD a3+24(FP), R4 49 | MOVD $0, R5 50 | MOVD $0, R6 51 | MOVD $0, R7 52 | MOVD trap+0(FP), R1 // syscall entry 53 | SYSCALL 54 | MOVD R2, r1+32(FP) 55 | MOVD R3, r2+40(FP) 56 | RET 57 | -------------------------------------------------------------------------------- /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_netbsd_arm64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2019 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for ARM64, 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 | B syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 20 | B syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-104 23 | B syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 26 | B syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 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_openbsd_arm.s: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for ARM, 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 | 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_arm64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2019 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for arm64, 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 aix 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_aix_ppc.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build aix 6 | // +build ppc 7 | 8 | // Functions to access/create device major and minor numbers matching the 9 | // encoding used by AIX. 10 | 11 | package unix 12 | 13 | // Major returns the major component of a Linux device number. 14 | func Major(dev uint64) uint32 { 15 | return uint32((dev >> 16) & 0xffff) 16 | } 17 | 18 | // Minor returns the minor component of a Linux device number. 19 | func Minor(dev uint64) uint32 { 20 | return uint32(dev & 0xffff) 21 | } 22 | 23 | // Mkdev returns a Linux device number generated from the given major and minor 24 | // components. 25 | func Mkdev(major, minor uint32) uint64 { 26 | return uint64(((major) << 16) | (minor)) 27 | } 28 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/dev_aix_ppc64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build aix 6 | // +build ppc64 7 | 8 | // Functions to access/create device major and minor numbers matching the 9 | // encoding used AIX. 10 | 11 | package unix 12 | 13 | // Major returns the major component of a Linux device number. 14 | func Major(dev uint64) uint32 { 15 | return uint32((dev & 0x3fffffff00000000) >> 32) 16 | } 17 | 18 | // Minor returns the minor component of a Linux device number. 19 | func Minor(dev uint64) uint32 { 20 | return uint32((dev & 0x00000000ffffffff) >> 0) 21 | } 22 | 23 | // Mkdev returns a Linux device number generated from the given major and minor 24 | // components. 25 | func Mkdev(major, minor uint32) uint64 { 26 | var DEVNO64 uint64 27 | DEVNO64 = 0x8000000000000000 28 | return ((uint64(major) << 32) | (uint64(minor) & 0x00000000FFFFFFFF) | DEVNO64) 29 | } 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/dev_darwin.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // Functions to access/create device major and minor numbers matching the 6 | // encoding used in Darwin's sys/types.h header. 7 | 8 | package unix 9 | 10 | // Major returns the major component of a Darwin device number. 11 | func Major(dev uint64) uint32 { 12 | return uint32((dev >> 24) & 0xff) 13 | } 14 | 15 | // Minor returns the minor component of a Darwin device number. 16 | func Minor(dev uint64) uint32 { 17 | return uint32(dev & 0xffffff) 18 | } 19 | 20 | // Mkdev returns a Darwin device number generated from the given major and minor 21 | // components. 22 | func Mkdev(major, minor uint32) uint64 { 23 | return (uint64(major) << 24) | uint64(minor) 24 | } 25 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/dev_dragonfly.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // Functions to access/create device major and minor numbers matching the 6 | // encoding used in Dragonfly's sys/types.h header. 7 | // 8 | // The information below is extracted and adapted from sys/types.h: 9 | // 10 | // Minor gives a cookie instead of an index since in order to avoid changing the 11 | // meanings of bits 0-15 or wasting time and space shifting bits 16-31 for 12 | // devices that don't use them. 13 | 14 | package unix 15 | 16 | // Major returns the major component of a DragonFlyBSD device number. 17 | func Major(dev uint64) uint32 { 18 | return uint32((dev >> 8) & 0xff) 19 | } 20 | 21 | // Minor returns the minor component of a DragonFlyBSD device number. 22 | func Minor(dev uint64) uint32 { 23 | return uint32(dev & 0xffff00ff) 24 | } 25 | 26 | // Mkdev returns a DragonFlyBSD device number generated from the given major and 27 | // minor components. 28 | func Mkdev(major, minor uint32) uint64 { 29 | return (uint64(major) << 8) | uint64(minor) 30 | } 31 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/dev_freebsd.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // Functions to access/create device major and minor numbers matching the 6 | // encoding used in FreeBSD's sys/types.h header. 7 | // 8 | // The information below is extracted and adapted from sys/types.h: 9 | // 10 | // Minor gives a cookie instead of an index since in order to avoid changing the 11 | // meanings of bits 0-15 or wasting time and space shifting bits 16-31 for 12 | // devices that don't use them. 13 | 14 | package unix 15 | 16 | // Major returns the major component of a FreeBSD device number. 17 | func Major(dev uint64) uint32 { 18 | return uint32((dev >> 8) & 0xff) 19 | } 20 | 21 | // Minor returns the minor component of a FreeBSD device number. 22 | func Minor(dev uint64) uint32 { 23 | return uint32(dev & 0xffff00ff) 24 | } 25 | 26 | // Mkdev returns a FreeBSD device number generated from the given major and 27 | // minor components. 28 | func Mkdev(major, minor uint32) uint64 { 29 | return (uint64(major) << 8) | uint64(minor) 30 | } 31 | -------------------------------------------------------------------------------- /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/dev_netbsd.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // Functions to access/create device major and minor numbers matching the 6 | // encoding used in NetBSD's sys/types.h header. 7 | 8 | package unix 9 | 10 | // Major returns the major component of a NetBSD device number. 11 | func Major(dev uint64) uint32 { 12 | return uint32((dev & 0x000fff00) >> 8) 13 | } 14 | 15 | // Minor returns the minor component of a NetBSD device number. 16 | func Minor(dev uint64) uint32 { 17 | minor := uint32((dev & 0x000000ff) >> 0) 18 | minor |= uint32((dev & 0xfff00000) >> 12) 19 | return minor 20 | } 21 | 22 | // Mkdev returns a NetBSD device number generated from the given major and minor 23 | // components. 24 | func Mkdev(major, minor uint32) uint64 { 25 | dev := (uint64(major) << 8) & 0x000fff00 26 | dev |= (uint64(minor) << 12) & 0xfff00000 27 | dev |= (uint64(minor) << 0) & 0x000000ff 28 | return dev 29 | } 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/dev_openbsd.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // Functions to access/create device major and minor numbers matching the 6 | // encoding used in OpenBSD's sys/types.h header. 7 | 8 | package unix 9 | 10 | // Major returns the major component of an OpenBSD device number. 11 | func Major(dev uint64) uint32 { 12 | return uint32((dev & 0x0000ff00) >> 8) 13 | } 14 | 15 | // Minor returns the minor component of an OpenBSD device number. 16 | func Minor(dev uint64) uint32 { 17 | minor := uint32((dev & 0x000000ff) >> 0) 18 | minor |= uint32((dev & 0xffff0000) >> 8) 19 | return minor 20 | } 21 | 22 | // Mkdev returns an OpenBSD device number generated from the given major and minor 23 | // components. 24 | func Mkdev(major, minor uint32) uint64 { 25 | dev := (uint64(major) << 8) & 0x0000ff00 26 | dev |= (uint64(minor) << 8) & 0xffff0000 27 | dev |= (uint64(minor) << 0) & 0x000000ff 28 | return dev 29 | } 30 | -------------------------------------------------------------------------------- /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 riscv64 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 aix 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 | 29 | func Unsetenv(key string) error { 30 | return syscall.Unsetenv(key) 31 | } 32 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/fcntl.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build dragonfly 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 | // FcntlInt performs a fcntl syscall on fd with the provided command and argument. 16 | func FcntlInt(fd uintptr, cmd, arg int) (int, error) { 17 | valptr, _, errno := Syscall(fcntl64Syscall, fd, uintptr(cmd), uintptr(arg)) 18 | var err error 19 | if errno != 0 { 20 | err = errno 21 | } 22 | return int(valptr), err 23 | } 24 | 25 | // FcntlFlock performs a fcntl syscall for the F_GETLK, F_SETLK or F_SETLKW command. 26 | func FcntlFlock(fd uintptr, cmd int, lk *Flock_t) error { 27 | _, _, errno := Syscall(fcntl64Syscall, fd, uintptr(cmd), uintptr(unsafe.Pointer(lk))) 28 | if errno == 0 { 29 | return nil 30 | } 31 | return errno 32 | } 33 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/fcntl_darwin.go: -------------------------------------------------------------------------------- 1 | // Copyright 2019 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package unix 6 | 7 | import "unsafe" 8 | 9 | // FcntlInt performs a fcntl syscall on fd with the provided command and argument. 10 | func FcntlInt(fd uintptr, cmd, arg int) (int, error) { 11 | return fcntl(int(fd), cmd, arg) 12 | } 13 | 14 | // FcntlFlock performs a fcntl syscall for the F_GETLK, F_SETLK or F_SETLKW command. 15 | func FcntlFlock(fd uintptr, cmd int, lk *Flock_t) error { 16 | _, err := fcntl(int(fd), cmd, int(uintptr(unsafe.Pointer(lk)))) 17 | return err 18 | } 19 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/fcntl_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 | // +build !aix 7 | 8 | package unix 9 | 10 | import "syscall" 11 | 12 | // We can't use the gc-syntax .s files for gccgo. On the plus side 13 | // much of the functionality can be written directly in Go. 14 | 15 | //extern gccgoRealSyscallNoError 16 | func realSyscallNoError(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r uintptr) 17 | 18 | //extern gccgoRealSyscall 19 | func realSyscall(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r, errno uintptr) 20 | 21 | func SyscallNoError(trap, a1, a2, a3 uintptr) (r1, r2 uintptr) { 22 | syscall.Entersyscall() 23 | r := realSyscallNoError(trap, a1, a2, a3, 0, 0, 0, 0, 0, 0) 24 | syscall.Exitsyscall() 25 | return r, 0 26 | } 27 | 28 | func Syscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.Errno) { 29 | syscall.Entersyscall() 30 | r, errno := realSyscall(trap, a1, a2, a3, 0, 0, 0, 0, 0, 0) 31 | syscall.Exitsyscall() 32 | return r, 0, syscall.Errno(errno) 33 | } 34 | 35 | func Syscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err syscall.Errno) { 36 | syscall.Entersyscall() 37 | r, errno := realSyscall(trap, a1, a2, a3, a4, a5, a6, 0, 0, 0) 38 | syscall.Exitsyscall() 39 | return r, 0, syscall.Errno(errno) 40 | } 41 | 42 | func Syscall9(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) { 43 | syscall.Entersyscall() 44 | r, errno := realSyscall(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9) 45 | syscall.Exitsyscall() 46 | return r, 0, syscall.Errno(errno) 47 | } 48 | 49 | func RawSyscallNoError(trap, a1, a2, a3 uintptr) (r1, r2 uintptr) { 50 | r := realSyscallNoError(trap, a1, a2, a3, 0, 0, 0, 0, 0, 0) 51 | return r, 0 52 | } 53 | 54 | func RawSyscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.Errno) { 55 | r, errno := realSyscall(trap, a1, a2, a3, 0, 0, 0, 0, 0, 0) 56 | return r, 0, syscall.Errno(errno) 57 | } 58 | 59 | func RawSyscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err syscall.Errno) { 60 | r, errno := realSyscall(trap, a1, a2, a3, a4, a5, a6, 0, 0, 0) 61 | return r, 0, syscall.Errno(errno) 62 | } 63 | -------------------------------------------------------------------------------- /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 | // +build !aix 7 | 8 | #include 9 | #include 10 | #include 11 | 12 | #define _STRINGIFY2_(x) #x 13 | #define _STRINGIFY_(x) _STRINGIFY2_(x) 14 | #define GOSYM_PREFIX _STRINGIFY_(__USER_LABEL_PREFIX__) 15 | 16 | // Call syscall from C code because the gccgo support for calling from 17 | // Go to C does not support varargs functions. 18 | 19 | struct ret { 20 | uintptr_t r; 21 | uintptr_t err; 22 | }; 23 | 24 | struct ret 25 | 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) 26 | { 27 | struct ret r; 28 | 29 | errno = 0; 30 | r.r = syscall(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9); 31 | r.err = errno; 32 | return r; 33 | } 34 | 35 | uintptr_t 36 | gccgoRealSyscallNoError(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) 37 | { 38 | return syscall(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9); 39 | } 40 | -------------------------------------------------------------------------------- /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/ioctl.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build aix darwin dragonfly freebsd linux netbsd openbsd solaris 6 | 7 | package unix 8 | 9 | import ( 10 | "runtime" 11 | "unsafe" 12 | ) 13 | 14 | // ioctl itself should not be exposed directly, but additional get/set 15 | // functions for specific types are permissible. 16 | 17 | // IoctlSetInt performs an ioctl operation which sets an integer value 18 | // on fd, using the specified request number. 19 | func IoctlSetInt(fd int, req uint, value int) error { 20 | return ioctl(fd, req, uintptr(value)) 21 | } 22 | 23 | // IoctlSetWinsize performs an ioctl on fd with a *Winsize argument. 24 | // 25 | // To change fd's window size, the req argument should be TIOCSWINSZ. 26 | func IoctlSetWinsize(fd int, req uint, value *Winsize) error { 27 | // TODO: if we get the chance, remove the req parameter and 28 | // hardcode TIOCSWINSZ. 29 | err := ioctl(fd, req, uintptr(unsafe.Pointer(value))) 30 | runtime.KeepAlive(value) 31 | return err 32 | } 33 | 34 | // IoctlSetTermios performs an ioctl on fd with a *Termios. 35 | // 36 | // The req value will usually be TCSETA or TIOCSETA. 37 | func IoctlSetTermios(fd int, req uint, value *Termios) error { 38 | // TODO: if we get the chance, remove the req parameter. 39 | err := ioctl(fd, req, uintptr(unsafe.Pointer(value))) 40 | runtime.KeepAlive(value) 41 | return err 42 | } 43 | 44 | // IoctlGetInt performs an ioctl operation which gets an integer value 45 | // from fd, using the specified request number. 46 | // 47 | // A few ioctl requests use the return value as an output parameter; 48 | // for those, IoctlRetInt should be used instead of this function. 49 | func IoctlGetInt(fd int, req uint) (int, error) { 50 | var value int 51 | err := ioctl(fd, req, uintptr(unsafe.Pointer(&value))) 52 | return value, err 53 | } 54 | 55 | func IoctlGetWinsize(fd int, req uint) (*Winsize, error) { 56 | var value Winsize 57 | err := ioctl(fd, req, uintptr(unsafe.Pointer(&value))) 58 | return &value, err 59 | } 60 | 61 | func IoctlGetTermios(fd int, req uint) (*Termios, error) { 62 | var value Termios 63 | err := ioctl(fd, req, uintptr(unsafe.Pointer(&value))) 64 | return &value, err 65 | } 66 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/mkasm_darwin.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build ignore 6 | 7 | // mkasm_darwin.go generates assembly trampolines to call libSystem routines from Go. 8 | //This program must be run after mksyscall.go. 9 | package main 10 | 11 | import ( 12 | "bytes" 13 | "fmt" 14 | "io/ioutil" 15 | "log" 16 | "os" 17 | "strings" 18 | ) 19 | 20 | func writeASMFile(in string, fileName string, buildTags string) { 21 | trampolines := map[string]bool{} 22 | 23 | var out bytes.Buffer 24 | 25 | fmt.Fprintf(&out, "// go run mkasm_darwin.go %s\n", strings.Join(os.Args[1:], " ")) 26 | fmt.Fprintf(&out, "// Code generated by the command above; DO NOT EDIT.\n") 27 | fmt.Fprintf(&out, "\n") 28 | fmt.Fprintf(&out, "// +build %s\n", buildTags) 29 | fmt.Fprintf(&out, "\n") 30 | fmt.Fprintf(&out, "#include \"textflag.h\"\n") 31 | for _, line := range strings.Split(in, "\n") { 32 | if !strings.HasPrefix(line, "func ") || !strings.HasSuffix(line, "_trampoline()") { 33 | continue 34 | } 35 | fn := line[5 : len(line)-13] 36 | if !trampolines[fn] { 37 | trampolines[fn] = true 38 | fmt.Fprintf(&out, "TEXT ·%s_trampoline(SB),NOSPLIT,$0-0\n", fn) 39 | fmt.Fprintf(&out, "\tJMP\t%s(SB)\n", fn) 40 | } 41 | } 42 | err := ioutil.WriteFile(fileName, out.Bytes(), 0644) 43 | if err != nil { 44 | log.Fatalf("can't write %s: %s", fileName, err) 45 | } 46 | } 47 | 48 | func main() { 49 | in1, err := ioutil.ReadFile("syscall_darwin.go") 50 | if err != nil { 51 | log.Fatalf("can't open syscall_darwin.go: %s", err) 52 | } 53 | arch := os.Args[1] 54 | in2, err := ioutil.ReadFile(fmt.Sprintf("syscall_darwin_%s.go", arch)) 55 | if err != nil { 56 | log.Fatalf("can't open syscall_darwin_%s.go: %s", arch, err) 57 | } 58 | in3, err := ioutil.ReadFile(fmt.Sprintf("zsyscall_darwin_%s.go", arch)) 59 | if err != nil { 60 | log.Fatalf("can't open zsyscall_darwin_%s.go: %s", arch, err) 61 | } 62 | in := string(in1) + string(in2) + string(in3) 63 | 64 | writeASMFile(in, fmt.Sprintf("zsyscall_darwin_%s.s", arch), "go1.12") 65 | 66 | in1, err = ioutil.ReadFile("syscall_darwin.1_13.go") 67 | if err != nil { 68 | log.Fatalf("can't open syscall_darwin.1_13.go: %s", err) 69 | } 70 | in2, err = ioutil.ReadFile(fmt.Sprintf("zsyscall_darwin_%s.1_13.go", arch)) 71 | if err != nil { 72 | log.Fatalf("can't open zsyscall_darwin_%s.1_13.go: %s", arch, err) 73 | } 74 | 75 | in = string(in1) + string(in2) 76 | 77 | writeASMFile(in, fmt.Sprintf("zsyscall_darwin_%s.1_13.s", arch), "go1.13") 78 | } 79 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/pagesize_unix.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build aix darwin dragonfly freebsd linux netbsd openbsd solaris 6 | 7 | // For Unix, get the pagesize from the runtime. 8 | 9 | package unix 10 | 11 | import "syscall" 12 | 13 | func Getpagesize() int { 14 | return syscall.Getpagesize() 15 | } 16 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/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 darwin,race linux,race freebsd,race 6 | 7 | package unix 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/unix/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 aix darwin,!race linux,!race freebsd,!race netbsd openbsd solaris dragonfly 6 | 7 | package unix 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/unix/readdirent_getdents.go: -------------------------------------------------------------------------------- 1 | // Copyright 2019 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build aix dragonfly freebsd linux netbsd openbsd 6 | 7 | package unix 8 | 9 | // ReadDirent reads directory entries from fd and writes them into buf. 10 | func ReadDirent(fd int, buf []byte) (n int, err error) { 11 | return Getdents(fd, buf) 12 | } 13 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/readdirent_getdirentries.go: -------------------------------------------------------------------------------- 1 | // Copyright 2019 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build darwin 6 | 7 | package unix 8 | 9 | import "unsafe" 10 | 11 | // ReadDirent reads directory entries from fd and writes them into buf. 12 | func ReadDirent(fd int, buf []byte) (n int, err error) { 13 | // Final argument is (basep *uintptr) and the syscall doesn't take nil. 14 | // 64 bits should be enough. (32 bits isn't even on 386). Since the 15 | // actual system call is getdirentries64, 64 is a good guess. 16 | // TODO(rsc): Can we use a single global basep for all calls? 17 | var base = (*uintptr)(unsafe.Pointer(new(uint64))) 18 | return Getdirentries(fd, buf, base) 19 | } 20 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/sockcmsg_dragonfly.go: -------------------------------------------------------------------------------- 1 | // Copyright 2019 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package unix 6 | 7 | // Round the length of a raw sockaddr up to align it properly. 8 | func cmsgAlignOf(salen int) int { 9 | salign := SizeofPtr 10 | if SizeofPtr == 8 && !supportsABI(_dragonflyABIChangeVersion) { 11 | // 64-bit Dragonfly before the September 2019 ABI changes still requires 12 | // 32-bit aligned access to network subsystem. 13 | salign = 4 14 | } 15 | return (salen + salign - 1) & ^(salign - 1) 16 | } 17 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/sockcmsg_linux.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 | // Socket control messages 6 | 7 | package unix 8 | 9 | import "unsafe" 10 | 11 | // UnixCredentials encodes credentials into a socket control message 12 | // for sending to another process. This can be used for 13 | // authentication. 14 | func UnixCredentials(ucred *Ucred) []byte { 15 | b := make([]byte, CmsgSpace(SizeofUcred)) 16 | h := (*Cmsghdr)(unsafe.Pointer(&b[0])) 17 | h.Level = SOL_SOCKET 18 | h.Type = SCM_CREDENTIALS 19 | h.SetLen(CmsgLen(SizeofUcred)) 20 | *(*Ucred)(h.data(0)) = *ucred 21 | return b 22 | } 23 | 24 | // ParseUnixCredentials decodes a socket control message that contains 25 | // credentials in a Ucred structure. To receive such a message, the 26 | // SO_PASSCRED option must be enabled on the socket. 27 | func ParseUnixCredentials(m *SocketControlMessage) (*Ucred, error) { 28 | if m.Header.Level != SOL_SOCKET { 29 | return nil, EINVAL 30 | } 31 | if m.Header.Type != SCM_CREDENTIALS { 32 | return nil, EINVAL 33 | } 34 | ucred := *(*Ucred)(unsafe.Pointer(&m.Data[0])) 35 | return &ucred, nil 36 | } 37 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/sockcmsg_unix.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 | // +build aix darwin dragonfly freebsd linux netbsd openbsd solaris 6 | 7 | // Socket control messages 8 | 9 | package unix 10 | 11 | import ( 12 | "unsafe" 13 | ) 14 | 15 | // CmsgLen returns the value to store in the Len field of the Cmsghdr 16 | // structure, taking into account any necessary alignment. 17 | func CmsgLen(datalen int) int { 18 | return cmsgAlignOf(SizeofCmsghdr) + datalen 19 | } 20 | 21 | // CmsgSpace returns the number of bytes an ancillary element with 22 | // payload of the passed data length occupies. 23 | func CmsgSpace(datalen int) int { 24 | return cmsgAlignOf(SizeofCmsghdr) + cmsgAlignOf(datalen) 25 | } 26 | 27 | func (h *Cmsghdr) data(offset uintptr) unsafe.Pointer { 28 | return unsafe.Pointer(uintptr(unsafe.Pointer(h)) + uintptr(cmsgAlignOf(SizeofCmsghdr)) + offset) 29 | } 30 | 31 | // SocketControlMessage represents a socket control message. 32 | type SocketControlMessage struct { 33 | Header Cmsghdr 34 | Data []byte 35 | } 36 | 37 | // ParseSocketControlMessage parses b as an array of socket control 38 | // messages. 39 | func ParseSocketControlMessage(b []byte) ([]SocketControlMessage, error) { 40 | var msgs []SocketControlMessage 41 | i := 0 42 | for i+CmsgLen(0) <= len(b) { 43 | h, dbuf, err := socketControlMessageHeaderAndData(b[i:]) 44 | if err != nil { 45 | return nil, err 46 | } 47 | m := SocketControlMessage{Header: *h, Data: dbuf} 48 | msgs = append(msgs, m) 49 | i += cmsgAlignOf(int(h.Len)) 50 | } 51 | return msgs, nil 52 | } 53 | 54 | func socketControlMessageHeaderAndData(b []byte) (*Cmsghdr, []byte, error) { 55 | h := (*Cmsghdr)(unsafe.Pointer(&b[0])) 56 | if h.Len < SizeofCmsghdr || uint64(h.Len) > uint64(len(b)) { 57 | return nil, nil, EINVAL 58 | } 59 | return h, b[cmsgAlignOf(SizeofCmsghdr):h.Len], nil 60 | } 61 | 62 | // UnixRights encodes a set of open file descriptors into a socket 63 | // control message for sending to another process. 64 | func UnixRights(fds ...int) []byte { 65 | datalen := len(fds) * 4 66 | b := make([]byte, CmsgSpace(datalen)) 67 | h := (*Cmsghdr)(unsafe.Pointer(&b[0])) 68 | h.Level = SOL_SOCKET 69 | h.Type = SCM_RIGHTS 70 | h.SetLen(CmsgLen(datalen)) 71 | for i, fd := range fds { 72 | *(*int32)(h.data(4 * uintptr(i))) = int32(fd) 73 | } 74 | return b 75 | } 76 | 77 | // ParseUnixRights decodes a socket control message that contains an 78 | // integer array of open file descriptors from another process. 79 | func ParseUnixRights(m *SocketControlMessage) ([]int, error) { 80 | if m.Header.Level != SOL_SOCKET { 81 | return nil, EINVAL 82 | } 83 | if m.Header.Type != SCM_RIGHTS { 84 | return nil, EINVAL 85 | } 86 | fds := make([]int, len(m.Data)>>2) 87 | for i, j := 0, 0; i < len(m.Data); i += 4 { 88 | fds[j] = int(*(*int32)(unsafe.Pointer(&m.Data[i]))) 89 | j++ 90 | } 91 | return fds, nil 92 | } 93 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/sockcmsg_unix_other.go: -------------------------------------------------------------------------------- 1 | // Copyright 2019 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build aix darwin freebsd linux netbsd openbsd solaris 6 | 7 | package unix 8 | 9 | import ( 10 | "runtime" 11 | ) 12 | 13 | // Round the length of a raw sockaddr up to align it properly. 14 | func cmsgAlignOf(salen int) int { 15 | salign := SizeofPtr 16 | 17 | // dragonfly needs to check ABI version at runtime, see cmsgAlignOf in 18 | // sockcmsg_dragonfly.go 19 | switch runtime.GOOS { 20 | case "aix": 21 | // There is no alignment on AIX. 22 | salign = 1 23 | case "darwin", "illumos", "solaris": 24 | // NOTE: It seems like 64-bit Darwin, Illumos and Solaris 25 | // kernels still require 32-bit aligned access to network 26 | // subsystem. 27 | if SizeofPtr == 8 { 28 | salign = 4 29 | } 30 | case "netbsd", "openbsd": 31 | // NetBSD and OpenBSD armv7 require 64-bit alignment. 32 | if runtime.GOARCH == "arm" { 33 | salign = 8 34 | } 35 | } 36 | 37 | return (salen + salign - 1) & ^(salign - 1) 38 | } 39 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/str.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build aix darwin dragonfly freebsd linux netbsd openbsd solaris 6 | 7 | package unix 8 | 9 | func itoa(val int) string { // do it here rather than with fmt to avoid dependency 10 | if val < 0 { 11 | return "-" + uitoa(uint(-val)) 12 | } 13 | return uitoa(uint(val)) 14 | } 15 | 16 | func uitoa(val uint) string { 17 | var buf [32]byte // big enough for int64 18 | i := len(buf) - 1 19 | for val >= 10 { 20 | buf[i] = byte(val%10 + '0') 21 | i-- 22 | val /= 10 23 | } 24 | buf[i] = byte(val + '0') 25 | return string(buf[i:]) 26 | } 27 | -------------------------------------------------------------------------------- /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 aix 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 | // 15 | // The primary use of this package is inside other packages that provide a more 16 | // portable interface to the system, such as "os", "time" and "net". Use 17 | // those packages rather than this one if you can. 18 | // 19 | // For details of the functions and data types in this package consult 20 | // the manuals for the appropriate operating system. 21 | // 22 | // These calls return err == nil to indicate success; otherwise 23 | // err represents an operating system error describing the failure and 24 | // holds a value of type syscall.Errno. 25 | package unix // import "golang.org/x/sys/unix" 26 | 27 | import "strings" 28 | 29 | // ByteSliceFromString returns a NUL-terminated slice of bytes 30 | // containing the text of s. If s contains a NUL byte at any 31 | // location, it returns (nil, EINVAL). 32 | func ByteSliceFromString(s string) ([]byte, error) { 33 | if strings.IndexByte(s, 0) != -1 { 34 | return nil, EINVAL 35 | } 36 | a := make([]byte, len(s)+1) 37 | copy(a, s) 38 | return a, nil 39 | } 40 | 41 | // BytePtrFromString returns a pointer to a NUL-terminated array of 42 | // bytes containing the text of s. If s contains a NUL byte at any 43 | // location, it returns (nil, EINVAL). 44 | func BytePtrFromString(s string) (*byte, error) { 45 | a, err := ByteSliceFromString(s) 46 | if err != nil { 47 | return nil, err 48 | } 49 | return &a[0], nil 50 | } 51 | 52 | // Single-word zero for use when we need a valid pointer to 0 bytes. 53 | var _zero uintptr 54 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_aix_ppc.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build aix 6 | // +build ppc 7 | 8 | package unix 9 | 10 | //sysnb Getrlimit(resource int, rlim *Rlimit) (err error) = getrlimit64 11 | //sysnb Setrlimit(resource int, rlim *Rlimit) (err error) = setrlimit64 12 | //sys Seek(fd int, offset int64, whence int) (off int64, err error) = lseek64 13 | 14 | //sys mmap(addr uintptr, length uintptr, prot int, flags int, fd int, offset int64) (xaddr uintptr, err error) 15 | 16 | func setTimespec(sec, nsec int64) Timespec { 17 | return Timespec{Sec: int32(sec), Nsec: int32(nsec)} 18 | } 19 | 20 | func setTimeval(sec, usec int64) Timeval { 21 | return Timeval{Sec: int32(sec), Usec: int32(usec)} 22 | } 23 | 24 | func (iov *Iovec) SetLen(length int) { 25 | iov.Len = uint32(length) 26 | } 27 | 28 | func (msghdr *Msghdr) SetControllen(length int) { 29 | msghdr.Controllen = uint32(length) 30 | } 31 | 32 | func (msghdr *Msghdr) SetIovlen(length int) { 33 | msghdr.Iovlen = int32(length) 34 | } 35 | 36 | func (cmsg *Cmsghdr) SetLen(length int) { 37 | cmsg.Len = uint32(length) 38 | } 39 | 40 | func Fstat(fd int, stat *Stat_t) error { 41 | return fstat(fd, stat) 42 | } 43 | 44 | func Fstatat(dirfd int, path string, stat *Stat_t, flags int) error { 45 | return fstatat(dirfd, path, stat, flags) 46 | } 47 | 48 | func Lstat(path string, stat *Stat_t) error { 49 | return lstat(path, stat) 50 | } 51 | 52 | func Stat(path string, statptr *Stat_t) error { 53 | return stat(path, statptr) 54 | } 55 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_aix_ppc64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build aix 6 | // +build ppc64 7 | 8 | package unix 9 | 10 | //sysnb Getrlimit(resource int, rlim *Rlimit) (err error) 11 | //sysnb Setrlimit(resource int, rlim *Rlimit) (err error) 12 | //sys Seek(fd int, offset int64, whence int) (off int64, err error) = lseek 13 | 14 | //sys mmap(addr uintptr, length uintptr, prot int, flags int, fd int, offset int64) (xaddr uintptr, err error) = mmap64 15 | 16 | func setTimespec(sec, nsec int64) Timespec { 17 | return Timespec{Sec: sec, Nsec: nsec} 18 | } 19 | 20 | func setTimeval(sec, usec int64) Timeval { 21 | return Timeval{Sec: int64(sec), Usec: int32(usec)} 22 | } 23 | 24 | func (iov *Iovec) SetLen(length int) { 25 | iov.Len = uint64(length) 26 | } 27 | 28 | func (msghdr *Msghdr) SetControllen(length int) { 29 | msghdr.Controllen = uint32(length) 30 | } 31 | 32 | func (msghdr *Msghdr) SetIovlen(length int) { 33 | msghdr.Iovlen = int32(length) 34 | } 35 | 36 | func (cmsg *Cmsghdr) SetLen(length int) { 37 | cmsg.Len = uint32(length) 38 | } 39 | 40 | // In order to only have Timespec structure, type of Stat_t's fields 41 | // Atim, Mtim and Ctim is changed from StTimespec to Timespec during 42 | // ztypes generation. 43 | // On ppc64, Timespec.Nsec is an int64 while StTimespec.Nsec is an 44 | // int32, so the fields' value must be modified. 45 | func fixStatTimFields(stat *Stat_t) { 46 | stat.Atim.Nsec >>= 32 47 | stat.Mtim.Nsec >>= 32 48 | stat.Ctim.Nsec >>= 32 49 | } 50 | 51 | func Fstat(fd int, stat *Stat_t) error { 52 | err := fstat(fd, stat) 53 | if err != nil { 54 | return err 55 | } 56 | fixStatTimFields(stat) 57 | return nil 58 | } 59 | 60 | func Fstatat(dirfd int, path string, stat *Stat_t, flags int) error { 61 | err := fstatat(dirfd, path, stat, flags) 62 | if err != nil { 63 | return err 64 | } 65 | fixStatTimFields(stat) 66 | return nil 67 | } 68 | 69 | func Lstat(path string, stat *Stat_t) error { 70 | err := lstat(path, stat) 71 | if err != nil { 72 | return err 73 | } 74 | fixStatTimFields(stat) 75 | return nil 76 | } 77 | 78 | func Stat(path string, statptr *Stat_t) error { 79 | err := stat(path, statptr) 80 | if err != nil { 81 | return err 82 | } 83 | fixStatTimFields(statptr) 84 | return nil 85 | } 86 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_darwin.1_12.go: -------------------------------------------------------------------------------- 1 | // Copyright 2019 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build darwin,go1.12,!go1.13 6 | 7 | package unix 8 | 9 | import ( 10 | "unsafe" 11 | ) 12 | 13 | func Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) { 14 | // To implement this using libSystem we'd need syscall_syscallPtr for 15 | // fdopendir. However, syscallPtr was only added in Go 1.13, so we fall 16 | // back to raw syscalls for this func on Go 1.12. 17 | var p unsafe.Pointer 18 | if len(buf) > 0 { 19 | p = unsafe.Pointer(&buf[0]) 20 | } else { 21 | p = unsafe.Pointer(&_zero) 22 | } 23 | r0, _, e1 := Syscall6(SYS_GETDIRENTRIES64, uintptr(fd), uintptr(p), uintptr(len(buf)), uintptr(unsafe.Pointer(basep)), 0, 0) 24 | n = int(r0) 25 | if e1 != 0 { 26 | return n, errnoErr(e1) 27 | } 28 | return n, nil 29 | } 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_darwin_386.1_11.go: -------------------------------------------------------------------------------- 1 | // Copyright 2019 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build darwin,386,!go1.12 6 | 7 | package unix 8 | 9 | //sys Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) = SYS_GETDIRENTRIES64 10 | -------------------------------------------------------------------------------- /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 | ) 12 | 13 | //sys sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) = SYS___SYSCTL 14 | //sys ptrace(request int, pid int, addr uintptr, data uintptr) (err error) 15 | 16 | func setTimespec(sec, nsec int64) Timespec { 17 | return Timespec{Sec: int32(sec), Nsec: int32(nsec)} 18 | } 19 | 20 | func setTimeval(sec, usec int64) Timeval { 21 | return Timeval{Sec: int32(sec), Usec: int32(usec)} 22 | } 23 | 24 | //sysnb gettimeofday(tp *Timeval) (sec int32, usec int32, err error) 25 | func Gettimeofday(tv *Timeval) (err error) { 26 | // The tv passed to gettimeofday must be non-nil 27 | // but is otherwise unused. The answers come back 28 | // in the two registers. 29 | sec, usec, err := gettimeofday(tv) 30 | tv.Sec = int32(sec) 31 | tv.Usec = int32(usec) 32 | return err 33 | } 34 | 35 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 36 | k.Ident = uint32(fd) 37 | k.Filter = int16(mode) 38 | k.Flags = uint16(flags) 39 | } 40 | 41 | func (iov *Iovec) SetLen(length int) { 42 | iov.Len = uint32(length) 43 | } 44 | 45 | func (msghdr *Msghdr) SetControllen(length int) { 46 | msghdr.Controllen = uint32(length) 47 | } 48 | 49 | func (msghdr *Msghdr) SetIovlen(length int) { 50 | msghdr.Iovlen = int32(length) 51 | } 52 | 53 | func (cmsg *Cmsghdr) SetLen(length int) { 54 | cmsg.Len = uint32(length) 55 | } 56 | 57 | func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) 58 | 59 | // SYS___SYSCTL is used by syscall_bsd.go for all BSDs, but in modern versions 60 | // of darwin/386 the syscall is called sysctl instead of __sysctl. 61 | const SYS___SYSCTL = SYS_SYSCTL 62 | 63 | //sys Fstat(fd int, stat *Stat_t) (err error) = SYS_FSTAT64 64 | //sys Fstatat(fd int, path string, stat *Stat_t, flags int) (err error) = SYS_FSTATAT64 65 | //sys Fstatfs(fd int, stat *Statfs_t) (err error) = SYS_FSTATFS64 66 | //sys getfsstat(buf unsafe.Pointer, size uintptr, flags int) (n int, err error) = SYS_GETFSSTAT64 67 | //sys Lstat(path string, stat *Stat_t) (err error) = SYS_LSTAT64 68 | //sys Stat(path string, stat *Stat_t) (err error) = SYS_STAT64 69 | //sys Statfs(path string, stat *Statfs_t) (err error) = SYS_STATFS64 70 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_darwin_amd64.1_11.go: -------------------------------------------------------------------------------- 1 | // Copyright 2019 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build darwin,amd64,!go1.12 6 | 7 | package unix 8 | 9 | //sys Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) = SYS_GETDIRENTRIES64 10 | -------------------------------------------------------------------------------- /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 | ) 12 | 13 | //sys sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) = SYS___SYSCTL 14 | //sys ptrace(request int, pid int, addr uintptr, data uintptr) (err error) 15 | 16 | func setTimespec(sec, nsec int64) Timespec { 17 | return Timespec{Sec: sec, Nsec: nsec} 18 | } 19 | 20 | func setTimeval(sec, usec int64) Timeval { 21 | return Timeval{Sec: sec, Usec: int32(usec)} 22 | } 23 | 24 | //sysnb gettimeofday(tp *Timeval) (sec int64, usec int32, err error) 25 | func Gettimeofday(tv *Timeval) (err error) { 26 | // The tv passed to gettimeofday must be non-nil 27 | // but is otherwise unused. The answers come back 28 | // in the two registers. 29 | sec, usec, err := gettimeofday(tv) 30 | tv.Sec = sec 31 | tv.Usec = usec 32 | return err 33 | } 34 | 35 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 36 | k.Ident = uint64(fd) 37 | k.Filter = int16(mode) 38 | k.Flags = uint16(flags) 39 | } 40 | 41 | func (iov *Iovec) SetLen(length int) { 42 | iov.Len = uint64(length) 43 | } 44 | 45 | func (msghdr *Msghdr) SetControllen(length int) { 46 | msghdr.Controllen = uint32(length) 47 | } 48 | 49 | func (msghdr *Msghdr) SetIovlen(length int) { 50 | msghdr.Iovlen = int32(length) 51 | } 52 | 53 | func (cmsg *Cmsghdr) SetLen(length int) { 54 | cmsg.Len = uint32(length) 55 | } 56 | 57 | func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) 58 | 59 | // SYS___SYSCTL is used by syscall_bsd.go for all BSDs, but in modern versions 60 | // of darwin/amd64 the syscall is called sysctl instead of __sysctl. 61 | const SYS___SYSCTL = SYS_SYSCTL 62 | 63 | //sys Fstat(fd int, stat *Stat_t) (err error) = SYS_FSTAT64 64 | //sys Fstatat(fd int, path string, stat *Stat_t, flags int) (err error) = SYS_FSTATAT64 65 | //sys Fstatfs(fd int, stat *Statfs_t) (err error) = SYS_FSTATFS64 66 | //sys getfsstat(buf unsafe.Pointer, size uintptr, flags int) (n int, err error) = SYS_GETFSSTAT64 67 | //sys Lstat(path string, stat *Stat_t) (err error) = SYS_LSTAT64 68 | //sys Stat(path string, stat *Stat_t) (err error) = SYS_STAT64 69 | //sys Statfs(path string, stat *Statfs_t) (err error) = SYS_STATFS64 70 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_darwin_arm.1_11.go: -------------------------------------------------------------------------------- 1 | // Copyright 2019 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build darwin,386,!go1.12 6 | 7 | package unix 8 | 9 | func Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) { 10 | return 0, ENOSYS 11 | } 12 | -------------------------------------------------------------------------------- /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 | ) 10 | 11 | func ptrace(request int, pid int, addr uintptr, data uintptr) error { 12 | return ENOTSUP 13 | } 14 | 15 | func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) error { 16 | return ENOTSUP 17 | } 18 | 19 | func setTimespec(sec, nsec int64) Timespec { 20 | return Timespec{Sec: int32(sec), Nsec: int32(nsec)} 21 | } 22 | 23 | func setTimeval(sec, usec int64) Timeval { 24 | return Timeval{Sec: int32(sec), Usec: int32(usec)} 25 | } 26 | 27 | //sysnb gettimeofday(tp *Timeval) (sec int32, usec int32, err error) 28 | func Gettimeofday(tv *Timeval) (err error) { 29 | // The tv passed to gettimeofday must be non-nil 30 | // but is otherwise unused. The answers come back 31 | // in the two registers. 32 | sec, usec, err := gettimeofday(tv) 33 | tv.Sec = int32(sec) 34 | tv.Usec = int32(usec) 35 | return err 36 | } 37 | 38 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 39 | k.Ident = uint32(fd) 40 | k.Filter = int16(mode) 41 | k.Flags = uint16(flags) 42 | } 43 | 44 | func (iov *Iovec) SetLen(length int) { 45 | iov.Len = uint32(length) 46 | } 47 | 48 | func (msghdr *Msghdr) SetControllen(length int) { 49 | msghdr.Controllen = uint32(length) 50 | } 51 | 52 | func (msghdr *Msghdr) SetIovlen(length int) { 53 | msghdr.Iovlen = int32(length) 54 | } 55 | 56 | func (cmsg *Cmsghdr) SetLen(length int) { 57 | cmsg.Len = uint32(length) 58 | } 59 | 60 | func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) // sic 61 | 62 | // SYS___SYSCTL is used by syscall_bsd.go for all BSDs, but in modern versions 63 | // of darwin/arm the syscall is called sysctl instead of __sysctl. 64 | const SYS___SYSCTL = SYS_SYSCTL 65 | 66 | //sys Fstat(fd int, stat *Stat_t) (err error) 67 | //sys Fstatat(fd int, path string, stat *Stat_t, flags int) (err error) 68 | //sys Fstatfs(fd int, stat *Statfs_t) (err error) 69 | //sys getfsstat(buf unsafe.Pointer, size uintptr, flags int) (n int, err error) = SYS_GETFSSTAT 70 | //sys Lstat(path string, stat *Stat_t) (err error) 71 | //sys Stat(path string, stat *Stat_t) (err error) 72 | //sys Statfs(path string, stat *Statfs_t) (err error) 73 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_darwin_arm64.1_11.go: -------------------------------------------------------------------------------- 1 | // Copyright 2019 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build darwin,arm64,!go1.12 6 | 7 | package unix 8 | 9 | func Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) { 10 | return 0, ENOSYS 11 | } 12 | -------------------------------------------------------------------------------- /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 | ) 12 | 13 | func ptrace(request int, pid int, addr uintptr, data uintptr) error { 14 | return ENOTSUP 15 | } 16 | 17 | func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) error { 18 | return ENOTSUP 19 | } 20 | 21 | func setTimespec(sec, nsec int64) Timespec { 22 | return Timespec{Sec: sec, Nsec: nsec} 23 | } 24 | 25 | func setTimeval(sec, usec int64) Timeval { 26 | return Timeval{Sec: sec, Usec: int32(usec)} 27 | } 28 | 29 | //sysnb gettimeofday(tp *Timeval) (sec int64, 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 = sec 36 | tv.Usec = usec 37 | return err 38 | } 39 | 40 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 41 | k.Ident = uint64(fd) 42 | k.Filter = int16(mode) 43 | k.Flags = uint16(flags) 44 | } 45 | 46 | func (iov *Iovec) SetLen(length int) { 47 | iov.Len = uint64(length) 48 | } 49 | 50 | func (msghdr *Msghdr) SetControllen(length int) { 51 | msghdr.Controllen = uint32(length) 52 | } 53 | 54 | func (msghdr *Msghdr) SetIovlen(length int) { 55 | msghdr.Iovlen = int32(length) 56 | } 57 | 58 | func (cmsg *Cmsghdr) SetLen(length int) { 59 | cmsg.Len = uint32(length) 60 | } 61 | 62 | func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) // sic 63 | 64 | // SYS___SYSCTL is used by syscall_bsd.go for all BSDs, but in modern versions 65 | // of darwin/arm64 the syscall is called sysctl instead of __sysctl. 66 | const SYS___SYSCTL = SYS_SYSCTL 67 | 68 | //sys Fstat(fd int, stat *Stat_t) (err error) 69 | //sys Fstatat(fd int, path string, stat *Stat_t, flags int) (err error) 70 | //sys Fstatfs(fd int, stat *Statfs_t) (err error) 71 | //sys getfsstat(buf unsafe.Pointer, size uintptr, flags int) (n int, err error) = SYS_GETFSSTAT 72 | //sys Lstat(path string, stat *Stat_t) (err error) 73 | //sys Stat(path string, stat *Stat_t) (err error) 74 | //sys Statfs(path string, stat *Statfs_t) (err error) 75 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_darwin_libSystem.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build darwin,go1.12 6 | 7 | package unix 8 | 9 | import "unsafe" 10 | 11 | // Implemented in the runtime package (runtime/sys_darwin.go) 12 | func syscall_syscall(fn, a1, a2, a3 uintptr) (r1, r2 uintptr, err Errno) 13 | func syscall_syscall6(fn, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err Errno) 14 | func syscall_syscall6X(fn, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err Errno) 15 | func syscall_syscall9(fn, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err Errno) // 32-bit only 16 | func syscall_rawSyscall(fn, a1, a2, a3 uintptr) (r1, r2 uintptr, err Errno) 17 | func syscall_rawSyscall6(fn, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err Errno) 18 | func syscall_syscallPtr(fn, a1, a2, a3 uintptr) (r1, r2 uintptr, err Errno) 19 | 20 | //go:linkname syscall_syscall syscall.syscall 21 | //go:linkname syscall_syscall6 syscall.syscall6 22 | //go:linkname syscall_syscall6X syscall.syscall6X 23 | //go:linkname syscall_syscall9 syscall.syscall9 24 | //go:linkname syscall_rawSyscall syscall.rawSyscall 25 | //go:linkname syscall_rawSyscall6 syscall.rawSyscall6 26 | //go:linkname syscall_syscallPtr syscall.syscallPtr 27 | 28 | // Find the entry point for f. See comments in runtime/proc.go for the 29 | // function of the same name. 30 | //go:nosplit 31 | func funcPC(f func()) uintptr { 32 | return **(**uintptr)(unsafe.Pointer(&f)) 33 | } 34 | -------------------------------------------------------------------------------- /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 setTimespec(sec, nsec int64) Timespec { 15 | return Timespec{Sec: sec, Nsec: nsec} 16 | } 17 | 18 | func setTimeval(sec, usec int64) Timeval { 19 | return Timeval{Sec: sec, Usec: usec} 20 | } 21 | 22 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 23 | k.Ident = uint64(fd) 24 | k.Filter = int16(mode) 25 | k.Flags = uint16(flags) 26 | } 27 | 28 | func (iov *Iovec) SetLen(length int) { 29 | iov.Len = uint64(length) 30 | } 31 | 32 | func (msghdr *Msghdr) SetControllen(length int) { 33 | msghdr.Controllen = uint32(length) 34 | } 35 | 36 | func (msghdr *Msghdr) SetIovlen(length int) { 37 | msghdr.Iovlen = int32(length) 38 | } 39 | 40 | func (cmsg *Cmsghdr) SetLen(length int) { 41 | cmsg.Len = uint32(length) 42 | } 43 | 44 | func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) { 45 | var writtenOut uint64 = 0 46 | _, _, e1 := Syscall9(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr(count), 0, uintptr(unsafe.Pointer(&writtenOut)), 0, 0, 0) 47 | 48 | written = int(writtenOut) 49 | 50 | if e1 != 0 { 51 | err = e1 52 | } 53 | return 54 | } 55 | 56 | func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) 57 | -------------------------------------------------------------------------------- /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 setTimespec(sec, nsec int64) Timespec { 15 | return Timespec{Sec: int32(sec), Nsec: int32(nsec)} 16 | } 17 | 18 | func setTimeval(sec, usec int64) Timeval { 19 | return Timeval{Sec: int32(sec), Usec: int32(usec)} 20 | } 21 | 22 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 23 | k.Ident = uint32(fd) 24 | k.Filter = int16(mode) 25 | k.Flags = uint16(flags) 26 | } 27 | 28 | func (iov *Iovec) SetLen(length int) { 29 | iov.Len = uint32(length) 30 | } 31 | 32 | func (msghdr *Msghdr) SetControllen(length int) { 33 | msghdr.Controllen = uint32(length) 34 | } 35 | 36 | func (msghdr *Msghdr) SetIovlen(length int) { 37 | msghdr.Iovlen = int32(length) 38 | } 39 | 40 | func (cmsg *Cmsghdr) SetLen(length int) { 41 | cmsg.Len = uint32(length) 42 | } 43 | 44 | func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) { 45 | var writtenOut uint64 = 0 46 | _, _, e1 := Syscall9(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr((*offset)>>32), uintptr(count), 0, uintptr(unsafe.Pointer(&writtenOut)), 0, 0) 47 | 48 | written = int(writtenOut) 49 | 50 | if e1 != 0 { 51 | err = e1 52 | } 53 | return 54 | } 55 | 56 | func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) 57 | -------------------------------------------------------------------------------- /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 setTimespec(sec, nsec int64) Timespec { 15 | return Timespec{Sec: sec, Nsec: nsec} 16 | } 17 | 18 | func setTimeval(sec, usec int64) Timeval { 19 | return Timeval{Sec: sec, Usec: usec} 20 | } 21 | 22 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 23 | k.Ident = uint64(fd) 24 | k.Filter = int16(mode) 25 | k.Flags = uint16(flags) 26 | } 27 | 28 | func (iov *Iovec) SetLen(length int) { 29 | iov.Len = uint64(length) 30 | } 31 | 32 | func (msghdr *Msghdr) SetControllen(length int) { 33 | msghdr.Controllen = uint32(length) 34 | } 35 | 36 | func (msghdr *Msghdr) SetIovlen(length int) { 37 | msghdr.Iovlen = int32(length) 38 | } 39 | 40 | func (cmsg *Cmsghdr) SetLen(length int) { 41 | cmsg.Len = uint32(length) 42 | } 43 | 44 | func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) { 45 | var writtenOut uint64 = 0 46 | _, _, e1 := Syscall9(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr(count), 0, uintptr(unsafe.Pointer(&writtenOut)), 0, 0, 0) 47 | 48 | written = int(writtenOut) 49 | 50 | if e1 != 0 { 51 | err = e1 52 | } 53 | return 54 | } 55 | 56 | func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) 57 | -------------------------------------------------------------------------------- /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 setTimespec(sec, nsec int64) Timespec { 15 | return Timespec{Sec: sec, Nsec: int32(nsec)} 16 | } 17 | 18 | func setTimeval(sec, usec int64) Timeval { 19 | return Timeval{Sec: sec, Usec: int32(usec)} 20 | } 21 | 22 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 23 | k.Ident = uint32(fd) 24 | k.Filter = int16(mode) 25 | k.Flags = uint16(flags) 26 | } 27 | 28 | func (iov *Iovec) SetLen(length int) { 29 | iov.Len = uint32(length) 30 | } 31 | 32 | func (msghdr *Msghdr) SetControllen(length int) { 33 | msghdr.Controllen = uint32(length) 34 | } 35 | 36 | func (msghdr *Msghdr) SetIovlen(length int) { 37 | msghdr.Iovlen = int32(length) 38 | } 39 | 40 | func (cmsg *Cmsghdr) SetLen(length int) { 41 | cmsg.Len = uint32(length) 42 | } 43 | 44 | func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) { 45 | var writtenOut uint64 = 0 46 | _, _, e1 := Syscall9(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr((*offset)>>32), uintptr(count), 0, uintptr(unsafe.Pointer(&writtenOut)), 0, 0) 47 | 48 | written = int(writtenOut) 49 | 50 | if e1 != 0 { 51 | err = e1 52 | } 53 | return 54 | } 55 | 56 | func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) 57 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_freebsd_arm64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build arm64,freebsd 6 | 7 | package unix 8 | 9 | import ( 10 | "syscall" 11 | "unsafe" 12 | ) 13 | 14 | func setTimespec(sec, nsec int64) Timespec { 15 | return Timespec{Sec: sec, Nsec: nsec} 16 | } 17 | 18 | func setTimeval(sec, usec int64) Timeval { 19 | return Timeval{Sec: sec, Usec: usec} 20 | } 21 | 22 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 23 | k.Ident = uint64(fd) 24 | k.Filter = int16(mode) 25 | k.Flags = uint16(flags) 26 | } 27 | 28 | func (iov *Iovec) SetLen(length int) { 29 | iov.Len = uint64(length) 30 | } 31 | 32 | func (msghdr *Msghdr) SetControllen(length int) { 33 | msghdr.Controllen = uint32(length) 34 | } 35 | 36 | func (msghdr *Msghdr) SetIovlen(length int) { 37 | msghdr.Iovlen = int32(length) 38 | } 39 | 40 | func (cmsg *Cmsghdr) SetLen(length int) { 41 | cmsg.Len = uint32(length) 42 | } 43 | 44 | func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) { 45 | var writtenOut uint64 = 0 46 | _, _, e1 := Syscall9(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr(count), 0, uintptr(unsafe.Pointer(&writtenOut)), 0, 0, 0) 47 | 48 | written = int(writtenOut) 49 | 50 | if e1 != 0 { 51 | err = e1 52 | } 53 | return 54 | } 55 | 56 | func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) 57 | -------------------------------------------------------------------------------- /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_linux_gc.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build linux,!gccgo 6 | 7 | package unix 8 | 9 | // SyscallNoError may be used instead of Syscall for syscalls that don't fail. 10 | func SyscallNoError(trap, a1, a2, a3 uintptr) (r1, r2 uintptr) 11 | 12 | // RawSyscallNoError may be used instead of RawSyscall for syscalls that don't 13 | // fail. 14 | func RawSyscallNoError(trap, a1, a2, a3 uintptr) (r1, r2 uintptr) 15 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_linux_gc_386.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build linux,!gccgo,386 6 | 7 | package unix 8 | 9 | import "syscall" 10 | 11 | // Underlying system call writes to newoffset via pointer. 12 | // Implemented in assembly to avoid allocation. 13 | func seek(fd int, offset int64, whence int) (newoffset int64, err syscall.Errno) 14 | 15 | func socketcall(call int, a0, a1, a2, a3, a4, a5 uintptr) (n int, err syscall.Errno) 16 | func rawsocketcall(call int, a0, a1, a2, a3, a4, a5 uintptr) (n int, err syscall.Errno) 17 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_linux_gccgo_386.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build linux,gccgo,386 6 | 7 | package unix 8 | 9 | import ( 10 | "syscall" 11 | "unsafe" 12 | ) 13 | 14 | func seek(fd int, offset int64, whence int) (int64, syscall.Errno) { 15 | var newoffset int64 16 | offsetLow := uint32(offset & 0xffffffff) 17 | offsetHigh := uint32((offset >> 32) & 0xffffffff) 18 | _, _, err := Syscall6(SYS__LLSEEK, uintptr(fd), uintptr(offsetHigh), uintptr(offsetLow), uintptr(unsafe.Pointer(&newoffset)), uintptr(whence), 0) 19 | return newoffset, err 20 | } 21 | 22 | func socketcall(call int, a0, a1, a2, a3, a4, a5 uintptr) (int, syscall.Errno) { 23 | fd, _, err := Syscall(SYS_SOCKETCALL, uintptr(call), uintptr(unsafe.Pointer(&a0)), 0) 24 | return int(fd), err 25 | } 26 | 27 | func rawsocketcall(call int, a0, a1, a2, a3, a4, a5 uintptr) (int, syscall.Errno) { 28 | fd, _, err := RawSyscall(SYS_SOCKETCALL, uintptr(call), uintptr(unsafe.Pointer(&a0)), 0) 29 | return int(fd), err 30 | } 31 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_linux_gccgo_arm.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build linux,gccgo,arm 6 | 7 | package unix 8 | 9 | import ( 10 | "syscall" 11 | "unsafe" 12 | ) 13 | 14 | func seek(fd int, offset int64, whence int) (int64, syscall.Errno) { 15 | var newoffset int64 16 | offsetLow := uint32(offset & 0xffffffff) 17 | offsetHigh := uint32((offset >> 32) & 0xffffffff) 18 | _, _, err := Syscall6(SYS__LLSEEK, uintptr(fd), uintptr(offsetHigh), uintptr(offsetLow), uintptr(unsafe.Pointer(&newoffset)), uintptr(whence), 0) 19 | return newoffset, err 20 | } 21 | -------------------------------------------------------------------------------- /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 setTimespec(sec, nsec int64) Timespec { 10 | return Timespec{Sec: sec, Nsec: int32(nsec)} 11 | } 12 | 13 | func setTimeval(sec, usec int64) Timeval { 14 | return Timeval{Sec: sec, Usec: int32(usec)} 15 | } 16 | 17 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 18 | k.Ident = uint32(fd) 19 | k.Filter = uint32(mode) 20 | k.Flags = uint32(flags) 21 | } 22 | 23 | func (iov *Iovec) SetLen(length int) { 24 | iov.Len = uint32(length) 25 | } 26 | 27 | func (msghdr *Msghdr) SetControllen(length int) { 28 | msghdr.Controllen = uint32(length) 29 | } 30 | 31 | func (msghdr *Msghdr) SetIovlen(length int) { 32 | msghdr.Iovlen = int32(length) 33 | } 34 | 35 | func (cmsg *Cmsghdr) SetLen(length int) { 36 | cmsg.Len = uint32(length) 37 | } 38 | -------------------------------------------------------------------------------- /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 setTimespec(sec, nsec int64) Timespec { 10 | return Timespec{Sec: sec, Nsec: nsec} 11 | } 12 | 13 | func setTimeval(sec, usec int64) Timeval { 14 | return Timeval{Sec: sec, Usec: int32(usec)} 15 | } 16 | 17 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 18 | k.Ident = uint64(fd) 19 | k.Filter = uint32(mode) 20 | k.Flags = uint32(flags) 21 | } 22 | 23 | func (iov *Iovec) SetLen(length int) { 24 | iov.Len = uint64(length) 25 | } 26 | 27 | func (msghdr *Msghdr) SetControllen(length int) { 28 | msghdr.Controllen = uint32(length) 29 | } 30 | 31 | func (msghdr *Msghdr) SetIovlen(length int) { 32 | msghdr.Iovlen = int32(length) 33 | } 34 | 35 | func (cmsg *Cmsghdr) SetLen(length int) { 36 | cmsg.Len = uint32(length) 37 | } 38 | -------------------------------------------------------------------------------- /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 setTimespec(sec, nsec int64) Timespec { 10 | return Timespec{Sec: sec, Nsec: int32(nsec)} 11 | } 12 | 13 | func setTimeval(sec, usec int64) Timeval { 14 | return Timeval{Sec: sec, Usec: int32(usec)} 15 | } 16 | 17 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 18 | k.Ident = uint32(fd) 19 | k.Filter = uint32(mode) 20 | k.Flags = uint32(flags) 21 | } 22 | 23 | func (iov *Iovec) SetLen(length int) { 24 | iov.Len = uint32(length) 25 | } 26 | 27 | func (msghdr *Msghdr) SetControllen(length int) { 28 | msghdr.Controllen = uint32(length) 29 | } 30 | 31 | func (msghdr *Msghdr) SetIovlen(length int) { 32 | msghdr.Iovlen = int32(length) 33 | } 34 | 35 | func (cmsg *Cmsghdr) SetLen(length int) { 36 | cmsg.Len = uint32(length) 37 | } 38 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_netbsd_arm64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2019 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build arm64,netbsd 6 | 7 | package unix 8 | 9 | func setTimespec(sec, nsec int64) Timespec { 10 | return Timespec{Sec: sec, Nsec: nsec} 11 | } 12 | 13 | func setTimeval(sec, usec int64) Timeval { 14 | return Timeval{Sec: sec, Usec: int32(usec)} 15 | } 16 | 17 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 18 | k.Ident = uint64(fd) 19 | k.Filter = uint32(mode) 20 | k.Flags = uint32(flags) 21 | } 22 | 23 | func (iov *Iovec) SetLen(length int) { 24 | iov.Len = uint64(length) 25 | } 26 | 27 | func (msghdr *Msghdr) SetControllen(length int) { 28 | msghdr.Controllen = uint32(length) 29 | } 30 | 31 | func (msghdr *Msghdr) SetIovlen(length int) { 32 | msghdr.Iovlen = int32(length) 33 | } 34 | 35 | func (cmsg *Cmsghdr) SetLen(length int) { 36 | cmsg.Len = uint32(length) 37 | } 38 | -------------------------------------------------------------------------------- /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 setTimespec(sec, nsec int64) Timespec { 10 | return Timespec{Sec: sec, Nsec: int32(nsec)} 11 | } 12 | 13 | func setTimeval(sec, usec int64) Timeval { 14 | return Timeval{Sec: sec, Usec: int32(usec)} 15 | } 16 | 17 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 18 | k.Ident = uint32(fd) 19 | k.Filter = int16(mode) 20 | k.Flags = uint16(flags) 21 | } 22 | 23 | func (iov *Iovec) SetLen(length int) { 24 | iov.Len = uint32(length) 25 | } 26 | 27 | func (msghdr *Msghdr) SetControllen(length int) { 28 | msghdr.Controllen = uint32(length) 29 | } 30 | 31 | func (msghdr *Msghdr) SetIovlen(length int) { 32 | msghdr.Iovlen = uint32(length) 33 | } 34 | 35 | func (cmsg *Cmsghdr) SetLen(length int) { 36 | cmsg.Len = uint32(length) 37 | } 38 | 39 | // SYS___SYSCTL is used by syscall_bsd.go for all BSDs, but in modern versions 40 | // of openbsd/386 the syscall is called sysctl instead of __sysctl. 41 | const SYS___SYSCTL = SYS_SYSCTL 42 | -------------------------------------------------------------------------------- /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 setTimespec(sec, nsec int64) Timespec { 10 | return Timespec{Sec: sec, Nsec: nsec} 11 | } 12 | 13 | func setTimeval(sec, usec int64) Timeval { 14 | return Timeval{Sec: sec, Usec: usec} 15 | } 16 | 17 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 18 | k.Ident = uint64(fd) 19 | k.Filter = int16(mode) 20 | k.Flags = uint16(flags) 21 | } 22 | 23 | func (iov *Iovec) SetLen(length int) { 24 | iov.Len = uint64(length) 25 | } 26 | 27 | func (msghdr *Msghdr) SetControllen(length int) { 28 | msghdr.Controllen = uint32(length) 29 | } 30 | 31 | func (msghdr *Msghdr) SetIovlen(length int) { 32 | msghdr.Iovlen = uint32(length) 33 | } 34 | 35 | func (cmsg *Cmsghdr) SetLen(length int) { 36 | cmsg.Len = uint32(length) 37 | } 38 | 39 | // SYS___SYSCTL is used by syscall_bsd.go for all BSDs, but in modern versions 40 | // of openbsd/amd64 the syscall is called sysctl instead of __sysctl. 41 | const SYS___SYSCTL = SYS_SYSCTL 42 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_openbsd_arm.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build arm,openbsd 6 | 7 | package unix 8 | 9 | func setTimespec(sec, nsec int64) Timespec { 10 | return Timespec{Sec: sec, Nsec: int32(nsec)} 11 | } 12 | 13 | func setTimeval(sec, usec int64) Timeval { 14 | return Timeval{Sec: sec, Usec: int32(usec)} 15 | } 16 | 17 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 18 | k.Ident = uint32(fd) 19 | k.Filter = int16(mode) 20 | k.Flags = uint16(flags) 21 | } 22 | 23 | func (iov *Iovec) SetLen(length int) { 24 | iov.Len = uint32(length) 25 | } 26 | 27 | func (msghdr *Msghdr) SetControllen(length int) { 28 | msghdr.Controllen = uint32(length) 29 | } 30 | 31 | func (msghdr *Msghdr) SetIovlen(length int) { 32 | msghdr.Iovlen = uint32(length) 33 | } 34 | 35 | func (cmsg *Cmsghdr) SetLen(length int) { 36 | cmsg.Len = uint32(length) 37 | } 38 | 39 | // SYS___SYSCTL is used by syscall_bsd.go for all BSDs, but in modern versions 40 | // of openbsd/arm the syscall is called sysctl instead of __sysctl. 41 | const SYS___SYSCTL = SYS_SYSCTL 42 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_openbsd_arm64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2019 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build arm64,openbsd 6 | 7 | package unix 8 | 9 | func setTimespec(sec, nsec int64) Timespec { 10 | return Timespec{Sec: sec, Nsec: nsec} 11 | } 12 | 13 | func setTimeval(sec, usec int64) Timeval { 14 | return Timeval{Sec: sec, Usec: usec} 15 | } 16 | 17 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 18 | k.Ident = uint64(fd) 19 | k.Filter = int16(mode) 20 | k.Flags = uint16(flags) 21 | } 22 | 23 | func (iov *Iovec) SetLen(length int) { 24 | iov.Len = uint64(length) 25 | } 26 | 27 | func (msghdr *Msghdr) SetControllen(length int) { 28 | msghdr.Controllen = uint32(length) 29 | } 30 | 31 | func (msghdr *Msghdr) SetIovlen(length int) { 32 | msghdr.Iovlen = uint32(length) 33 | } 34 | 35 | func (cmsg *Cmsghdr) SetLen(length int) { 36 | cmsg.Len = uint32(length) 37 | } 38 | 39 | // SYS___SYSCTL is used by syscall_bsd.go for all BSDs, but in modern versions 40 | // of openbsd/amd64 the syscall is called sysctl instead of __sysctl. 41 | const SYS___SYSCTL = SYS_SYSCTL 42 | -------------------------------------------------------------------------------- /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 setTimespec(sec, nsec int64) Timespec { 10 | return Timespec{Sec: sec, Nsec: nsec} 11 | } 12 | 13 | func setTimeval(sec, usec int64) Timeval { 14 | return Timeval{Sec: sec, Usec: usec} 15 | } 16 | 17 | func (iov *Iovec) SetLen(length int) { 18 | iov.Len = uint64(length) 19 | } 20 | 21 | func (msghdr *Msghdr) SetIovlen(length int) { 22 | msghdr.Iovlen = int32(length) 23 | } 24 | 25 | func (cmsg *Cmsghdr) SetLen(length int) { 26 | cmsg.Len = uint32(length) 27 | } 28 | -------------------------------------------------------------------------------- /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,!ppc64le,!ppc64 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/syscall_unix_gc_ppc64x.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build linux 6 | // +build ppc64le ppc64 7 | // +build !gccgo 8 | 9 | package unix 10 | 11 | import "syscall" 12 | 13 | func Syscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.Errno) { 14 | return syscall.Syscall(trap, a1, a2, a3) 15 | } 16 | func Syscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err syscall.Errno) { 17 | return syscall.Syscall6(trap, a1, a2, a3, a4, a5, a6) 18 | } 19 | func RawSyscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.Errno) { 20 | return syscall.RawSyscall(trap, a1, a2, a3) 21 | } 22 | func RawSyscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err syscall.Errno) { 23 | return syscall.RawSyscall6(trap, a1, a2, a3, a4, a5, a6) 24 | } 25 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/timestruct.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build aix darwin dragonfly freebsd linux netbsd openbsd solaris 6 | 7 | package unix 8 | 9 | import "time" 10 | 11 | // TimespecToNsec converts a Timespec value into a number of 12 | // nanoseconds since the Unix epoch. 13 | func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) } 14 | 15 | // NsecToTimespec takes a number of nanoseconds since the Unix epoch 16 | // and returns the corresponding Timespec value. 17 | func NsecToTimespec(nsec int64) Timespec { 18 | sec := nsec / 1e9 19 | nsec = nsec % 1e9 20 | if nsec < 0 { 21 | nsec += 1e9 22 | sec-- 23 | } 24 | return setTimespec(sec, nsec) 25 | } 26 | 27 | // TimeToTimespec converts t into a Timespec. 28 | // On some 32-bit systems the range of valid Timespec values are smaller 29 | // than that of time.Time values. So if t is out of the valid range of 30 | // Timespec, it returns a zero Timespec and ERANGE. 31 | func TimeToTimespec(t time.Time) (Timespec, error) { 32 | sec := t.Unix() 33 | nsec := int64(t.Nanosecond()) 34 | ts := setTimespec(sec, nsec) 35 | 36 | // Currently all targets have either int32 or int64 for Timespec.Sec. 37 | // If there were a new target with floating point type for it, we have 38 | // to consider the rounding error. 39 | if int64(ts.Sec) != sec { 40 | return Timespec{}, ERANGE 41 | } 42 | return ts, nil 43 | } 44 | 45 | // TimevalToNsec converts a Timeval value into a number of nanoseconds 46 | // since the Unix epoch. 47 | func TimevalToNsec(tv Timeval) int64 { return int64(tv.Sec)*1e9 + int64(tv.Usec)*1e3 } 48 | 49 | // NsecToTimeval takes a number of nanoseconds since the Unix epoch 50 | // and returns the corresponding Timeval value. 51 | func NsecToTimeval(nsec int64) Timeval { 52 | nsec += 999 // round up to microsecond 53 | usec := nsec % 1e9 / 1e3 54 | sec := nsec / 1e9 55 | if usec < 0 { 56 | usec += 1e6 57 | sec-- 58 | } 59 | return setTimeval(sec, usec) 60 | } 61 | 62 | // Unix returns ts as the number of seconds and nanoseconds elapsed since the 63 | // Unix epoch. 64 | func (ts *Timespec) Unix() (sec int64, nsec int64) { 65 | return int64(ts.Sec), int64(ts.Nsec) 66 | } 67 | 68 | // Unix returns tv as the number of seconds and nanoseconds elapsed since the 69 | // Unix epoch. 70 | func (tv *Timeval) Unix() (sec int64, nsec int64) { 71 | return int64(tv.Sec), int64(tv.Usec) * 1000 72 | } 73 | 74 | // Nano returns ts as the number of nanoseconds elapsed since the Unix epoch. 75 | func (ts *Timespec) Nano() int64 { 76 | return int64(ts.Sec)*1e9 + int64(ts.Nsec) 77 | } 78 | 79 | // Nano returns tv as the number of nanoseconds elapsed since the Unix epoch. 80 | func (tv *Timeval) Nano() int64 { 81 | return int64(tv.Sec)*1e9 + int64(tv.Usec)*1000 82 | } 83 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/unveil_openbsd.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package unix 6 | 7 | import ( 8 | "syscall" 9 | "unsafe" 10 | ) 11 | 12 | // Unveil implements the unveil syscall. 13 | // For more information see unveil(2). 14 | // Note that the special case of blocking further 15 | // unveil calls is handled by UnveilBlock. 16 | func Unveil(path string, flags string) error { 17 | pathPtr, err := syscall.BytePtrFromString(path) 18 | if err != nil { 19 | return err 20 | } 21 | flagsPtr, err := syscall.BytePtrFromString(flags) 22 | if err != nil { 23 | return err 24 | } 25 | _, _, e := syscall.Syscall(SYS_UNVEIL, uintptr(unsafe.Pointer(pathPtr)), uintptr(unsafe.Pointer(flagsPtr)), 0) 26 | if e != 0 { 27 | return e 28 | } 29 | return nil 30 | } 31 | 32 | // UnveilBlock blocks future unveil calls. 33 | // For more information see unveil(2). 34 | func UnveilBlock() error { 35 | // Both pointers must be nil. 36 | var pathUnsafe, flagsUnsafe unsafe.Pointer 37 | _, _, e := syscall.Syscall(SYS_UNVEIL, uintptr(pathUnsafe), uintptr(flagsUnsafe), 0) 38 | if e != 0 { 39 | return e 40 | } 41 | return nil 42 | } 43 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/zptrace386_linux.go: -------------------------------------------------------------------------------- 1 | // Code generated by linux/mkall.go generatePtracePair(386, amd64). DO NOT EDIT. 2 | 3 | // +build linux 4 | // +build 386 amd64 5 | 6 | package unix 7 | 8 | import "unsafe" 9 | 10 | // PtraceRegs386 is the registers used by 386 binaries. 11 | type PtraceRegs386 struct { 12 | Ebx int32 13 | Ecx int32 14 | Edx int32 15 | Esi int32 16 | Edi int32 17 | Ebp int32 18 | Eax int32 19 | Xds int32 20 | Xes int32 21 | Xfs int32 22 | Xgs int32 23 | Orig_eax int32 24 | Eip int32 25 | Xcs int32 26 | Eflags int32 27 | Esp int32 28 | Xss int32 29 | } 30 | 31 | // PtraceGetRegs386 fetches the registers used by 386 binaries. 32 | func PtraceGetRegs386(pid int, regsout *PtraceRegs386) error { 33 | return ptrace(PTRACE_GETREGS, pid, 0, uintptr(unsafe.Pointer(regsout))) 34 | } 35 | 36 | // PtraceSetRegs386 sets the registers used by 386 binaries. 37 | func PtraceSetRegs386(pid int, regs *PtraceRegs386) error { 38 | return ptrace(PTRACE_SETREGS, pid, 0, uintptr(unsafe.Pointer(regs))) 39 | } 40 | 41 | // PtraceRegsAmd64 is the registers used by amd64 binaries. 42 | type PtraceRegsAmd64 struct { 43 | R15 uint64 44 | R14 uint64 45 | R13 uint64 46 | R12 uint64 47 | Rbp uint64 48 | Rbx uint64 49 | R11 uint64 50 | R10 uint64 51 | R9 uint64 52 | R8 uint64 53 | Rax uint64 54 | Rcx uint64 55 | Rdx uint64 56 | Rsi uint64 57 | Rdi uint64 58 | Orig_rax uint64 59 | Rip uint64 60 | Cs uint64 61 | Eflags uint64 62 | Rsp uint64 63 | Ss uint64 64 | Fs_base uint64 65 | Gs_base uint64 66 | Ds uint64 67 | Es uint64 68 | Fs uint64 69 | Gs uint64 70 | } 71 | 72 | // PtraceGetRegsAmd64 fetches the registers used by amd64 binaries. 73 | func PtraceGetRegsAmd64(pid int, regsout *PtraceRegsAmd64) error { 74 | return ptrace(PTRACE_GETREGS, pid, 0, uintptr(unsafe.Pointer(regsout))) 75 | } 76 | 77 | // PtraceSetRegsAmd64 sets the registers used by amd64 binaries. 78 | func PtraceSetRegsAmd64(pid int, regs *PtraceRegsAmd64) error { 79 | return ptrace(PTRACE_SETREGS, pid, 0, uintptr(unsafe.Pointer(regs))) 80 | } 81 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/zptracearm_linux.go: -------------------------------------------------------------------------------- 1 | // Code generated by linux/mkall.go generatePtracePair(arm, arm64). DO NOT EDIT. 2 | 3 | // +build linux 4 | // +build arm arm64 5 | 6 | package unix 7 | 8 | import "unsafe" 9 | 10 | // PtraceRegsArm is the registers used by arm binaries. 11 | type PtraceRegsArm struct { 12 | Uregs [18]uint32 13 | } 14 | 15 | // PtraceGetRegsArm fetches the registers used by arm binaries. 16 | func PtraceGetRegsArm(pid int, regsout *PtraceRegsArm) error { 17 | return ptrace(PTRACE_GETREGS, pid, 0, uintptr(unsafe.Pointer(regsout))) 18 | } 19 | 20 | // PtraceSetRegsArm sets the registers used by arm binaries. 21 | func PtraceSetRegsArm(pid int, regs *PtraceRegsArm) error { 22 | return ptrace(PTRACE_SETREGS, pid, 0, uintptr(unsafe.Pointer(regs))) 23 | } 24 | 25 | // PtraceRegsArm64 is the registers used by arm64 binaries. 26 | type PtraceRegsArm64 struct { 27 | Regs [31]uint64 28 | Sp uint64 29 | Pc uint64 30 | Pstate uint64 31 | } 32 | 33 | // PtraceGetRegsArm64 fetches the registers used by arm64 binaries. 34 | func PtraceGetRegsArm64(pid int, regsout *PtraceRegsArm64) error { 35 | return ptrace(PTRACE_GETREGS, pid, 0, uintptr(unsafe.Pointer(regsout))) 36 | } 37 | 38 | // PtraceSetRegsArm64 sets the registers used by arm64 binaries. 39 | func PtraceSetRegsArm64(pid int, regs *PtraceRegsArm64) error { 40 | return ptrace(PTRACE_SETREGS, pid, 0, uintptr(unsafe.Pointer(regs))) 41 | } 42 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/zptracemips_linux.go: -------------------------------------------------------------------------------- 1 | // Code generated by linux/mkall.go generatePtracePair(mips, mips64). DO NOT EDIT. 2 | 3 | // +build linux 4 | // +build mips mips64 5 | 6 | package unix 7 | 8 | import "unsafe" 9 | 10 | // PtraceRegsMips is the registers used by mips binaries. 11 | type PtraceRegsMips struct { 12 | Regs [32]uint64 13 | Lo uint64 14 | Hi uint64 15 | Epc uint64 16 | Badvaddr uint64 17 | Status uint64 18 | Cause uint64 19 | } 20 | 21 | // PtraceGetRegsMips fetches the registers used by mips binaries. 22 | func PtraceGetRegsMips(pid int, regsout *PtraceRegsMips) error { 23 | return ptrace(PTRACE_GETREGS, pid, 0, uintptr(unsafe.Pointer(regsout))) 24 | } 25 | 26 | // PtraceSetRegsMips sets the registers used by mips binaries. 27 | func PtraceSetRegsMips(pid int, regs *PtraceRegsMips) error { 28 | return ptrace(PTRACE_SETREGS, pid, 0, uintptr(unsafe.Pointer(regs))) 29 | } 30 | 31 | // PtraceRegsMips64 is the registers used by mips64 binaries. 32 | type PtraceRegsMips64 struct { 33 | Regs [32]uint64 34 | Lo uint64 35 | Hi uint64 36 | Epc uint64 37 | Badvaddr uint64 38 | Status uint64 39 | Cause uint64 40 | } 41 | 42 | // PtraceGetRegsMips64 fetches the registers used by mips64 binaries. 43 | func PtraceGetRegsMips64(pid int, regsout *PtraceRegsMips64) error { 44 | return ptrace(PTRACE_GETREGS, pid, 0, uintptr(unsafe.Pointer(regsout))) 45 | } 46 | 47 | // PtraceSetRegsMips64 sets the registers used by mips64 binaries. 48 | func PtraceSetRegsMips64(pid int, regs *PtraceRegsMips64) error { 49 | return ptrace(PTRACE_SETREGS, pid, 0, uintptr(unsafe.Pointer(regs))) 50 | } 51 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/zptracemipsle_linux.go: -------------------------------------------------------------------------------- 1 | // Code generated by linux/mkall.go generatePtracePair(mipsle, mips64le). DO NOT EDIT. 2 | 3 | // +build linux 4 | // +build mipsle mips64le 5 | 6 | package unix 7 | 8 | import "unsafe" 9 | 10 | // PtraceRegsMipsle is the registers used by mipsle binaries. 11 | type PtraceRegsMipsle struct { 12 | Regs [32]uint64 13 | Lo uint64 14 | Hi uint64 15 | Epc uint64 16 | Badvaddr uint64 17 | Status uint64 18 | Cause uint64 19 | } 20 | 21 | // PtraceGetRegsMipsle fetches the registers used by mipsle binaries. 22 | func PtraceGetRegsMipsle(pid int, regsout *PtraceRegsMipsle) error { 23 | return ptrace(PTRACE_GETREGS, pid, 0, uintptr(unsafe.Pointer(regsout))) 24 | } 25 | 26 | // PtraceSetRegsMipsle sets the registers used by mipsle binaries. 27 | func PtraceSetRegsMipsle(pid int, regs *PtraceRegsMipsle) error { 28 | return ptrace(PTRACE_SETREGS, pid, 0, uintptr(unsafe.Pointer(regs))) 29 | } 30 | 31 | // PtraceRegsMips64le is the registers used by mips64le binaries. 32 | type PtraceRegsMips64le struct { 33 | Regs [32]uint64 34 | Lo uint64 35 | Hi uint64 36 | Epc uint64 37 | Badvaddr uint64 38 | Status uint64 39 | Cause uint64 40 | } 41 | 42 | // PtraceGetRegsMips64le fetches the registers used by mips64le binaries. 43 | func PtraceGetRegsMips64le(pid int, regsout *PtraceRegsMips64le) error { 44 | return ptrace(PTRACE_GETREGS, pid, 0, uintptr(unsafe.Pointer(regsout))) 45 | } 46 | 47 | // PtraceSetRegsMips64le sets the registers used by mips64le binaries. 48 | func PtraceSetRegsMips64le(pid int, regs *PtraceRegsMips64le) error { 49 | return ptrace(PTRACE_SETREGS, pid, 0, uintptr(unsafe.Pointer(regs))) 50 | } 51 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/zsyscall_darwin_386.1_13.go: -------------------------------------------------------------------------------- 1 | // go run mksyscall.go -l32 -tags darwin,386,go1.13 syscall_darwin.1_13.go 2 | // Code generated by the command above; see README.md. DO NOT EDIT. 3 | 4 | // +build darwin,386,go1.13 5 | 6 | package unix 7 | 8 | import ( 9 | "syscall" 10 | "unsafe" 11 | ) 12 | 13 | var _ syscall.Errno 14 | 15 | // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT 16 | 17 | func closedir(dir uintptr) (err error) { 18 | _, _, e1 := syscall_syscall(funcPC(libc_closedir_trampoline), uintptr(dir), 0, 0) 19 | if e1 != 0 { 20 | err = errnoErr(e1) 21 | } 22 | return 23 | } 24 | 25 | func libc_closedir_trampoline() 26 | 27 | //go:linkname libc_closedir libc_closedir 28 | //go:cgo_import_dynamic libc_closedir closedir "/usr/lib/libSystem.B.dylib" 29 | 30 | // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT 31 | 32 | func readdir_r(dir uintptr, entry *Dirent, result **Dirent) (res Errno) { 33 | r0, _, _ := syscall_syscall(funcPC(libc_readdir_r_trampoline), uintptr(dir), uintptr(unsafe.Pointer(entry)), uintptr(unsafe.Pointer(result))) 34 | res = Errno(r0) 35 | return 36 | } 37 | 38 | func libc_readdir_r_trampoline() 39 | 40 | //go:linkname libc_readdir_r libc_readdir_r 41 | //go:cgo_import_dynamic libc_readdir_r readdir_r "/usr/lib/libSystem.B.dylib" 42 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/zsyscall_darwin_386.1_13.s: -------------------------------------------------------------------------------- 1 | // go run mkasm_darwin.go 386 2 | // Code generated by the command above; DO NOT EDIT. 3 | 4 | // +build go1.13 5 | 6 | #include "textflag.h" 7 | TEXT ·libc_fdopendir_trampoline(SB),NOSPLIT,$0-0 8 | JMP libc_fdopendir(SB) 9 | TEXT ·libc_closedir_trampoline(SB),NOSPLIT,$0-0 10 | JMP libc_closedir(SB) 11 | TEXT ·libc_readdir_r_trampoline(SB),NOSPLIT,$0-0 12 | JMP libc_readdir_r(SB) 13 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.1_13.go: -------------------------------------------------------------------------------- 1 | // go run mksyscall.go -tags darwin,amd64,go1.13 syscall_darwin.1_13.go 2 | // Code generated by the command above; see README.md. DO NOT EDIT. 3 | 4 | // +build darwin,amd64,go1.13 5 | 6 | package unix 7 | 8 | import ( 9 | "syscall" 10 | "unsafe" 11 | ) 12 | 13 | var _ syscall.Errno 14 | 15 | // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT 16 | 17 | func closedir(dir uintptr) (err error) { 18 | _, _, e1 := syscall_syscall(funcPC(libc_closedir_trampoline), uintptr(dir), 0, 0) 19 | if e1 != 0 { 20 | err = errnoErr(e1) 21 | } 22 | return 23 | } 24 | 25 | func libc_closedir_trampoline() 26 | 27 | //go:linkname libc_closedir libc_closedir 28 | //go:cgo_import_dynamic libc_closedir closedir "/usr/lib/libSystem.B.dylib" 29 | 30 | // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT 31 | 32 | func readdir_r(dir uintptr, entry *Dirent, result **Dirent) (res Errno) { 33 | r0, _, _ := syscall_syscall(funcPC(libc_readdir_r_trampoline), uintptr(dir), uintptr(unsafe.Pointer(entry)), uintptr(unsafe.Pointer(result))) 34 | res = Errno(r0) 35 | return 36 | } 37 | 38 | func libc_readdir_r_trampoline() 39 | 40 | //go:linkname libc_readdir_r libc_readdir_r 41 | //go:cgo_import_dynamic libc_readdir_r readdir_r "/usr/lib/libSystem.B.dylib" 42 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.1_13.s: -------------------------------------------------------------------------------- 1 | // go run mkasm_darwin.go amd64 2 | // Code generated by the command above; DO NOT EDIT. 3 | 4 | // +build go1.13 5 | 6 | #include "textflag.h" 7 | TEXT ·libc_fdopendir_trampoline(SB),NOSPLIT,$0-0 8 | JMP libc_fdopendir(SB) 9 | TEXT ·libc_closedir_trampoline(SB),NOSPLIT,$0-0 10 | JMP libc_closedir(SB) 11 | TEXT ·libc_readdir_r_trampoline(SB),NOSPLIT,$0-0 12 | JMP libc_readdir_r(SB) 13 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/zsyscall_darwin_arm.1_13.go: -------------------------------------------------------------------------------- 1 | // go run mksyscall.go -l32 -tags darwin,arm,go1.13 syscall_darwin.1_13.go 2 | // Code generated by the command above; see README.md. DO NOT EDIT. 3 | 4 | // +build darwin,arm,go1.13 5 | 6 | package unix 7 | 8 | import ( 9 | "syscall" 10 | "unsafe" 11 | ) 12 | 13 | var _ syscall.Errno 14 | 15 | // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT 16 | 17 | func closedir(dir uintptr) (err error) { 18 | _, _, e1 := syscall_syscall(funcPC(libc_closedir_trampoline), uintptr(dir), 0, 0) 19 | if e1 != 0 { 20 | err = errnoErr(e1) 21 | } 22 | return 23 | } 24 | 25 | func libc_closedir_trampoline() 26 | 27 | //go:linkname libc_closedir libc_closedir 28 | //go:cgo_import_dynamic libc_closedir closedir "/usr/lib/libSystem.B.dylib" 29 | 30 | // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT 31 | 32 | func readdir_r(dir uintptr, entry *Dirent, result **Dirent) (res Errno) { 33 | r0, _, _ := syscall_syscall(funcPC(libc_readdir_r_trampoline), uintptr(dir), uintptr(unsafe.Pointer(entry)), uintptr(unsafe.Pointer(result))) 34 | res = Errno(r0) 35 | return 36 | } 37 | 38 | func libc_readdir_r_trampoline() 39 | 40 | //go:linkname libc_readdir_r libc_readdir_r 41 | //go:cgo_import_dynamic libc_readdir_r readdir_r "/usr/lib/libSystem.B.dylib" 42 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/zsyscall_darwin_arm.1_13.s: -------------------------------------------------------------------------------- 1 | // go run mkasm_darwin.go arm 2 | // Code generated by the command above; DO NOT EDIT. 3 | 4 | // +build go1.13 5 | 6 | #include "textflag.h" 7 | TEXT ·libc_fdopendir_trampoline(SB),NOSPLIT,$0-0 8 | JMP libc_fdopendir(SB) 9 | TEXT ·libc_closedir_trampoline(SB),NOSPLIT,$0-0 10 | JMP libc_closedir(SB) 11 | TEXT ·libc_readdir_r_trampoline(SB),NOSPLIT,$0-0 12 | JMP libc_readdir_r(SB) 13 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.1_13.go: -------------------------------------------------------------------------------- 1 | // go run mksyscall.go -tags darwin,arm64,go1.13 syscall_darwin.1_13.go 2 | // Code generated by the command above; see README.md. DO NOT EDIT. 3 | 4 | // +build darwin,arm64,go1.13 5 | 6 | package unix 7 | 8 | import ( 9 | "syscall" 10 | "unsafe" 11 | ) 12 | 13 | var _ syscall.Errno 14 | 15 | // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT 16 | 17 | func closedir(dir uintptr) (err error) { 18 | _, _, e1 := syscall_syscall(funcPC(libc_closedir_trampoline), uintptr(dir), 0, 0) 19 | if e1 != 0 { 20 | err = errnoErr(e1) 21 | } 22 | return 23 | } 24 | 25 | func libc_closedir_trampoline() 26 | 27 | //go:linkname libc_closedir libc_closedir 28 | //go:cgo_import_dynamic libc_closedir closedir "/usr/lib/libSystem.B.dylib" 29 | 30 | // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT 31 | 32 | func readdir_r(dir uintptr, entry *Dirent, result **Dirent) (res Errno) { 33 | r0, _, _ := syscall_syscall(funcPC(libc_readdir_r_trampoline), uintptr(dir), uintptr(unsafe.Pointer(entry)), uintptr(unsafe.Pointer(result))) 34 | res = Errno(r0) 35 | return 36 | } 37 | 38 | func libc_readdir_r_trampoline() 39 | 40 | //go:linkname libc_readdir_r libc_readdir_r 41 | //go:cgo_import_dynamic libc_readdir_r readdir_r "/usr/lib/libSystem.B.dylib" 42 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.1_13.s: -------------------------------------------------------------------------------- 1 | // go run mkasm_darwin.go arm64 2 | // Code generated by the command above; DO NOT EDIT. 3 | 4 | // +build go1.13 5 | 6 | #include "textflag.h" 7 | TEXT ·libc_fdopendir_trampoline(SB),NOSPLIT,$0-0 8 | JMP libc_fdopendir(SB) 9 | TEXT ·libc_closedir_trampoline(SB),NOSPLIT,$0-0 10 | JMP libc_closedir(SB) 11 | TEXT ·libc_readdir_r_trampoline(SB),NOSPLIT,$0-0 12 | JMP libc_readdir_r(SB) 13 | -------------------------------------------------------------------------------- /vendor/syreclabs.com/go/faker/.travis.yml: -------------------------------------------------------------------------------- 1 | --- 2 | language: go 3 | 4 | go: 5 | - 1.x 6 | - master 7 | 8 | go_import_path: syreclabs.com/go/faker 9 | 10 | before_install: 11 | - go get github.com/mattn/goveralls 12 | 13 | script: 14 | - $GOPATH/bin/goveralls -service=travis-ci -package . 15 | -------------------------------------------------------------------------------- /vendor/syreclabs.com/go/faker/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Dmitri Goutnik 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /vendor/syreclabs.com/go/faker/app.go: -------------------------------------------------------------------------------- 1 | package faker 2 | 3 | import "fmt" 4 | 5 | type FakeApp interface { 6 | Name() string // => "Alphazap" 7 | Version() string // => "2.6.0" 8 | Author() string // => "Dorian Shields" 9 | String() string // => "Tempsoft 4.51" 10 | } 11 | 12 | type fakeApp struct{} 13 | 14 | func App() FakeApp { 15 | return fakeApp{} 16 | } 17 | 18 | func (a fakeApp) Name() string { 19 | return Fetch("app.name") 20 | } 21 | 22 | func (a fakeApp) Version() string { 23 | return Numerify(Fetch("app.version")) 24 | } 25 | 26 | func (a fakeApp) Author() string { 27 | return Fetch("app.author") 28 | } 29 | 30 | func (a fakeApp) String() string { 31 | return fmt.Sprintf("%v %v", a.Name(), a.Version()) 32 | } 33 | -------------------------------------------------------------------------------- /vendor/syreclabs.com/go/faker/avatar.go: -------------------------------------------------------------------------------- 1 | package faker 2 | 3 | import "fmt" 4 | 5 | type FakeAvatar interface { 6 | Url(format string, width, height int) string // => "http://robohash.org/NX34rZw7s0VFzgWY.jpg?size=100x200" 7 | String() string // => "http://robohash.org/XRWjFigoImqdeDuA.png?size=300x300" 8 | } 9 | 10 | type fakeAvatar struct{} 11 | 12 | func Avatar() FakeAvatar { 13 | return fakeAvatar{} 14 | } 15 | 16 | func (a fakeAvatar) Url(format string, w, h int) string { 17 | return fmt.Sprintf("http://robohash.org/%s.%s?size=%dx%d", Lorem().Characters(16), format, w, h) 18 | } 19 | 20 | func (a fakeAvatar) String() string { 21 | return a.Url("png", 300, 300) 22 | } 23 | -------------------------------------------------------------------------------- /vendor/syreclabs.com/go/faker/bitcoin.go: -------------------------------------------------------------------------------- 1 | package faker 2 | 3 | import ( 4 | "crypto/sha256" 5 | "math/big" 6 | ) 7 | 8 | type FakeBitcoin interface { 9 | Address() string // => "1GpEKM5UvD4XDLMirpNLoDnRVrGutogMj2" 10 | String() string // String is an alias for Address. 11 | } 12 | 13 | type fakeBitcoin struct{} 14 | 15 | func Bitcoin() FakeBitcoin { 16 | return fakeBitcoin{} 17 | } 18 | 19 | func (b fakeBitcoin) Address() string { 20 | v := make([]byte, 20) 21 | localRand.Read(v) 22 | 23 | return string(encodeBase58Check(v)) 24 | } 25 | 26 | func encodeBase58Check(val []byte) []byte { 27 | const alphabet = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz" 28 | 29 | // payload 30 | p := make([]byte, 1+len(val)) // version byte (0x00) + val 31 | copy(p[1:], val) 32 | h1 := sha256.Sum256(p) 33 | h2 := sha256.Sum256(h1[:]) 34 | 35 | // value as []byte 36 | v := make([]byte, len(p)+4) // payload + first 4 bytes of h2 37 | copy(v, p) 38 | copy(v[len(p):], h2[:4]) 39 | 40 | var res []byte 41 | x := new(big.Int).SetBytes(v) 42 | y := big.NewInt(58) 43 | m, zero := new(big.Int), new(big.Int) 44 | 45 | // convert to base58 46 | for x.Cmp(zero) > 0 { 47 | x, m = x.DivMod(x, y, m) 48 | res = append(res, alphabet[m.Int64()]) 49 | } 50 | // append '1' for each leading zero byte in value 51 | for i := 0; v[i] == 0; i++ { 52 | res = append(res, alphabet[0]) 53 | } 54 | // reverse 55 | for i, j := 0, len(res)-1; i < j; i, j = i+1, j-1 { 56 | res[i], res[j] = res[j], res[i] 57 | } 58 | 59 | return res 60 | } 61 | 62 | func (b fakeBitcoin) String() string { 63 | return b.Address() 64 | } 65 | -------------------------------------------------------------------------------- /vendor/syreclabs.com/go/faker/business.go: -------------------------------------------------------------------------------- 1 | package faker 2 | 3 | type FakeBusiness interface { 4 | CreditCardNumber() string // => "1234-2121-1221-1211" 5 | CreditCardExpiryDate() string // => "2015-11-11" 6 | CreditCardType() string // => "mastercard" 7 | } 8 | 9 | type fakeBusiness struct{} 10 | 11 | func Business() FakeBusiness { 12 | return fakeBusiness{} 13 | } 14 | 15 | func (b fakeBusiness) CreditCardNumber() string { 16 | return Fetch("business.credit_card_numbers") 17 | } 18 | 19 | func (b fakeBusiness) CreditCardExpiryDate() string { 20 | return Fetch("business.credit_card_expiry_dates") 21 | } 22 | 23 | func (b fakeBusiness) CreditCardType() string { 24 | return Fetch("business.credit_card_types") 25 | } 26 | -------------------------------------------------------------------------------- /vendor/syreclabs.com/go/faker/commerce.go: -------------------------------------------------------------------------------- 1 | package faker 2 | 3 | import ( 4 | "math" 5 | "strings" 6 | ) 7 | 8 | type FakeCommerce interface { 9 | Color() string // => "lime" 10 | Department() string // => "Electronics, Health & Baby" 11 | ProductName() string // => "Ergonomic Granite Shoes" 12 | Price() float32 // => 97.79 13 | } 14 | 15 | type fakeCommerce struct{} 16 | 17 | func Commerce() FakeCommerce { 18 | return fakeCommerce{} 19 | } 20 | 21 | func (c fakeCommerce) Color() string { 22 | return Fetch("commerce.color") 23 | } 24 | 25 | func (c fakeCommerce) Department() string { 26 | n := RandomInt(1, 3) 27 | 28 | deps := make([]string, n) 29 | for i := range deps { 30 | d := Fetch("commerce.department") 31 | for includesString(deps, d) { 32 | d = Fetch("commerce.department") 33 | } 34 | deps[i] = d 35 | } 36 | 37 | if n > 1 { 38 | sep := Fetch("separator") 39 | res := strings.Join([]string{ 40 | strings.Join(deps[0:len(deps)-1], ", "), 41 | deps[len(deps)-1], 42 | }, sep) 43 | return res 44 | } 45 | return deps[0] 46 | } 47 | 48 | func (c fakeCommerce) ProductName() string { 49 | words := []string{ 50 | Fetch("commerce.product_name.adjective"), 51 | Fetch("commerce.product_name.material"), 52 | Fetch("commerce.product_name.product"), 53 | } 54 | return strings.Join(words, " ") 55 | } 56 | 57 | func (c fakeCommerce) Price() float32 { 58 | return float32(math.Floor(localRand.Float64()*10000.0)/100.0 + 0.01) 59 | } 60 | -------------------------------------------------------------------------------- /vendor/syreclabs.com/go/faker/company.go: -------------------------------------------------------------------------------- 1 | package faker 2 | 3 | import "fmt" 4 | 5 | type FakeCompany interface { 6 | Name() string // => "Aufderhar LLC" 7 | Suffix() string // => "Inc" 8 | CatchPhrase() string // => "Universal logistical artificial intelligence" 9 | Bs() string // => "engage distributed applications" 10 | Ein() string // => "58-6520513" 11 | DunsNumber() string // => "16-708-2968" 12 | Logo() string // => "http://www.biz-logo.com/examples/015.gif" 13 | String() string // String is an alias for Name. 14 | } 15 | 16 | type fakeCompany struct{} 17 | 18 | func Company() FakeCompany { 19 | return fakeCompany{} 20 | } 21 | 22 | func (c fakeCompany) Name() string { 23 | return Fetch("company.name") 24 | } 25 | 26 | func (c fakeCompany) Suffix() string { 27 | return Fetch("company.suffix") 28 | } 29 | 30 | func (c fakeCompany) CatchPhrase() string { 31 | return Fetch("company.buzzwords") 32 | } 33 | 34 | func (c fakeCompany) Bs() string { 35 | return Fetch("company.bs") 36 | } 37 | 38 | func (c fakeCompany) Ein() string { 39 | return Numerify("##-#######") 40 | } 41 | 42 | func (c fakeCompany) DunsNumber() string { 43 | return Numerify("##-###-####") 44 | } 45 | 46 | func (c fakeCompany) Logo() string { 47 | n := RandomInt(1, 77) 48 | return fmt.Sprintf("http://www.biz-logo.com/examples/%03d.gif", n) 49 | } 50 | 51 | func (c fakeCompany) String() string { 52 | return c.Name() 53 | } 54 | -------------------------------------------------------------------------------- /vendor/syreclabs.com/go/faker/date.go: -------------------------------------------------------------------------------- 1 | package faker 2 | 3 | import "time" 4 | 5 | type FakeDate interface { 6 | // Between returns random time in [from, to] interval, with second resolution. 7 | Between(from, to time.Time) time.Time 8 | 9 | // Forward returns random time in [time.Now(), time.Now() + duration] interval, with second resolution. 10 | Forward(duration time.Duration) time.Time 11 | 12 | // Backward returns random time in [time.Now() - duration, time.Now()] interval, with second resolution. 13 | Backward(duration time.Duration) time.Time 14 | 15 | // Birthday returns random time so that age of the person born at that moment would be between minAge and maxAge years. 16 | Birthday(minAge, maxAge int) time.Time 17 | } 18 | 19 | type fakeDate struct{} 20 | 21 | func Date() FakeDate { 22 | return fakeDate{} 23 | } 24 | 25 | func (d fakeDate) Between(from, to time.Time) time.Time { 26 | if to.Sub(from) < 0 { 27 | panic("invalid time range") 28 | } 29 | return time.Unix(RandomInt64(from.Unix(), to.Unix()), 0) 30 | } 31 | 32 | func (d fakeDate) Forward(duration time.Duration) time.Time { 33 | if duration < 0 { 34 | panic("invalid duration") 35 | } 36 | now := time.Now() 37 | return d.Between(now, now.Add(duration)) 38 | } 39 | 40 | func (d fakeDate) Backward(duration time.Duration) time.Time { 41 | if duration < 0 { 42 | panic("invalid duration") 43 | } 44 | now := time.Now() 45 | return d.Between(now.Add(-duration), now) 46 | } 47 | 48 | func (d fakeDate) Birthday(minAge, maxAge int) time.Time { 49 | if minAge > maxAge { 50 | panic("invalid age range") 51 | } 52 | now := time.Now() 53 | from := now.AddDate(-maxAge, 0, 0) 54 | to := now.AddDate(-minAge, 0, 0) 55 | return d.Between(from, to) 56 | } 57 | -------------------------------------------------------------------------------- /vendor/syreclabs.com/go/faker/finance.go: -------------------------------------------------------------------------------- 1 | package faker 2 | 3 | import ( 4 | "regexp" 5 | "strconv" 6 | "strings" 7 | ) 8 | 9 | type FakeFinance interface { 10 | // CreditCard returns a valid (with valid check digit) card number of one of the given types. 11 | // If no types are passed, all types in CC_TYPES are used. 12 | CreditCard(types ...string) string // => "5019-8413-2066-5594" 13 | } 14 | 15 | type fakeFinance struct{} 16 | 17 | func Finance() FakeFinance { 18 | return fakeFinance{} 19 | } 20 | 21 | // Known credit card types. 22 | const ( 23 | CC_VISA = "visa" 24 | CC_MASTERCARD = "mastercard" 25 | CC_AMERICAN_EXPRESS = "american_express" 26 | CC_DINERS_CLUB = "diners_club" 27 | CC_DISCOVER = "discover" 28 | CC_MAESTRO = "maestro" 29 | CC_SWITCH = "switch" 30 | CC_SOLO = "solo" 31 | CC_FORBRUGSFORENINGEN = "forbrugsforeningen" 32 | CC_DANKORT = "dankort" 33 | CC_LASER = "laser" 34 | ) 35 | 36 | // CC_TYPES holds a list of known credit card types. 37 | var CC_TYPES = []string{ 38 | CC_VISA, 39 | CC_MASTERCARD, 40 | CC_AMERICAN_EXPRESS, 41 | CC_DINERS_CLUB, 42 | CC_DISCOVER, 43 | CC_MAESTRO, 44 | CC_SWITCH, 45 | CC_SOLO, 46 | CC_FORBRUGSFORENINGEN, 47 | CC_DANKORT, 48 | CC_LASER, 49 | } 50 | 51 | var luhnFactors = [...]int{0, 2, 4, 6, 8, 1, 3, 5, 7, 9} 52 | 53 | func luhnCheckDigit(s string) string { 54 | // assuming check digit will be appended as last digit 55 | odd := (len(s) + 1) & 1 56 | 57 | var sum int 58 | for i, c := range s { 59 | if c < '0' || c > '9' { 60 | panic("invalid number sequence: " + s) 61 | } 62 | if i&1 == odd { 63 | sum += luhnFactors[c-'0'] 64 | } else { 65 | sum += int(c - '0') 66 | } 67 | } 68 | 69 | return strconv.Itoa((10 - (sum % 10)) % 10) 70 | } 71 | 72 | var rxDigits = regexp.MustCompile(`\D`) 73 | 74 | func (f fakeFinance) CreditCard(types ...string) string { 75 | var t string 76 | if len(types) > 0 { 77 | t = RandomChoice(types) 78 | } else { 79 | t = RandomChoice(CC_TYPES) 80 | } 81 | 82 | tmpl := Numerify(Fetch("credit_card." + t)) 83 | 84 | num := rxDigits.ReplaceAllString(tmpl, "") 85 | luhn := luhnCheckDigit(num) 86 | res := strings.Replace(tmpl, "L", luhn, 1) 87 | 88 | return res 89 | } 90 | -------------------------------------------------------------------------------- /vendor/syreclabs.com/go/faker/go.mod: -------------------------------------------------------------------------------- 1 | module syreclabs.com/go/faker 2 | 3 | go 1.11 4 | -------------------------------------------------------------------------------- /vendor/syreclabs.com/go/faker/locales/de-ch.go: -------------------------------------------------------------------------------- 1 | package locales 2 | 3 | var De_CH = map[string]interface{}{ 4 | "address": map[string]interface{}{ 5 | "country_code": []string{ 6 | "CH", "CH", "CH", "DE", "AT", "US", "LI", "US", "HK", "VN", 7 | }, 8 | "postcode": []string{ 9 | "1###", "2###", "3###", "4###", "5###", "6###", "7###", "8###", "9###", 10 | }, 11 | "default_country": []string{ 12 | "Schweiz", 13 | }, 14 | }, 15 | "company": map[string]interface{}{ 16 | "suffix": []string{ 17 | "AG", "GmbH", "und Söhne", "und Partner", "& Co.", "Gruppe", "LLC", "Inc.", 18 | }, 19 | "name": []string{ 20 | "#{name.last_name} #{name.suffix}", "#{name.last_name}-#{name.last_name}", "#{name.last_name}, #{name.last_name} und #{name.last_name}", 21 | }, 22 | }, 23 | "internet": map[string]interface{}{ 24 | "domain_suffix": []string{ 25 | "com", "net", "biz", "ch", "de", "li", "at", "ch", "ch", 26 | }, 27 | }, 28 | "phone_number": map[string]interface{}{ 29 | "formats": []string{ 30 | "0800 ### ###", "0800 ## ## ##", "0## ### ## ##", "0## ### ## ##", "+41 ## ### ## ##", "0900 ### ###", "076 ### ## ##", "+4178 ### ## ##", "0041 79 ### ## ##"}}} 31 | -------------------------------------------------------------------------------- /vendor/syreclabs.com/go/faker/locales/en-bork.go: -------------------------------------------------------------------------------- 1 | package locales 2 | 3 | var En_BORK = map[string]interface{}{ 4 | "lorem": map[string]interface{}{ 5 | "words": []string{ 6 | "Boot", "I", "Nu", "Nur", "Tu", "Um", "a", "becoose-a", "boot", "bork", "burn", "chuuses", "cumplete-a", "cun", "cunseqooences", "curcoomstunces", "dee", "deeslikes", "denuoonceeng", "desures", "du", "eccuoont", "ectooel", "edfuntege-a", "efueeds", "egeeen", "ell", "ere-a", "feend", "foolt", "frum", "geefe-a", "gesh", "greet", "heem", "heppeeness", "hes", "hoo", "hoomun", "idea", "ifer", "in", "incuoonter", "injuy", "itselff", "ixcept", "ixemple-a", "ixerceese-a", "ixpleeen", "ixplurer", "ixpuoond", "ixtremely", "knoo", "lebureeuoos", "lufes", "meestekee", "mester-booeelder", "moost", "mun", "nu", "nut", "oobteeen", "oocceseeunelly", "ooccoor", "ooff", "oone-a", "oor", "peeen", "peeenffool", "physeecel", "pleesoore-a", "poorsooe-a", "poorsooes", "preeesing", "prucoore-a", "prudooces", "reeght", "reshunelly", "resooltunt", "sume-a", "teecheengs", "teke-a", "thees", "thet", "thuse-a", "treefiel", "troot", "tu", "tueel", "und", "undertekes", "unnuyeeng", "uny", "unyune-a", "us", "veell", "veet", "ves", "vheech", "vhu", "yuoo", "zee", "zeere-a"}}} 7 | -------------------------------------------------------------------------------- /vendor/syreclabs.com/go/faker/locales/en-ca.go: -------------------------------------------------------------------------------- 1 | package locales 2 | 3 | var En_CA = map[string]interface{}{ 4 | "internet": map[string]interface{}{ 5 | "free_email": []string{ 6 | "gmail.com", "yahoo.ca", "hotmail.com", 7 | }, 8 | "domain_suffix": []string{ 9 | "ca", "com", "biz", "info", "name", "net", "org", 10 | }, 11 | }, 12 | "phone_number": map[string]interface{}{ 13 | "formats": []string{ 14 | "###-###-####", "(###)###-####", "###.###.####", "1-###-###-####", "###-###-#### x###", "(###)###-#### x###", "1-###-###-#### x###", "###.###.#### x###", "###-###-#### x####", "(###)###-#### x####", "1-###-###-#### x####", "###.###.#### x####", "###-###-#### x#####", "(###)###-#### x#####", "1-###-###-#### x#####", "###.###.#### x#####", 15 | }, 16 | }, 17 | "address": map[string]interface{}{ 18 | "postcode": "/[A-VX-Y][0-9][A-CEJ-NPR-TV-Z] ?[0-9][A-CEJ-NPR-TV-Z][0-9]/", 19 | "state": []string{ 20 | "Alberta", "British Columbia", "Manitoba", "New Brunswick", "Newfoundland and Labrador", "Nova Scotia", "Northwest Territories", "Nunavut", "Ontario", "Prince Edward Island", "Quebec", "Saskatchewan", "Yukon", 21 | }, 22 | "state_abbr": []string{ 23 | "AB", "BC", "MB", "NB", "NL", "NS", "NU", "NT", "ON", "PE", "QC", "SK", "YK", 24 | }, 25 | "default_country": []string{ 26 | "Canada"}}} 27 | -------------------------------------------------------------------------------- /vendor/syreclabs.com/go/faker/locales/en-gb.go: -------------------------------------------------------------------------------- 1 | package locales 2 | 3 | var En_GB = map[string]interface{}{ 4 | "cell_phone": map[string]interface{}{ 5 | "formats": []string{ 6 | "074## ######", "075## ######", "076## ######", "077## ######", "078## ######", "079## ######", 7 | }, 8 | }, 9 | "address": map[string]interface{}{ 10 | "postcode": "/[A-PR-UWYZ][A-HK-Y]?[0-9][ABEHMNPRVWXY0-9]? [0-9][ABD-HJLN-UW-Z]{2}/", 11 | "county": []string{ 12 | "Avon", "Bedfordshire", "Berkshire", "Borders", "Buckinghamshire", "Cambridgeshire", "Central", "Cheshire", "Cleveland", "Clwyd", "Cornwall", "County Antrim", "County Armagh", "County Down", "County Fermanagh", "County Londonderry", "County Tyrone", "Cumbria", "Derbyshire", "Devon", "Dorset", "Dumfries and Galloway", "Durham", "Dyfed", "East Sussex", "Essex", "Fife", "Gloucestershire", "Grampian", "Greater Manchester", "Gwent", "Gwynedd County", "Hampshire", "Herefordshire", "Hertfordshire", "Highlands and Islands", "Humberside", "Isle of Wight", "Kent", "Lancashire", "Leicestershire", "Lincolnshire", "Lothian", "Merseyside", "Mid Glamorgan", "Norfolk", "North Yorkshire", "Northamptonshire", "Northumberland", "Nottinghamshire", "Oxfordshire", "Powys", "Rutland", "Shropshire", "Somerset", "South Glamorgan", "South Yorkshire", "Staffordshire", "Strathclyde", "Suffolk", "Surrey", "Tayside", "Tyne and Wear", "Warwickshire", "West Glamorgan", "West Midlands", "West Sussex", "West Yorkshire", "Wiltshire", "Worcestershire", 13 | }, 14 | "uk_country": []string{ 15 | "England", "Scotland", "Wales", "Northern Ireland", 16 | }, 17 | "default_country": []string{ 18 | "England", "Scotland", "Wales", "Northern Ireland", 19 | }, 20 | }, 21 | "internet": map[string]interface{}{ 22 | "domain_suffix": []string{ 23 | "co.uk", "com", "biz", "info", "name", 24 | }, 25 | }, 26 | "phone_number": map[string]interface{}{ 27 | "formats": []string{ 28 | "01#### #####", "01### ######", "01#1 ### ####", "011# ### ####", "02# #### ####", "03## ### ####", "055 #### ####", "056 #### ####", "0800 ### ####", "08## ### ####", "09## ### ####", "016977 ####", "01### #####", "0500 ######", "0800 ######"}}} 29 | -------------------------------------------------------------------------------- /vendor/syreclabs.com/go/faker/locales/en-nep.go: -------------------------------------------------------------------------------- 1 | package locales 2 | 3 | var En_NEP = map[string]interface{}{ 4 | "name": map[string]interface{}{ 5 | "first_name": []string{ 6 | "Aarav", "Ajita", "Amit", "Amita", "Amrit", "Arijit", "Ashmi", "Asmita", "Bibek", "Bijay", "Bikash", "Bina", "Bishal", "Bishnu", "Buddha", "Deepika", "Dipendra", "Gagan", "Ganesh", "Khem", "Krishna", "Laxmi", "Manisha", "Nabin", "Nikita", "Niraj", "Nischal", "Padam", "Pooja", "Prabin", "Prakash", "Prashant", "Prem", "Purna", "Rajendra", "Rajina", "Raju", "Rakesh", "Ranjan", "Ratna", "Sagar", "Sandeep", "Sanjay", "Santosh", "Sarita", "Shilpa", "Shirisha", "Shristi", "Siddhartha", "Subash", "Sumeet", "Sunita", "Suraj", "Susan", "Sushant", 7 | }, 8 | "last_name": []string{ 9 | "Adhikari", "Aryal", "Baral", "Basnet", "Bastola", "Basynat", "Bhandari", "Bhattarai", "Chettri", "Devkota", "Dhakal", "Dongol", "Ghale", "Gurung", "Gyawali", "Hamal", "Jung", "KC", "Kafle", "Karki", "Khadka", "Koirala", "Lama", "Limbu", "Magar", "Maharjan", "Niroula", "Pandey", "Pradhan", "Rana", "Raut", "Sai", "Shai", "Shakya", "Sherpa", "Shrestha", "Subedi", "Tamang", "Thapa", 10 | }, 11 | }, 12 | "address": map[string]interface{}{ 13 | "city": []string{ 14 | "Bhaktapur", "Biratnagar", "Birendranagar", "Birgunj", "Butwal", "Damak", "Dharan", "Gaur", "Gorkha", "Hetauda", "Itahari", "Janakpur", "Kathmandu", "Lahan", "Nepalgunj", "Pokhara", 15 | }, 16 | "default_country": []string{ 17 | "Nepal", 18 | }, 19 | "postcode": []string{ 20 | "0000", 21 | }, 22 | "state": []string{ 23 | "Baglung", "Banke", "Bara", "Bardiya", "Bhaktapur", "Bhojupu", "Chitwan", "Dailekh", "Dang", "Dhading", "Dhankuta", "Dhanusa", "Dolakha", "Dolpha", "Gorkha", "Gulmi", "Humla", "Ilam", "Jajarkot", "Jhapa", "Jumla", "Kabhrepalanchok", "Kalikot", "Kapilvastu", "Kaski", "Kathmandu", "Lalitpur", "Lamjung", "Manang", "Mohottari", "Morang", "Mugu", "Mustang", "Myagdi", "Nawalparasi", "Nuwakot", "Palpa", "Parbat", "Parsa", "Ramechhap", "Rauswa", "Rautahat", "Rolpa", "Rupandehi", "Sankhuwasabha", "Sarlahi", "Sindhuli", "Sindhupalchok", "Sunsari", "Surket", "Syangja", "Tanahu", "Terhathum", 24 | }, 25 | }, 26 | "internet": map[string]interface{}{ 27 | "free_email": []string{ 28 | "worldlink.com.np", "gmail.com", "yahoo.com", "hotmail.com", 29 | }, 30 | "domain_suffix": []string{ 31 | "np", "com", "info", "net", "org", 32 | }, 33 | }, 34 | "company": map[string]interface{}{ 35 | "suffix": []string{ 36 | "Pvt Ltd", "Group", "Ltd", "Limited", 37 | }, 38 | }, 39 | "phone_number": map[string]interface{}{ 40 | "formats": []string{ 41 | "##-#######", "+977-#-#######", "+977########"}}} 42 | -------------------------------------------------------------------------------- /vendor/syreclabs.com/go/faker/locales/ja.go: -------------------------------------------------------------------------------- 1 | package locales 2 | 3 | var Ja = map[string]interface{}{ 4 | "name": map[string]interface{}{ 5 | "last_name": []string{ 6 | "佐藤", "鈴木", "高橋", "田中", "渡辺", "伊藤", "山本", "中村", "小林", "加藤", "吉田", "山田", "佐々木", "山口", "斎藤", "松本", "井上", "木村", "林", "清水", 7 | }, 8 | "first_name": []string{ 9 | "大翔", "蓮", "颯太", "樹", "大和", "陽翔", "陸斗", "太一", "海翔", "蒼空", "翼", "陽菜", "結愛", "結衣", "杏", "莉子", "美羽", "結菜", "心愛", "愛菜", "美咲", 10 | }, 11 | "name": []string{ 12 | "#{name.last_name} #{name.first_name}", 13 | }, 14 | }, 15 | "address": map[string]interface{}{ 16 | "city_suffix": []string{ 17 | "市", "区", "町", "村", 18 | }, 19 | "city": []string{ 20 | "#{address.city_prefix}#{name.first_name}#{address.city_suffix}", "#{name.first_name}#{address.city_suffix}", "#{address.city_prefix}#{name.last_name}#{address.city_suffix}", "#{name.last_name}#{address.city_suffix}", 21 | }, 22 | "street_name": []string{ 23 | "#{name.first_name}#{address.street_suffix}", "#{name.last_name}#{address.street_suffix}", 24 | }, 25 | "postcode": []string{ 26 | "###-####", 27 | }, 28 | "state": []string{ 29 | "北海道", "青森県", "岩手県", "宮城県", "秋田県", "山形県", "福島県", "茨城県", "栃木県", "群馬県", "埼玉県", "千葉県", "東京都", "神奈川県", "新潟県", "富山県", "石川県", "福井県", "山梨県", "長野県", "岐阜県", "静岡県", "愛知県", "三重県", "滋賀県", "京都府", "大阪府", "兵庫県", "奈良県", "和歌山県", "鳥取県", "島根県", "岡山県", "広島県", "山口県", "徳島県", "香川県", "愛媛県", "高知県", "福岡県", "佐賀県", "長崎県", "熊本県", "大分県", "宮崎県", "鹿児島県", "沖縄県", 30 | }, 31 | "state_abbr": []string{ 32 | "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31", "32", "33", "34", "35", "36", "37", "38", "39", "40", "41", "42", "43", "44", "45", "46", "47", 33 | }, 34 | "city_prefix": []string{ 35 | "北", "東", "西", "南", "新", "湖", "港", 36 | }, 37 | }, 38 | "phone_number": map[string]interface{}{ 39 | "formats": []string{ 40 | "0####-#-####", "0###-##-####", "0##-###-####", "0#-####-####", 41 | }, 42 | }, 43 | "cell_phone": map[string]interface{}{ 44 | "formats": []string{ 45 | "090-####-####", "080-####-####", "070-####-####"}}} 46 | -------------------------------------------------------------------------------- /vendor/syreclabs.com/go/faker/locales/zh-cn.go: -------------------------------------------------------------------------------- 1 | package locales 2 | 3 | var Zh_CN = map[string]interface{}{ 4 | "address": map[string]interface{}{ 5 | "building_number": []string{ 6 | "#####", "####", "###", "##", "#", 7 | }, 8 | "state_abbr": []string{ 9 | "京", "沪", "津", "渝", "黑", "吉", "辽", "蒙", "冀", "新", "甘", "青", "陕", "宁", "豫", "鲁", "晋", "皖", "鄂", "湘", "苏", "川", "黔", "滇", "桂", "藏", "浙", "赣", "粤", "闽", "琼", "港", "澳", 10 | }, 11 | "city_prefix": []string{ 12 | "长", "上", "南", "西", "北", "诸", "宁", "珠", "武", "衡", "成", "福", "厦", "贵", "吉", "海", "太", "济", "安", "吉", "包", 13 | }, 14 | "city_suffix": []string{ 15 | "沙市", "京市", "宁市", "安市", "乡县", "海市", "码市", "汉市", "阳市", "都市", "州市", "门市", "阳市", "口市", "原市", "南市", "徽市", "林市", "头市", 16 | }, 17 | "street_suffix": []string{ 18 | "巷", "街", "路", "桥", "侬", "旁", "中心", "栋", 19 | }, 20 | "postcode": []string{ 21 | "######", 22 | }, 23 | "state": []string{ 24 | "北京市", "上海市", "天津市", "重庆市", "黑龙江省", "吉林省", "辽宁省", "内蒙古", "河北省", "新疆", "甘肃省", "青海省", "陕西省", "宁夏", "河南省", "山东省", "山西省", "安徽省", "湖北省", "湖南省", "江苏省", "四川省", "贵州省", "云南省", "广西省", "西藏", "浙江省", "江西省", "广东省", "福建省", "海南省", "香港", "澳门", 25 | }, 26 | "city": []string{ 27 | "#{address.city_prefix}#{address.city_suffix}", 28 | }, 29 | "street_name": []string{ 30 | "#{name.last_name}#{address.street_suffix}", 31 | }, 32 | "street_address": []string{ 33 | "#{address.street_name}#{address.building_number}号", 34 | }, 35 | "default_country": []string{ 36 | "中国", 37 | }, 38 | }, 39 | "name": map[string]interface{}{ 40 | "last_name": []string{ 41 | "王", "李", "张", "刘", "陈", "杨", "黄", "吴", "赵", "周", "徐", "孙", "马", "朱", "胡", "林", "郭", "何", "高", "罗", "郑", "梁", "谢", "宋", "唐", "许", "邓", "冯", "韩", "曹", "曾", "彭", "萧", "蔡", "潘", "田", "董", "袁", "于", "余", "叶", "蒋", "杜", "苏", "魏", "程", "吕", "丁", "沈", "任", "姚", "卢", "傅", "钟", "姜", "崔", "谭", "廖", "范", "汪", "陆", "金", "石", "戴", "贾", "韦", "夏", "邱", "方", "侯", "邹", "熊", "孟", "秦", "白", "江", "阎", "薛", "尹", "段", "雷", "黎", "史", "龙", "陶", "贺", "顾", "毛", "郝", "龚", "邵", "万", "钱", "严", "赖", "覃", "洪", "武", "莫", "孔", 42 | }, 43 | "first_name": []string{ 44 | "绍齐", "博文", "梓晨", "胤祥", "瑞霖", "明哲", "天翊", "凯瑞", "健雄", "耀杰", "潇然", "子涵", "越彬", "钰轩", "智辉", "致远", "俊驰", "雨泽", "烨磊", "晟睿", "文昊", "修洁", "黎昕", "远航", "旭尧", "鸿涛", "伟祺", "荣轩", "越泽", "浩宇", "瑾瑜", "皓轩", "擎苍", "擎宇", "志泽", "子轩", "睿渊", "弘文", "哲瀚", "雨泽", "楷瑞", "建辉", "晋鹏", "天磊", "绍辉", "泽洋", "鑫磊", "鹏煊", "昊强", "伟宸", "博超", "君浩", "子骞", "鹏涛", "炎彬", "鹤轩", "越彬", "风华", "靖琪", "明辉", "伟诚", "明轩", "健柏", "修杰", "志泽", "弘文", "峻熙", "嘉懿", "煜城", "懿轩", "烨伟", "苑博", "伟泽", "熠彤", "鸿煊", "博涛", "烨霖", "烨华", "煜祺", "智宸", "正豪", "昊然", "明杰", "立诚", "立轩", "立辉", "峻熙", "弘文", "熠彤", "鸿煊", "烨霖", "哲瀚", "鑫鹏", "昊天", "思聪", "展鹏", "笑愚", "志强", "炫明", "雪松", "思源", "智渊", "思淼", "晓啸", "天宇", "浩然", "文轩", "鹭洋", "振家", "乐驹", "晓博", "文博", "昊焱", "立果", "金鑫", "锦程", "嘉熙", "鹏飞", "子默", "思远", "浩轩", "语堂", "聪健", "明", "文", "果", "思", "鹏", "驰", "涛", "琪", "浩", "航", "彬", 45 | }, 46 | "name": []string{ 47 | "#{name.last_name}#{name.first_name}", 48 | }, 49 | }, 50 | "phone_number": map[string]interface{}{ 51 | "formats": []string{ 52 | "###-########", "####-########", "###########"}}} 53 | -------------------------------------------------------------------------------- /vendor/syreclabs.com/go/faker/locales/zz_import_path.go: -------------------------------------------------------------------------------- 1 | package locales // import "syreclabs.com/go/faker/locales" 2 | -------------------------------------------------------------------------------- /vendor/syreclabs.com/go/faker/name.go: -------------------------------------------------------------------------------- 1 | package faker 2 | 3 | type FakeName interface { 4 | Name() string // => "Natasha Hartmann" 5 | FirstName() string // => "Carolina" 6 | LastName() string // => "Kohler" 7 | Prefix() string // => "Dr." 8 | Suffix() string // => "Jr." 9 | Title() string // => "Chief Functionality Orchestrator" 10 | String() string // String is an alias for Name. 11 | } 12 | 13 | type fakeName struct{} 14 | 15 | func Name() FakeName { 16 | return fakeName{} 17 | } 18 | 19 | func (n fakeName) Name() string { 20 | return Fetch("name.name") 21 | } 22 | 23 | func (n fakeName) FirstName() string { 24 | return Fetch("name.first_name") 25 | } 26 | 27 | func (n fakeName) LastName() string { 28 | return Fetch("name.last_name") 29 | } 30 | 31 | func (n fakeName) Prefix() string { 32 | return Fetch("name.prefix") 33 | } 34 | 35 | func (n fakeName) Suffix() string { 36 | return Fetch("name.suffix") 37 | } 38 | 39 | func (n fakeName) Title() string { 40 | return Fetch("name.title.descriptor") + " " + Fetch("name.title.level") + " " + Fetch("name.title.job") 41 | } 42 | 43 | func (n fakeName) String() string { 44 | return n.Name() 45 | } 46 | -------------------------------------------------------------------------------- /vendor/syreclabs.com/go/faker/phone_number.go: -------------------------------------------------------------------------------- 1 | package faker 2 | 3 | type FakePhoneNumber interface { 4 | PhoneNumber() string // => "1-599-267-6597 x537" 5 | CellPhone() string // => "+49-131-0003060" 6 | AreaCode() string // => "903" 7 | ExchangeCode() string // => "574" 8 | SubscriberNumber(digits int) string // => "1512" 9 | String() string // String is an alias for PhoneNumber. 10 | } 11 | 12 | type fakePhoneNumber struct{} 13 | 14 | func PhoneNumber() FakePhoneNumber { 15 | return fakePhoneNumber{} 16 | } 17 | 18 | func (p fakePhoneNumber) PhoneNumber() string { 19 | return Numerify(Fetch("phone_number.formats")) 20 | } 21 | 22 | func (p fakePhoneNumber) CellPhone() string { 23 | return Numerify(Fetch("cell_phone.formats")) 24 | } 25 | 26 | func (p fakePhoneNumber) AreaCode() string { 27 | var res string 28 | defer func() { 29 | if err := recover(); err != nil { 30 | res = "" 31 | } 32 | }() 33 | res = Fetch("phone_number.area_code") 34 | return res 35 | } 36 | 37 | func (p fakePhoneNumber) ExchangeCode() string { 38 | var res string 39 | defer func() { 40 | if err := recover(); err != nil { 41 | res = "" 42 | } 43 | }() 44 | res = Fetch("phone_number.exchange_code") 45 | return res 46 | } 47 | 48 | func (p fakePhoneNumber) SubscriberNumber(digits int) string { 49 | return Number().Number(digits) 50 | } 51 | 52 | func (p fakePhoneNumber) String() string { 53 | return p.PhoneNumber() 54 | } 55 | -------------------------------------------------------------------------------- /vendor/syreclabs.com/go/faker/team.go: -------------------------------------------------------------------------------- 1 | package faker 2 | 3 | type FakeTeam interface { 4 | Name() string // => "Colorado cats" 5 | Creature() string // => "cats" 6 | State() string // => "Oregon" 7 | String() string // String is an alias for Name. 8 | } 9 | 10 | type fakeTeam struct{} 11 | 12 | func Team() FakeTeam { 13 | return fakeTeam{} 14 | } 15 | 16 | func (t fakeTeam) Name() string { 17 | return Fetch("team.name") 18 | } 19 | 20 | func (t fakeTeam) Creature() string { 21 | return Fetch("team.creature") 22 | } 23 | 24 | func (t fakeTeam) State() string { 25 | return Fetch("address.state") 26 | } 27 | 28 | func (t fakeTeam) String() string { 29 | return t.Name() 30 | } 31 | -------------------------------------------------------------------------------- /vendor/syreclabs.com/go/faker/time.go: -------------------------------------------------------------------------------- 1 | package faker 2 | 3 | type FakeTime interface { 4 | FakeDate 5 | } 6 | 7 | type fakeTime struct { 8 | fakeDate 9 | } 10 | 11 | func Time() FakeTime { 12 | return fakeTime{} 13 | } 14 | --------------------------------------------------------------------------------