├── .gitignore ├── .travis.yml ├── Gopkg.lock ├── Gopkg.toml ├── LICENSE ├── README.md ├── cmd └── r │ ├── .r.sh │ ├── main.go │ ├── rBashFile.go │ ├── util.go │ └── vendor │ ├── github.com │ └── chzyer │ │ └── readline │ │ ├── .travis.yml │ │ ├── CHANGELOG.md │ │ ├── LICENSE │ │ ├── README.md │ │ ├── ansi_windows.go │ │ ├── char.go │ │ ├── complete.go │ │ ├── complete_helper.go │ │ ├── debug.go │ │ ├── doc.go │ │ ├── example │ │ ├── readline-demo │ │ │ └── readline-demo.go │ │ ├── readline-multiline │ │ │ └── readline-multiline.go │ │ ├── readline-pass-strength │ │ │ └── readline-pass-strength.go │ │ └── readline-remote │ │ │ ├── readline-remote-client │ │ │ └── client.go │ │ │ └── readline-remote-server │ │ │ └── server.go │ │ ├── history.go │ │ ├── operation.go │ │ ├── password.go │ │ ├── rawreader_windows.go │ │ ├── readline.go │ │ ├── remote.go │ │ ├── runebuf.go │ │ ├── runes │ │ ├── runes.go │ │ └── runes_test.go │ │ ├── search.go │ │ ├── std.go │ │ ├── std_windows.go │ │ ├── terminal.go │ │ ├── utils.go │ │ ├── utils_test.go │ │ ├── utils_unix.go │ │ ├── utils_windows.go │ │ ├── vim.go │ │ └── windows_api.go │ └── golang.org │ └── x │ └── crypto │ ├── .gitattributes │ ├── AUTHORS │ ├── CONTRIBUTING.md │ ├── CONTRIBUTORS │ ├── LICENSE │ ├── PATENTS │ ├── README │ ├── bcrypt │ ├── base64.go │ ├── bcrypt.go │ └── bcrypt_test.go │ ├── blowfish │ ├── block.go │ ├── blowfish_test.go │ ├── cipher.go │ └── const.go │ ├── bn256 │ ├── bn256.go │ ├── bn256_test.go │ ├── constants.go │ ├── curve.go │ ├── example_test.go │ ├── gfp12.go │ ├── gfp2.go │ ├── gfp6.go │ ├── optate.go │ └── twist.go │ ├── cast5 │ ├── cast5.go │ └── cast5_test.go │ ├── codereview.cfg │ ├── curve25519 │ ├── const_amd64.s │ ├── cswap_amd64.s │ ├── curve25519.go │ ├── curve25519_test.go │ ├── doc.go │ ├── freeze_amd64.s │ ├── ladderstep_amd64.s │ ├── mont25519_amd64.go │ ├── mul_amd64.s │ └── square_amd64.s │ ├── hkdf │ ├── example_test.go │ ├── hkdf.go │ └── hkdf_test.go │ ├── md4 │ ├── md4.go │ ├── md4_test.go │ └── md4block.go │ ├── nacl │ ├── box │ │ ├── box.go │ │ └── box_test.go │ └── secretbox │ │ ├── secretbox.go │ │ └── secretbox_test.go │ ├── ocsp │ ├── ocsp.go │ └── ocsp_test.go │ ├── openpgp │ ├── armor │ │ ├── armor.go │ │ ├── armor_test.go │ │ └── encode.go │ ├── canonical_text.go │ ├── canonical_text_test.go │ ├── clearsign │ │ ├── clearsign.go │ │ └── clearsign_test.go │ ├── elgamal │ │ ├── elgamal.go │ │ └── elgamal_test.go │ ├── errors │ │ └── errors.go │ ├── keys.go │ ├── keys_test.go │ ├── packet │ │ ├── compressed.go │ │ ├── compressed_test.go │ │ ├── config.go │ │ ├── encrypted_key.go │ │ ├── encrypted_key_test.go │ │ ├── literal.go │ │ ├── ocfb.go │ │ ├── ocfb_test.go │ │ ├── one_pass_signature.go │ │ ├── opaque.go │ │ ├── opaque_test.go │ │ ├── packet.go │ │ ├── packet_test.go │ │ ├── private_key.go │ │ ├── private_key_test.go │ │ ├── public_key.go │ │ ├── public_key_test.go │ │ ├── public_key_v3.go │ │ ├── public_key_v3_test.go │ │ ├── reader.go │ │ ├── signature.go │ │ ├── signature_test.go │ │ ├── signature_v3.go │ │ ├── signature_v3_test.go │ │ ├── symmetric_key_encrypted.go │ │ ├── symmetric_key_encrypted_test.go │ │ ├── symmetrically_encrypted.go │ │ ├── symmetrically_encrypted_test.go │ │ ├── userattribute.go │ │ ├── userattribute_test.go │ │ ├── userid.go │ │ └── userid_test.go │ ├── read.go │ ├── read_test.go │ ├── s2k │ │ ├── s2k.go │ │ └── s2k_test.go │ ├── write.go │ └── write_test.go │ ├── otr │ ├── libotr_test_helper.c │ ├── otr.go │ ├── otr_test.go │ └── smp.go │ ├── pbkdf2 │ ├── pbkdf2.go │ └── pbkdf2_test.go │ ├── pkcs12 │ ├── bmp-string.go │ ├── bmp-string_test.go │ ├── crypto.go │ ├── crypto_test.go │ ├── errors.go │ ├── internal │ │ └── rc2 │ │ │ ├── bench_test.go │ │ │ ├── rc2.go │ │ │ └── rc2_test.go │ ├── mac.go │ ├── mac_test.go │ ├── pbkdf.go │ ├── pbkdf_test.go │ ├── pkcs12.go │ ├── pkcs12_test.go │ └── safebags.go │ ├── poly1305 │ ├── const_amd64.s │ ├── poly1305.go │ ├── poly1305_amd64.s │ ├── poly1305_arm.s │ ├── poly1305_test.go │ ├── sum_amd64.go │ ├── sum_arm.go │ └── sum_ref.go │ ├── ripemd160 │ ├── ripemd160.go │ ├── ripemd160_test.go │ └── ripemd160block.go │ ├── salsa20 │ ├── salsa │ │ ├── hsalsa20.go │ │ ├── salsa2020_amd64.s │ │ ├── salsa208.go │ │ ├── salsa20_amd64.go │ │ ├── salsa20_ref.go │ │ └── salsa_test.go │ ├── salsa20.go │ └── salsa20_test.go │ ├── scrypt │ ├── scrypt.go │ └── scrypt_test.go │ ├── sha3 │ ├── doc.go │ ├── hashes.go │ ├── keccakf.go │ ├── register.go │ ├── sha3.go │ ├── sha3_test.go │ ├── shake.go │ ├── testdata │ │ └── keccakKats.json.deflate │ ├── xor.go │ ├── xor_generic.go │ └── xor_unaligned.go │ ├── ssh │ ├── agent │ │ ├── client.go │ │ ├── client_test.go │ │ ├── example_test.go │ │ ├── forward.go │ │ ├── keyring.go │ │ ├── keyring_test.go │ │ ├── server.go │ │ ├── server_test.go │ │ └── testdata_test.go │ ├── benchmark_test.go │ ├── buffer.go │ ├── buffer_test.go │ ├── certs.go │ ├── certs_test.go │ ├── channel.go │ ├── cipher.go │ ├── cipher_test.go │ ├── client.go │ ├── client_auth.go │ ├── client_auth_test.go │ ├── client_test.go │ ├── common.go │ ├── connection.go │ ├── doc.go │ ├── example_test.go │ ├── handshake.go │ ├── handshake_test.go │ ├── kex.go │ ├── kex_test.go │ ├── keys.go │ ├── keys_test.go │ ├── mac.go │ ├── mempipe_test.go │ ├── messages.go │ ├── messages_test.go │ ├── mux.go │ ├── mux_test.go │ ├── server.go │ ├── session.go │ ├── session_test.go │ ├── tcpip.go │ ├── tcpip_test.go │ ├── terminal │ │ ├── terminal.go │ │ ├── terminal_test.go │ │ ├── util.go │ │ ├── util_bsd.go │ │ ├── util_linux.go │ │ └── util_windows.go │ ├── test │ │ ├── agent_unix_test.go │ │ ├── cert_test.go │ │ ├── doc.go │ │ ├── forward_unix_test.go │ │ ├── session_test.go │ │ ├── tcpip_test.go │ │ ├── test_unix_test.go │ │ └── testdata_test.go │ ├── testdata │ │ ├── doc.go │ │ └── keys.go │ ├── testdata_test.go │ ├── transport.go │ └── transport_test.go │ ├── tea │ ├── cipher.go │ └── tea_test.go │ ├── twofish │ ├── twofish.go │ └── twofish_test.go │ ├── xtea │ ├── block.go │ ├── cipher.go │ └── xtea_test.go │ └── xts │ ├── xts.go │ └── xts_test.go ├── command.go ├── r.go ├── r_test.go └── vendor ├── github.com ├── boltdb │ └── bolt │ │ ├── .gitignore │ │ ├── LICENSE │ │ ├── Makefile │ │ ├── README.md │ │ ├── appveyor.yml │ │ ├── bolt_386.go │ │ ├── bolt_amd64.go │ │ ├── bolt_arm.go │ │ ├── bolt_arm64.go │ │ ├── bolt_linux.go │ │ ├── bolt_openbsd.go │ │ ├── bolt_ppc.go │ │ ├── bolt_ppc64.go │ │ ├── bolt_ppc64le.go │ │ ├── bolt_s390x.go │ │ ├── bolt_unix.go │ │ ├── bolt_unix_solaris.go │ │ ├── bolt_windows.go │ │ ├── boltsync_unix.go │ │ ├── bucket.go │ │ ├── bucket_test.go │ │ ├── cmd │ │ └── bolt │ │ │ ├── main.go │ │ │ └── main_test.go │ │ ├── cursor.go │ │ ├── cursor_test.go │ │ ├── db.go │ │ ├── db_test.go │ │ ├── doc.go │ │ ├── errors.go │ │ ├── freelist.go │ │ ├── freelist_test.go │ │ ├── node.go │ │ ├── node_test.go │ │ ├── page.go │ │ ├── page_test.go │ │ ├── quick_test.go │ │ ├── simulation_test.go │ │ ├── tx.go │ │ └── tx_test.go └── chzyer │ └── readline │ ├── .gitignore │ ├── .travis.yml │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── ansi_windows.go │ ├── char.go │ ├── complete.go │ ├── complete_helper.go │ ├── complete_segment.go │ ├── complete_segment_test.go │ ├── debug.go │ ├── doc.go │ ├── example │ ├── readline-demo │ │ └── readline-demo.go │ ├── readline-im │ │ ├── README.md │ │ └── readline-im.go │ ├── readline-multiline │ │ └── readline-multiline.go │ ├── readline-pass-strength │ │ └── readline-pass-strength.go │ └── readline-remote │ │ ├── readline-remote-client │ │ └── client.go │ │ └── readline-remote-server │ │ └── server.go │ ├── history.go │ ├── operation.go │ ├── password.go │ ├── rawreader_windows.go │ ├── readline.go │ ├── remote.go │ ├── runebuf.go │ ├── runes.go │ ├── runes │ ├── runes.go │ └── runes_test.go │ ├── runes_test.go │ ├── search.go │ ├── std.go │ ├── std_windows.go │ ├── term.go │ ├── term_bsd.go │ ├── term_linux.go │ ├── term_windows.go │ ├── terminal.go │ ├── utils.go │ ├── utils_test.go │ ├── utils_unix.go │ ├── utils_windows.go │ ├── vim.go │ └── windows_api.go └── golang.org └── x └── sys ├── .gitattributes ├── .gitignore ├── AUTHORS ├── CONTRIBUTING.md ├── CONTRIBUTORS ├── LICENSE ├── PATENTS ├── README.md ├── codereview.cfg ├── plan9 ├── asm.s ├── asm_plan9_386.s ├── asm_plan9_amd64.s ├── const_plan9.go ├── dir_plan9.go ├── env_plan9.go ├── env_unset.go ├── errors_plan9.go ├── mkall.sh ├── mkerrors.sh ├── mksyscall.pl ├── mksysnum_plan9.sh ├── pwd_go15_plan9.go ├── pwd_plan9.go ├── race.go ├── race0.go ├── str.go ├── syscall.go ├── syscall_plan9.go ├── syscall_test.go ├── zsyscall_plan9_386.go ├── zsyscall_plan9_amd64.go └── zsysnum_plan9.go ├── unix ├── .gitignore ├── README.md ├── asm_darwin_386.s ├── asm_darwin_amd64.s ├── asm_darwin_arm.s ├── asm_darwin_arm64.s ├── asm_dragonfly_amd64.s ├── asm_freebsd_386.s ├── asm_freebsd_amd64.s ├── asm_freebsd_arm.s ├── asm_linux_386.s ├── asm_linux_amd64.s ├── asm_linux_arm.s ├── asm_linux_arm64.s ├── asm_linux_mips64x.s ├── asm_linux_mipsx.s ├── asm_linux_ppc64x.s ├── asm_linux_s390x.s ├── asm_netbsd_386.s ├── asm_netbsd_amd64.s ├── asm_netbsd_arm.s ├── asm_openbsd_386.s ├── asm_openbsd_amd64.s ├── asm_openbsd_arm.s ├── asm_solaris_amd64.s ├── bluetooth_linux.go ├── cap_freebsd.go ├── constants.go ├── creds_test.go ├── dev_darwin.go ├── dev_darwin_test.go ├── dev_dragonfly.go ├── dev_dragonfly_test.go ├── dev_freebsd.go ├── dev_linux.go ├── dev_linux_test.go ├── dev_netbsd.go ├── dev_netbsd_test.go ├── dev_openbsd.go ├── dev_openbsd_test.go ├── dev_solaris_test.go ├── dirent.go ├── endian_big.go ├── endian_little.go ├── env_unix.go ├── env_unset.go ├── errors_freebsd_386.go ├── errors_freebsd_amd64.go ├── errors_freebsd_arm.go ├── export_test.go ├── file_unix.go ├── flock.go ├── flock_linux_32bit.go ├── gccgo.go ├── gccgo_c.c ├── gccgo_linux_amd64.go ├── linux │ ├── Dockerfile │ ├── mkall.go │ ├── mksysnum.pl │ └── types.go ├── mkall.sh ├── mkerrors.sh ├── mkpost.go ├── mksyscall.pl ├── mksyscall_solaris.pl ├── mksysctl_openbsd.pl ├── mksysnum_darwin.pl ├── mksysnum_dragonfly.pl ├── mksysnum_freebsd.pl ├── mksysnum_netbsd.pl ├── mksysnum_openbsd.pl ├── mmap_unix_test.go ├── openbsd_pledge.go ├── openbsd_test.go ├── pagesize_unix.go ├── race.go ├── race0.go ├── sockcmsg_linux.go ├── sockcmsg_unix.go ├── str.go ├── syscall.go ├── syscall_bsd.go ├── syscall_bsd_test.go ├── syscall_darwin.go ├── syscall_darwin_386.go ├── syscall_darwin_amd64.go ├── syscall_darwin_arm.go ├── syscall_darwin_arm64.go ├── syscall_dragonfly.go ├── syscall_dragonfly_amd64.go ├── syscall_freebsd.go ├── syscall_freebsd_386.go ├── syscall_freebsd_amd64.go ├── syscall_freebsd_arm.go ├── syscall_freebsd_test.go ├── syscall_linux.go ├── syscall_linux_386.go ├── syscall_linux_amd64.go ├── syscall_linux_amd64_gc.go ├── syscall_linux_arm.go ├── syscall_linux_arm64.go ├── syscall_linux_mips64x.go ├── syscall_linux_mipsx.go ├── syscall_linux_ppc64x.go ├── syscall_linux_s390x.go ├── syscall_linux_sparc64.go ├── syscall_linux_test.go ├── syscall_netbsd.go ├── syscall_netbsd_386.go ├── syscall_netbsd_amd64.go ├── syscall_netbsd_arm.go ├── syscall_no_getwd.go ├── syscall_openbsd.go ├── syscall_openbsd_386.go ├── syscall_openbsd_amd64.go ├── syscall_openbsd_arm.go ├── syscall_solaris.go ├── syscall_solaris_amd64.go ├── syscall_solaris_test.go ├── syscall_test.go ├── syscall_unix.go ├── syscall_unix_gc.go ├── syscall_unix_test.go ├── types_darwin.go ├── types_dragonfly.go ├── types_freebsd.go ├── types_netbsd.go ├── types_openbsd.go ├── types_solaris.go ├── zerrors_darwin_386.go ├── zerrors_darwin_amd64.go ├── zerrors_darwin_arm.go ├── zerrors_darwin_arm64.go ├── zerrors_dragonfly_amd64.go ├── zerrors_freebsd_386.go ├── zerrors_freebsd_amd64.go ├── zerrors_freebsd_arm.go ├── zerrors_linux_386.go ├── zerrors_linux_amd64.go ├── zerrors_linux_arm.go ├── zerrors_linux_arm64.go ├── zerrors_linux_mips.go ├── zerrors_linux_mips64.go ├── zerrors_linux_mips64le.go ├── zerrors_linux_mipsle.go ├── zerrors_linux_ppc64.go ├── zerrors_linux_ppc64le.go ├── zerrors_linux_s390x.go ├── zerrors_linux_sparc64.go ├── zerrors_netbsd_386.go ├── zerrors_netbsd_amd64.go ├── zerrors_netbsd_arm.go ├── zerrors_openbsd_386.go ├── zerrors_openbsd_amd64.go ├── zerrors_openbsd_arm.go ├── zerrors_solaris_amd64.go ├── zsyscall_darwin_386.go ├── zsyscall_darwin_amd64.go ├── zsyscall_darwin_arm.go ├── zsyscall_darwin_arm64.go ├── zsyscall_dragonfly_amd64.go ├── zsyscall_freebsd_386.go ├── zsyscall_freebsd_amd64.go ├── zsyscall_freebsd_arm.go ├── zsyscall_linux_386.go ├── zsyscall_linux_amd64.go ├── zsyscall_linux_arm.go ├── zsyscall_linux_arm64.go ├── zsyscall_linux_mips.go ├── zsyscall_linux_mips64.go ├── zsyscall_linux_mips64le.go ├── zsyscall_linux_mipsle.go ├── zsyscall_linux_ppc64.go ├── zsyscall_linux_ppc64le.go ├── zsyscall_linux_s390x.go ├── zsyscall_linux_sparc64.go ├── zsyscall_netbsd_386.go ├── zsyscall_netbsd_amd64.go ├── zsyscall_netbsd_arm.go ├── zsyscall_openbsd_386.go ├── zsyscall_openbsd_amd64.go ├── zsyscall_openbsd_arm.go ├── zsyscall_solaris_amd64.go ├── zsysctl_openbsd.go ├── zsysnum_darwin_386.go ├── zsysnum_darwin_amd64.go ├── zsysnum_darwin_arm.go ├── zsysnum_darwin_arm64.go ├── zsysnum_dragonfly_amd64.go ├── zsysnum_freebsd_386.go ├── zsysnum_freebsd_amd64.go ├── zsysnum_freebsd_arm.go ├── zsysnum_linux_386.go ├── zsysnum_linux_amd64.go ├── zsysnum_linux_arm.go ├── zsysnum_linux_arm64.go ├── zsysnum_linux_mips.go ├── zsysnum_linux_mips64.go ├── zsysnum_linux_mips64le.go ├── zsysnum_linux_mipsle.go ├── zsysnum_linux_ppc64.go ├── zsysnum_linux_ppc64le.go ├── zsysnum_linux_s390x.go ├── zsysnum_linux_sparc64.go ├── zsysnum_netbsd_386.go ├── zsysnum_netbsd_amd64.go ├── zsysnum_netbsd_arm.go ├── zsysnum_openbsd_386.go ├── zsysnum_openbsd_amd64.go ├── zsysnum_openbsd_arm.go ├── zsysnum_solaris_amd64.go ├── ztypes_darwin_386.go ├── ztypes_darwin_amd64.go ├── ztypes_darwin_arm.go ├── ztypes_darwin_arm64.go ├── ztypes_dragonfly_amd64.go ├── ztypes_freebsd_386.go ├── ztypes_freebsd_amd64.go ├── ztypes_freebsd_arm.go ├── ztypes_linux_386.go ├── ztypes_linux_amd64.go ├── ztypes_linux_arm.go ├── ztypes_linux_arm64.go ├── ztypes_linux_mips.go ├── ztypes_linux_mips64.go ├── ztypes_linux_mips64le.go ├── ztypes_linux_mipsle.go ├── ztypes_linux_ppc64.go ├── ztypes_linux_ppc64le.go ├── ztypes_linux_s390x.go ├── ztypes_linux_sparc64.go ├── ztypes_netbsd_386.go ├── ztypes_netbsd_amd64.go ├── ztypes_netbsd_arm.go ├── ztypes_openbsd_386.go ├── ztypes_openbsd_amd64.go ├── ztypes_openbsd_arm.go └── ztypes_solaris_amd64.go └── windows ├── asm_windows_386.s ├── asm_windows_amd64.s ├── dll_windows.go ├── env_unset.go ├── env_windows.go ├── eventlog.go ├── exec_windows.go ├── memory_windows.go ├── mksyscall.go ├── race.go ├── race0.go ├── registry ├── export_test.go ├── key.go ├── mksyscall.go ├── registry_test.go ├── syscall.go ├── value.go └── zsyscall_windows.go ├── security_windows.go ├── service.go ├── str.go ├── svc ├── debug │ ├── log.go │ └── service.go ├── event.go ├── eventlog │ ├── install.go │ ├── log.go │ └── log_test.go ├── example │ ├── beep.go │ ├── install.go │ ├── main.go │ ├── manage.go │ └── service.go ├── go12.c ├── go12.go ├── go13.go ├── mgr │ ├── config.go │ ├── mgr.go │ ├── mgr_test.go │ └── service.go ├── security.go ├── service.go ├── svc_test.go ├── sys_386.s └── sys_amd64.s ├── syscall.go ├── syscall_test.go ├── syscall_windows.go ├── syscall_windows_test.go ├── types_windows.go ├── types_windows_386.go ├── types_windows_amd64.go └── zsyscall_windows.go /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | go: 3 | - 1.5 4 | env: 5 | - GO15VENDOREXPERIMENT=1 6 | script: 7 | - go test 8 | -------------------------------------------------------------------------------- /Gopkg.lock: -------------------------------------------------------------------------------- 1 | # This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'. 2 | 3 | 4 | [[projects]] 5 | name = "github.com/boltdb/bolt" 6 | packages = ["."] 7 | revision = "2f1ce7a837dcb8da3ec595b1dac9d0632f0f99e8" 8 | version = "v1.3.1" 9 | 10 | [[projects]] 11 | name = "github.com/chzyer/readline" 12 | packages = ["."] 13 | revision = "62c6fe6193755f722b8b8788aa7357be55a50ff1" 14 | version = "v1.4" 15 | 16 | [[projects]] 17 | branch = "master" 18 | name = "golang.org/x/sys" 19 | packages = ["unix"] 20 | revision = "314a259e304ff91bd6985da2a7149bbf91237993" 21 | 22 | [solve-meta] 23 | analyzer-name = "dep" 24 | analyzer-version = 1 25 | inputs-digest = "5c46ea881151f5d760ee5d05388203977ffa94ea964057d8144bf3eee4c53912" 26 | solver-name = "gps-cdcl" 27 | solver-version = 1 28 | -------------------------------------------------------------------------------- /Gopkg.toml: -------------------------------------------------------------------------------- 1 | 2 | # Gopkg.toml example 3 | # 4 | # Refer to https://github.com/golang/dep/blob/master/docs/Gopkg.toml.md 5 | # for detailed Gopkg.toml documentation. 6 | # 7 | # required = ["github.com/user/thing/cmd/thing"] 8 | # ignored = ["github.com/user/project/pkgX", "bitbucket.org/user/project/pkgA/pkgY"] 9 | # 10 | # [[constraint]] 11 | # name = "github.com/user/project" 12 | # version = "1.0.0" 13 | # 14 | # [[constraint]] 15 | # name = "github.com/user/project2" 16 | # branch = "dev" 17 | # source = "github.com/myfork/project2" 18 | # 19 | # [[override]] 20 | # name = "github.com/x/y" 21 | # version = "2.4.0" 22 | 23 | 24 | [[constraint]] 25 | name = "github.com/boltdb/bolt" 26 | version = "1.3.1" 27 | 28 | [[constraint]] 29 | name = "github.com/chzyer/readline" 30 | version = "1.4.0" 31 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2015, Jesse Lucas 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | * Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 10 | * Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | * Neither the name of `r` nor the names of its contributors may be 15 | used to endorse or promote products derived from this software without 16 | specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 22 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 24 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 25 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 26 | OR TORT (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 | -------------------------------------------------------------------------------- /cmd/r/.r.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # This will run before any command is executed. 4 | pre() { 5 | if [ -z "$R_AT_PROMPT" ]; then 6 | return 7 | fi 8 | unset R_AT_PROMPT 9 | 10 | # Keep reference to what command was executed 11 | R_LAST_CMD="${1##*/}" 12 | export R_PWD 13 | R_PWD=$(pwd) 14 | CMD=$* 15 | 16 | } 17 | 18 | # Set trap to reun pre before command 19 | trap 'pre $BASH_COMMAND' DEBUG 20 | 21 | # This will run after the execution of the previous full command line. We don't 22 | # want post to execute when first starting a bash session (FIRST_PROMPT) 23 | R_FIRST_PROMPT=1 24 | post() { 25 | R_AT_PROMPT=1 26 | 27 | if [ -n "$R_FIRST_PROMPT" ]; then 28 | unset R_FIRST_PROMPT 29 | return 30 | fi 31 | 32 | local last_code=$? 33 | # Don't add if the status errored 34 | if [ "$last_code" -eq 0 ]; then 35 | # Add current directory and command to r 36 | r --add "$R_PWD^_$CMD" 37 | fi 38 | 39 | # Test if LAST_CMD was r then run any command selected 40 | if [ "$R_LAST_CMD" = "r" ]; then 41 | local last_r_cmd 42 | last_r_cmd=$(r --command) 43 | if [ -z "$last_r_cmd" ]; then 44 | return 45 | fi 46 | 47 | # execute command 48 | eval $last_r_cmd 49 | 50 | # save command to bash history 51 | history -s $last_r_cmd 52 | 53 | return 54 | fi 55 | } 56 | 57 | # Run post after command 58 | PROMPT_COMMAND="${PROMPT_COMMAND}"$'\n'"post;"; 59 | -------------------------------------------------------------------------------- /cmd/r/rBashFile.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | const rBashFile = `#!/bin/bash 4 | 5 | # This will run before any command is executed. 6 | pre() { 7 | if [ -z "$R_AT_PROMPT" ]; then 8 | return 9 | fi 10 | unset R_AT_PROMPT 11 | 12 | # Keep reference to what command was executed 13 | R_LAST_CMD="${1##*/}" 14 | export R_PWD 15 | R_PWD=$(pwd) 16 | CMD=$* 17 | 18 | } 19 | 20 | # Set trap to reun pre before command 21 | trap 'pre $BASH_COMMAND' DEBUG 22 | 23 | # This will run after the execution of the previous full command line. We don't 24 | # want post to execute when first starting a bash session (FIRST_PROMPT) 25 | R_FIRST_PROMPT=1 26 | post() { 27 | R_AT_PROMPT=1 28 | 29 | if [ -n "$R_FIRST_PROMPT" ]; then 30 | unset R_FIRST_PROMPT 31 | return 32 | fi 33 | 34 | local last_code=$? 35 | # Don't add if the status errored 36 | if [ "$last_code" -eq 0 ]; then 37 | # Add current directory and command to r 38 | r --add "$R_PWD^_$CMD" 39 | fi 40 | 41 | # Test if LAST_CMD was r then run any command selected 42 | if [ "$R_LAST_CMD" = "r" ]; then 43 | local last_r_cmd 44 | last_r_cmd=$(r --command) 45 | if [ -z "$last_r_cmd" ]; then 46 | return 47 | fi 48 | 49 | # execute command 50 | eval $last_r_cmd 51 | 52 | # save command to bash history 53 | history -s $last_r_cmd 54 | 55 | return 56 | fi 57 | } 58 | 59 | # Run post after command 60 | PROMPT_COMMAND="${PROMPT_COMMAND}"$'\n'"post;"; 61 | ` 62 | -------------------------------------------------------------------------------- /cmd/r/vendor/github.com/chzyer/readline/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | go: 3 | - 1.5 4 | before_install: 5 | - go get golang.org/x/crypto/ssh/terminal 6 | script: 7 | - GOOS=windows go install github.com/chzyer/readline/example/... 8 | - GOOS=linux go install github.com/chzyer/readline/example/... 9 | - GOOS=darwin go install github.com/chzyer/readline/example/... 10 | - go test -v 11 | -------------------------------------------------------------------------------- /cmd/r/vendor/github.com/chzyer/readline/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # ChangeLog 2 | 3 | ### 1.2 - 2016-03-05 4 | 5 | * Add a demo for checking password strength [example/readline-pass-strength](https://github.com/chzyer/readline/blob/master/example/readline-pass-strength/readline-pass-strength.go), , written by [@sahib](https://github.com/sahib) 6 | * #23, support stdin remapping 7 | * #27, add a `UniqueEditLine` to `Config`, which will erase the editing line after user submited it, usually use in IM. 8 | * Add a demo for multiline [example/readline-multiline](https://github.com/chzyer/readline/blob/master/example/readline-multiline/readline-multiline.go) which can submit one SQL by multiple lines. 9 | * Supports performs even stdin/stdout is not a tty. 10 | * Add a new simple apis for single instance, check by [here](https://github.com/chzyer/readline/blob/master/std.go). It need to save history manually if using this api. 11 | * #28, fixes the history is not working as expected. 12 | * #33, vim mode now support `c`, `d`, `x (delete character)`, `r (replace character)` 13 | 14 | ### 1.1 - 2015-11-20 15 | 16 | * #12 Add support for key ``/``/`` 17 | * Only enter raw mode as needed (calling `Readline()`), program will receive signal(e.g. Ctrl+C) if not interact with `readline`. 18 | * Bugs fixed for `PrefixCompleter` 19 | * Press `Ctrl+D` in empty line will cause `io.EOF` in error, Press `Ctrl+C` in anytime will cause `ErrInterrupt` instead of `io.EOF`, this will privodes a shell-like user experience. 20 | * Customable Interrupt/EOF prompt in `Config` 21 | * #17 Change atomic package to use 32bit function to let it runnable on arm 32bit devices 22 | * Provides a new password user experience(`readline.ReadPasswordEx()`). 23 | 24 | ### 1.0 - 2015-10-14 25 | 26 | * Initial public release. 27 | -------------------------------------------------------------------------------- /cmd/r/vendor/github.com/chzyer/readline/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Chzyer 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /cmd/r/vendor/github.com/chzyer/readline/char.go: -------------------------------------------------------------------------------- 1 | package readline 2 | 3 | const ( 4 | CharLineStart = 1 5 | CharBackward = 2 6 | CharInterrupt = 3 7 | CharDelete = 4 8 | CharLineEnd = 5 9 | CharForward = 6 10 | CharBell = 7 11 | CharCtrlH = 8 12 | CharTab = 9 13 | CharCtrlJ = 10 14 | CharKill = 11 15 | CharEnter = 13 16 | CharNext = 14 17 | CharPrev = 16 18 | CharBckSearch = 18 19 | CharFwdSearch = 19 20 | CharTranspose = 20 21 | CharCtrlU = 21 22 | CharCtrlW = 23 23 | CharEsc = 27 24 | CharEscapeEx = 91 25 | CharBackspace = 127 26 | ) 27 | 28 | const ( 29 | MetaBackward rune = -iota - 1 30 | MetaForward 31 | MetaDelete 32 | MetaBackspace 33 | MetaTranspose 34 | ) 35 | -------------------------------------------------------------------------------- /cmd/r/vendor/github.com/chzyer/readline/debug.go: -------------------------------------------------------------------------------- 1 | package readline 2 | 3 | import ( 4 | "container/list" 5 | "fmt" 6 | "os" 7 | "time" 8 | ) 9 | 10 | func sleep(n int) { 11 | Debug(n) 12 | time.Sleep(2000 * time.Millisecond) 13 | } 14 | 15 | // print a linked list to Debug() 16 | func debugList(l *list.List) { 17 | idx := 0 18 | for e := l.Front(); e != nil; e = e.Next() { 19 | Debug(idx, fmt.Sprintf("%+v", e.Value)) 20 | idx++ 21 | } 22 | } 23 | 24 | // append log info to another file 25 | func Debug(o ...interface{}) { 26 | f, _ := os.OpenFile("debug.tmp", os.O_RDWR|os.O_CREATE|os.O_APPEND, 0666) 27 | fmt.Fprintln(f, o...) 28 | f.Close() 29 | } 30 | -------------------------------------------------------------------------------- /cmd/r/vendor/github.com/chzyer/readline/doc.go: -------------------------------------------------------------------------------- 1 | // Readline is a pure go implementation for GNU-Readline kind library. 2 | // 3 | // WHY: Readline will support most of features which GNU Readline is supported, and provide a pure go environment and a MIT license. 4 | // 5 | // example: 6 | // rl, err := readline.New("> ") 7 | // if err != nil { 8 | // panic(err) 9 | // } 10 | // defer rl.Close() 11 | // 12 | // for { 13 | // line, err := rl.Readline() 14 | // if err != nil { // io.EOF 15 | // break 16 | // } 17 | // println(line) 18 | // } 19 | // 20 | package readline 21 | -------------------------------------------------------------------------------- /cmd/r/vendor/github.com/chzyer/readline/example/readline-multiline/readline-multiline.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "strings" 5 | 6 | "github.com/chzyer/readline" 7 | ) 8 | 9 | func main() { 10 | rl, err := readline.NewEx(&readline.Config{ 11 | Prompt: "> ", 12 | HistoryFile: "/tmp/readline-multiline", 13 | DisableAutoSaveHistory: true, 14 | }) 15 | if err != nil { 16 | panic(err) 17 | } 18 | defer rl.Close() 19 | 20 | var cmds []string 21 | for { 22 | line, err := rl.Readline() 23 | if err != nil { 24 | break 25 | } 26 | line = strings.TrimSpace(line) 27 | if len(line) == 0 { 28 | continue 29 | } 30 | cmds = append(cmds, line) 31 | if !strings.Contains(line, ";") { 32 | rl.SetPrompt(">>> ") 33 | continue 34 | } 35 | cmd := strings.Join(cmds, " ") 36 | cmds = cmds[:0] 37 | rl.SetPrompt("> ") 38 | rl.SaveHistory(cmd) 39 | println(cmd) 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /cmd/r/vendor/github.com/chzyer/readline/example/readline-remote/readline-remote-client/client.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import "github.com/chzyer/readline" 4 | 5 | func main() { 6 | if err := readline.DialRemote("tcp", ":12344"); err != nil { 7 | println(err.Error()) 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /cmd/r/vendor/github.com/chzyer/readline/example/readline-remote/readline-remote-server/server.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | 6 | "github.com/chzyer/readline" 7 | ) 8 | 9 | func main() { 10 | cfg := &readline.Config{ 11 | Prompt: "readline-remote: ", 12 | } 13 | handleFunc := func(rl *readline.Instance) { 14 | for { 15 | line, err := rl.Readline() 16 | if err != nil { 17 | break 18 | } 19 | fmt.Fprintln(rl.Stdout(), "receive:"+line) 20 | } 21 | } 22 | err := readline.ListenRemote("tcp", ":12344", cfg, handleFunc) 23 | if err != nil { 24 | println(err.Error()) 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /cmd/r/vendor/github.com/chzyer/readline/password.go: -------------------------------------------------------------------------------- 1 | package readline 2 | 3 | type opPassword struct { 4 | o *Operation 5 | backupCfg *Config 6 | } 7 | 8 | func newOpPassword(o *Operation) *opPassword { 9 | return &opPassword{o: o} 10 | } 11 | 12 | func (o *opPassword) ExitPasswordMode() { 13 | o.o.SetConfig(o.backupCfg) 14 | o.backupCfg = nil 15 | } 16 | 17 | func (o *opPassword) EnterPasswordMode(cfg *Config) (err error) { 18 | o.backupCfg, err = o.o.SetConfig(cfg) 19 | return 20 | } 21 | 22 | func (o *opPassword) PasswordConfig() *Config { 23 | return &Config{ 24 | EnableMask: true, 25 | InterruptPrompt: "\n", 26 | EOFPrompt: "\n", 27 | HistoryLimit: -1, 28 | 29 | Stdout: o.o.cfg.Stdout, 30 | Stderr: o.o.cfg.Stderr, 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /cmd/r/vendor/github.com/chzyer/readline/runes/runes_test.go: -------------------------------------------------------------------------------- 1 | package runes 2 | 3 | import ( 4 | "reflect" 5 | "testing" 6 | ) 7 | 8 | type twidth struct { 9 | r []rune 10 | length int 11 | } 12 | 13 | func TestRuneWidth(t *testing.T) { 14 | runes := []twidth{ 15 | {[]rune("☭"), 1}, 16 | {[]rune("a"), 1}, 17 | {[]rune("你"), 2}, 18 | {ColorFilter([]rune("☭\033[13;1m你")), 3}, 19 | } 20 | for _, r := range runes { 21 | if w := WidthAll(r.r); w != r.length { 22 | t.Fatal("result not expect", r.r, r.length, w) 23 | } 24 | } 25 | } 26 | 27 | type tagg struct { 28 | r [][]rune 29 | e [][]rune 30 | length int 31 | } 32 | 33 | func TestAggRunes(t *testing.T) { 34 | runes := []tagg{ 35 | { 36 | [][]rune{[]rune("ab"), []rune("a"), []rune("abc")}, 37 | [][]rune{[]rune("b"), []rune(""), []rune("bc")}, 38 | 1, 39 | }, 40 | { 41 | [][]rune{[]rune("addb"), []rune("ajkajsdf"), []rune("aasdfkc")}, 42 | [][]rune{[]rune("ddb"), []rune("jkajsdf"), []rune("asdfkc")}, 43 | 1, 44 | }, 45 | { 46 | [][]rune{[]rune("ddb"), []rune("ajksdf"), []rune("aasdfkc")}, 47 | [][]rune{[]rune("ddb"), []rune("ajksdf"), []rune("aasdfkc")}, 48 | 0, 49 | }, 50 | { 51 | [][]rune{[]rune("ddb"), []rune("ddajksdf"), []rune("ddaasdfkc")}, 52 | [][]rune{[]rune("b"), []rune("ajksdf"), []rune("aasdfkc")}, 53 | 2, 54 | }, 55 | } 56 | for _, r := range runes { 57 | same, off := Aggregate(r.r) 58 | if off != r.length { 59 | t.Fatal("result not expect", off) 60 | } 61 | if len(same) != off { 62 | t.Fatal("result not expect", same) 63 | } 64 | if !reflect.DeepEqual(r.r, r.e) { 65 | t.Fatal("result not expect") 66 | } 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /cmd/r/vendor/github.com/chzyer/readline/std.go: -------------------------------------------------------------------------------- 1 | package readline 2 | 3 | import ( 4 | "io" 5 | "os" 6 | "sync" 7 | ) 8 | 9 | var ( 10 | Stdin io.ReadCloser = os.Stdin 11 | Stdout io.WriteCloser = os.Stdout 12 | Stderr io.WriteCloser = os.Stderr 13 | ) 14 | 15 | var ( 16 | std *Instance 17 | stdOnce sync.Once 18 | ) 19 | 20 | // global instance will not submit history automatic 21 | func getInstance() *Instance { 22 | stdOnce.Do(func() { 23 | std, _ = NewEx(&Config{ 24 | DisableAutoSaveHistory: true, 25 | }) 26 | }) 27 | return std 28 | } 29 | 30 | // let readline load history from filepath 31 | // and try to persist history into disk 32 | // set fp to "" to prevent readline persisting history to disk 33 | // so the `AddHistory` will return nil error forever. 34 | func SetHistoryPath(fp string) { 35 | ins := getInstance() 36 | cfg := ins.Config.Clone() 37 | cfg.HistoryFile = fp 38 | ins.SetConfig(cfg) 39 | } 40 | 41 | // set auto completer to global instance 42 | func SetAutoComplete(completer AutoCompleter) { 43 | ins := getInstance() 44 | cfg := ins.Config.Clone() 45 | cfg.AutoComplete = completer 46 | ins.SetConfig(cfg) 47 | } 48 | 49 | // add history to global instance manually 50 | // raise error only if `SetHistoryPath` is set with a non-empty path 51 | func AddHistory(content string) error { 52 | ins := getInstance() 53 | return ins.SaveHistory(content) 54 | } 55 | 56 | // readline with global configs 57 | func Line(prompt string) (string, error) { 58 | ins := getInstance() 59 | ins.SetPrompt(prompt) 60 | return ins.Readline() 61 | } 62 | -------------------------------------------------------------------------------- /cmd/r/vendor/github.com/chzyer/readline/std_windows.go: -------------------------------------------------------------------------------- 1 | // +build windows 2 | 3 | package readline 4 | 5 | func init() { 6 | Stdin = NewRawReader() 7 | Stdout = NewANSIWriter(Stdout) 8 | Stderr = NewANSIWriter(Stderr) 9 | } 10 | -------------------------------------------------------------------------------- /cmd/r/vendor/github.com/chzyer/readline/utils_test.go: -------------------------------------------------------------------------------- 1 | package readline 2 | 3 | import ( 4 | "reflect" 5 | "testing" 6 | ) 7 | 8 | func TestSplitByMultiLine(t *testing.T) { 9 | rs := []rune("hello!bye!!!!") 10 | expected := []string{"hell", "o!", "bye!", "!!", "!"} 11 | ret := SplitByMultiLine(0, 6, 4, rs) 12 | if !reflect.DeepEqual(ret, expected) { 13 | t.Fatal(ret, expected) 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /cmd/r/vendor/github.com/chzyer/readline/utils_unix.go: -------------------------------------------------------------------------------- 1 | // +build darwin dragonfly freebsd linux,!appengine netbsd openbsd 2 | 3 | package readline 4 | 5 | import ( 6 | "os" 7 | "os/signal" 8 | "sync" 9 | "syscall" 10 | "unsafe" 11 | ) 12 | 13 | type winsize struct { 14 | Row uint16 15 | Col uint16 16 | Xpixel uint16 17 | Ypixel uint16 18 | } 19 | 20 | // get width of the terminal 21 | func getWidth(stdoutFd int) int { 22 | ws := &winsize{} 23 | retCode, _, errno := syscall.Syscall(syscall.SYS_IOCTL, 24 | uintptr(stdoutFd), 25 | uintptr(syscall.TIOCGWINSZ), 26 | uintptr(unsafe.Pointer(ws))) 27 | 28 | if int(retCode) == -1 { 29 | _ = errno 30 | return -1 31 | } 32 | return int(ws.Col) 33 | } 34 | 35 | func GetScreenWidth() int { 36 | return getWidth(syscall.Stdout) 37 | } 38 | 39 | func DefaultIsTerminal() bool { 40 | return IsTerminal(syscall.Stdin) && IsTerminal(syscall.Stdout) 41 | } 42 | 43 | func GetStdin() int { 44 | return syscall.Stdin 45 | } 46 | 47 | // ----------------------------------------------------------------------------- 48 | 49 | var ( 50 | widthChange sync.Once 51 | widthChangeCallback func() 52 | ) 53 | 54 | func DefaultOnWidthChanged(f func()) { 55 | widthChangeCallback = f 56 | widthChange.Do(func() { 57 | ch := make(chan os.Signal, 1) 58 | signal.Notify(ch, syscall.SIGWINCH) 59 | 60 | go func() { 61 | for { 62 | _, ok := <-ch 63 | if !ok { 64 | break 65 | } 66 | widthChangeCallback() 67 | } 68 | }() 69 | }) 70 | } 71 | -------------------------------------------------------------------------------- /cmd/r/vendor/github.com/chzyer/readline/utils_windows.go: -------------------------------------------------------------------------------- 1 | // +build windows 2 | 3 | package readline 4 | 5 | import "syscall" 6 | 7 | func GetStdin() int { 8 | return int(syscall.Stdin) 9 | } 10 | 11 | func init() { 12 | isWindows = true 13 | } 14 | 15 | // get width of the terminal 16 | func GetScreenWidth() int { 17 | info, _ := GetConsoleScreenBufferInfo() 18 | if info == nil { 19 | return -1 20 | } 21 | return int(info.dwSize.x) 22 | } 23 | 24 | func DefaultIsTerminal() bool { 25 | return true 26 | } 27 | 28 | func DefaultOnWidthChanged(func()) { 29 | 30 | } 31 | -------------------------------------------------------------------------------- /cmd/r/vendor/golang.org/x/crypto/.gitattributes: -------------------------------------------------------------------------------- 1 | # Treat all files in this repo as binary, with no git magic updating 2 | # line endings. Windows users contributing to Go will need to use a 3 | # modern version of git and editors capable of LF line endings. 4 | # 5 | # We'll prevent accidental CRLF line endings from entering the repo 6 | # via the git-review gofmt checks. 7 | # 8 | # See golang.org/issue/9281 9 | 10 | * -text 11 | -------------------------------------------------------------------------------- /cmd/r/vendor/golang.org/x/crypto/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 | -------------------------------------------------------------------------------- /cmd/r/vendor/golang.org/x/crypto/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing to Go 2 | 3 | Go is an open source project. 4 | 5 | It is the work of hundreds of contributors. We appreciate your help! 6 | 7 | 8 | ## Filing issues 9 | 10 | When [filing an issue](https://golang.org/issue/new), make sure to answer these five questions: 11 | 12 | 1. What version of Go are you using (`go version`)? 13 | 2. What operating system and processor architecture are you using? 14 | 3. What did you do? 15 | 4. What did you expect to see? 16 | 5. What did you see instead? 17 | 18 | General questions should go to the [golang-nuts mailing list](https://groups.google.com/group/golang-nuts) instead of the issue tracker. 19 | The gophers there will answer or ask you to file an issue if you've tripped over a bug. 20 | 21 | ## Contributing code 22 | 23 | Please read the [Contribution Guidelines](https://golang.org/doc/contribute.html) 24 | before sending patches. 25 | 26 | **We do not accept GitHub pull requests** 27 | (we use [Gerrit](https://code.google.com/p/gerrit/) instead for code review). 28 | 29 | Unless otherwise noted, the Go source files are distributed under 30 | the BSD-style license found in the LICENSE file. 31 | 32 | -------------------------------------------------------------------------------- /cmd/r/vendor/golang.org/x/crypto/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 | -------------------------------------------------------------------------------- /cmd/r/vendor/golang.org/x/crypto/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2009 The Go Authors. All rights reserved. 2 | 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions are 5 | met: 6 | 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above 10 | copyright notice, this list of conditions and the following disclaimer 11 | in the documentation and/or other materials provided with the 12 | distribution. 13 | * Neither the name of Google Inc. nor the names of its 14 | contributors may be used to endorse or promote products derived from 15 | this software without specific prior written permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | -------------------------------------------------------------------------------- /cmd/r/vendor/golang.org/x/crypto/PATENTS: -------------------------------------------------------------------------------- 1 | Additional IP Rights Grant (Patents) 2 | 3 | "This implementation" means the copyrightable works distributed by 4 | Google as part of the Go project. 5 | 6 | Google hereby grants to You a perpetual, worldwide, non-exclusive, 7 | no-charge, royalty-free, irrevocable (except as stated in this section) 8 | patent license to make, have made, use, offer to sell, sell, import, 9 | transfer and otherwise run, modify and propagate the contents of this 10 | implementation of Go, where such license applies only to those patent 11 | claims, both currently owned or controlled by Google and acquired in 12 | the future, licensable by Google that are necessarily infringed by this 13 | implementation of Go. This grant does not include claims that would be 14 | infringed only as a consequence of further modification of this 15 | implementation. If you or your agent or exclusive licensee institute or 16 | order or agree to the institution of patent litigation against any 17 | entity (including a cross-claim or counterclaim in a lawsuit) alleging 18 | that this implementation of Go or any code incorporated within this 19 | implementation of Go constitutes direct or contributory patent 20 | infringement, or inducement of patent infringement, then any patent 21 | rights granted to you under this License for this implementation of Go 22 | shall terminate as of the date such litigation is filed. 23 | -------------------------------------------------------------------------------- /cmd/r/vendor/golang.org/x/crypto/README: -------------------------------------------------------------------------------- 1 | This repository holds supplementary Go cryptography libraries. 2 | 3 | To submit changes to this repository, see http://golang.org/doc/contribute.html. 4 | -------------------------------------------------------------------------------- /cmd/r/vendor/golang.org/x/crypto/bcrypt/base64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2011 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package bcrypt 6 | 7 | import "encoding/base64" 8 | 9 | const alphabet = "./ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789" 10 | 11 | var bcEncoding = base64.NewEncoding(alphabet) 12 | 13 | func base64Encode(src []byte) []byte { 14 | n := bcEncoding.EncodedLen(len(src)) 15 | dst := make([]byte, n) 16 | bcEncoding.Encode(dst, src) 17 | for dst[n-1] == '=' { 18 | n-- 19 | } 20 | return dst[:n] 21 | } 22 | 23 | func base64Decode(src []byte) ([]byte, error) { 24 | numOfEquals := 4 - (len(src) % 4) 25 | for i := 0; i < numOfEquals; i++ { 26 | src = append(src, '=') 27 | } 28 | 29 | dst := make([]byte, bcEncoding.DecodedLen(len(src))) 30 | n, err := bcEncoding.Decode(dst, src) 31 | if err != nil { 32 | return nil, err 33 | } 34 | return dst[:n], nil 35 | } 36 | -------------------------------------------------------------------------------- /cmd/r/vendor/golang.org/x/crypto/bn256/example_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2012 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package bn256 6 | 7 | import ( 8 | "crypto/rand" 9 | ) 10 | 11 | func ExamplePair() { 12 | // This implements the tripartite Diffie-Hellman algorithm from "A One 13 | // Round Protocol for Tripartite Diffie-Hellman", A. Joux. 14 | // http://www.springerlink.com/content/cddc57yyva0hburb/fulltext.pdf 15 | 16 | // Each of three parties, a, b and c, generate a private value. 17 | a, _ := rand.Int(rand.Reader, Order) 18 | b, _ := rand.Int(rand.Reader, Order) 19 | c, _ := rand.Int(rand.Reader, Order) 20 | 21 | // Then each party calculates g₁ and g₂ times their private value. 22 | pa := new(G1).ScalarBaseMult(a) 23 | qa := new(G2).ScalarBaseMult(a) 24 | 25 | pb := new(G1).ScalarBaseMult(b) 26 | qb := new(G2).ScalarBaseMult(b) 27 | 28 | pc := new(G1).ScalarBaseMult(c) 29 | qc := new(G2).ScalarBaseMult(c) 30 | 31 | // Now each party exchanges its public values with the other two and 32 | // all parties can calculate the shared key. 33 | k1 := Pair(pb, qc) 34 | k1.ScalarMult(k1, a) 35 | 36 | k2 := Pair(pc, qa) 37 | k2.ScalarMult(k2, b) 38 | 39 | k3 := Pair(pa, qb) 40 | k3.ScalarMult(k3, c) 41 | 42 | // k1, k2 and k3 will all be equal. 43 | } 44 | -------------------------------------------------------------------------------- /cmd/r/vendor/golang.org/x/crypto/codereview.cfg: -------------------------------------------------------------------------------- 1 | issuerepo: golang/go 2 | -------------------------------------------------------------------------------- /cmd/r/vendor/golang.org/x/crypto/curve25519/const_amd64.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 | // This code was translated into a form compatible with 6a from the public 6 | // domain sources in SUPERCOP: http://bench.cr.yp.to/supercop.html 7 | 8 | // +build amd64,!gccgo,!appengine 9 | 10 | DATA ·REDMASK51(SB)/8, $0x0007FFFFFFFFFFFF 11 | GLOBL ·REDMASK51(SB), 8, $8 12 | 13 | DATA ·_121666_213(SB)/8, $996687872 14 | GLOBL ·_121666_213(SB), 8, $8 15 | 16 | DATA ·_2P0(SB)/8, $0xFFFFFFFFFFFDA 17 | GLOBL ·_2P0(SB), 8, $8 18 | 19 | DATA ·_2P1234(SB)/8, $0xFFFFFFFFFFFFE 20 | GLOBL ·_2P1234(SB), 8, $8 21 | -------------------------------------------------------------------------------- /cmd/r/vendor/golang.org/x/crypto/curve25519/curve25519_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2012 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package curve25519 6 | 7 | import ( 8 | "fmt" 9 | "testing" 10 | ) 11 | 12 | const expectedHex = "89161fde887b2b53de549af483940106ecc114d6982daa98256de23bdf77661a" 13 | 14 | func TestBaseScalarMult(t *testing.T) { 15 | var a, b [32]byte 16 | in := &a 17 | out := &b 18 | a[0] = 1 19 | 20 | for i := 0; i < 200; i++ { 21 | ScalarBaseMult(out, in) 22 | in, out = out, in 23 | } 24 | 25 | result := fmt.Sprintf("%x", in[:]) 26 | if result != expectedHex { 27 | t.Errorf("incorrect result: got %s, want %s", result, expectedHex) 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /cmd/r/vendor/golang.org/x/crypto/curve25519/doc.go: -------------------------------------------------------------------------------- 1 | // Copyright 2012 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // Package curve25519 provides an implementation of scalar multiplication on 6 | // the elliptic curve known as curve25519. See http://cr.yp.to/ecdh.html 7 | package curve25519 // import "golang.org/x/crypto/curve25519" 8 | 9 | // basePoint is the x coordinate of the generator of the curve. 10 | var basePoint = [32]byte{9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} 11 | 12 | // ScalarMult sets dst to the product in*base where dst and base are the x 13 | // coordinates of group points and all values are in little-endian form. 14 | func ScalarMult(dst, in, base *[32]byte) { 15 | scalarMult(dst, in, base) 16 | } 17 | 18 | // ScalarBaseMult sets dst to the product in*base where dst and base are the x 19 | // coordinates of group points, base is the standard generator and all values 20 | // are in little-endian form. 21 | func ScalarBaseMult(dst, in *[32]byte) { 22 | ScalarMult(dst, in, &basePoint) 23 | } 24 | -------------------------------------------------------------------------------- /cmd/r/vendor/golang.org/x/crypto/openpgp/canonical_text.go: -------------------------------------------------------------------------------- 1 | // Copyright 2011 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package openpgp 6 | 7 | import "hash" 8 | 9 | // NewCanonicalTextHash reformats text written to it into the canonical 10 | // form and then applies the hash h. See RFC 4880, section 5.2.1. 11 | func NewCanonicalTextHash(h hash.Hash) hash.Hash { 12 | return &canonicalTextHash{h, 0} 13 | } 14 | 15 | type canonicalTextHash struct { 16 | h hash.Hash 17 | s int 18 | } 19 | 20 | var newline = []byte{'\r', '\n'} 21 | 22 | func (cth *canonicalTextHash) Write(buf []byte) (int, error) { 23 | start := 0 24 | 25 | for i, c := range buf { 26 | switch cth.s { 27 | case 0: 28 | if c == '\r' { 29 | cth.s = 1 30 | } else if c == '\n' { 31 | cth.h.Write(buf[start:i]) 32 | cth.h.Write(newline) 33 | start = i + 1 34 | } 35 | case 1: 36 | cth.s = 0 37 | } 38 | } 39 | 40 | cth.h.Write(buf[start:]) 41 | return len(buf), nil 42 | } 43 | 44 | func (cth *canonicalTextHash) Sum(in []byte) []byte { 45 | return cth.h.Sum(in) 46 | } 47 | 48 | func (cth *canonicalTextHash) Reset() { 49 | cth.h.Reset() 50 | cth.s = 0 51 | } 52 | 53 | func (cth *canonicalTextHash) Size() int { 54 | return cth.h.Size() 55 | } 56 | 57 | func (cth *canonicalTextHash) BlockSize() int { 58 | return cth.h.BlockSize() 59 | } 60 | -------------------------------------------------------------------------------- /cmd/r/vendor/golang.org/x/crypto/openpgp/canonical_text_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2011 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package openpgp 6 | 7 | import ( 8 | "bytes" 9 | "testing" 10 | ) 11 | 12 | type recordingHash struct { 13 | buf *bytes.Buffer 14 | } 15 | 16 | func (r recordingHash) Write(b []byte) (n int, err error) { 17 | return r.buf.Write(b) 18 | } 19 | 20 | func (r recordingHash) Sum(in []byte) []byte { 21 | return append(in, r.buf.Bytes()...) 22 | } 23 | 24 | func (r recordingHash) Reset() { 25 | panic("shouldn't be called") 26 | } 27 | 28 | func (r recordingHash) Size() int { 29 | panic("shouldn't be called") 30 | } 31 | 32 | func (r recordingHash) BlockSize() int { 33 | panic("shouldn't be called") 34 | } 35 | 36 | func testCanonicalText(t *testing.T, input, expected string) { 37 | r := recordingHash{bytes.NewBuffer(nil)} 38 | c := NewCanonicalTextHash(r) 39 | c.Write([]byte(input)) 40 | result := c.Sum(nil) 41 | if expected != string(result) { 42 | t.Errorf("input: %x got: %x want: %x", input, result, expected) 43 | } 44 | } 45 | 46 | func TestCanonicalText(t *testing.T) { 47 | testCanonicalText(t, "foo\n", "foo\r\n") 48 | testCanonicalText(t, "foo", "foo") 49 | testCanonicalText(t, "foo\r\n", "foo\r\n") 50 | testCanonicalText(t, "foo\r\nbar", "foo\r\nbar") 51 | testCanonicalText(t, "foo\r\nbar\n\n", "foo\r\nbar\r\n\r\n") 52 | } 53 | -------------------------------------------------------------------------------- /cmd/r/vendor/golang.org/x/crypto/openpgp/packet/compressed_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2011 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package packet 6 | 7 | import ( 8 | "bytes" 9 | "encoding/hex" 10 | "io" 11 | "io/ioutil" 12 | "testing" 13 | ) 14 | 15 | func TestCompressed(t *testing.T) { 16 | packet, err := Read(readerFromHex(compressedHex)) 17 | if err != nil { 18 | t.Errorf("failed to read Compressed: %s", err) 19 | return 20 | } 21 | 22 | c, ok := packet.(*Compressed) 23 | if !ok { 24 | t.Error("didn't find Compressed packet") 25 | return 26 | } 27 | 28 | contents, err := ioutil.ReadAll(c.Body) 29 | if err != nil && err != io.EOF { 30 | t.Error(err) 31 | return 32 | } 33 | 34 | expected, _ := hex.DecodeString(compressedExpectedHex) 35 | if !bytes.Equal(expected, contents) { 36 | t.Errorf("got:%x want:%x", contents, expected) 37 | } 38 | } 39 | 40 | const compressedHex = "a3013b2d90c4e02b72e25f727e5e496a5e49b11e1700" 41 | const compressedExpectedHex = "cb1062004d14c8fe636f6e74656e74732e0a" 42 | -------------------------------------------------------------------------------- /cmd/r/vendor/golang.org/x/crypto/openpgp/packet/ocfb_test.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 | package packet 6 | 7 | import ( 8 | "bytes" 9 | "crypto/aes" 10 | "crypto/rand" 11 | "testing" 12 | ) 13 | 14 | var commonKey128 = []byte{0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6, 0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c} 15 | 16 | func testOCFB(t *testing.T, resync OCFBResyncOption) { 17 | block, err := aes.NewCipher(commonKey128) 18 | if err != nil { 19 | t.Error(err) 20 | return 21 | } 22 | 23 | plaintext := []byte("this is the plaintext, which is long enough to span several blocks.") 24 | randData := make([]byte, block.BlockSize()) 25 | rand.Reader.Read(randData) 26 | ocfb, prefix := NewOCFBEncrypter(block, randData, resync) 27 | ciphertext := make([]byte, len(plaintext)) 28 | ocfb.XORKeyStream(ciphertext, plaintext) 29 | 30 | ocfbdec := NewOCFBDecrypter(block, prefix, resync) 31 | if ocfbdec == nil { 32 | t.Errorf("NewOCFBDecrypter failed (resync: %t)", resync) 33 | return 34 | } 35 | plaintextCopy := make([]byte, len(plaintext)) 36 | ocfbdec.XORKeyStream(plaintextCopy, ciphertext) 37 | 38 | if !bytes.Equal(plaintextCopy, plaintext) { 39 | t.Errorf("got: %x, want: %x (resync: %t)", plaintextCopy, plaintext, resync) 40 | } 41 | } 42 | 43 | func TestOCFB(t *testing.T) { 44 | testOCFB(t, OCFBNoResync) 45 | testOCFB(t, OCFBResync) 46 | } 47 | -------------------------------------------------------------------------------- /cmd/r/vendor/golang.org/x/crypto/pkcs12/bmp-string.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 pkcs12 6 | 7 | import ( 8 | "errors" 9 | "unicode/utf16" 10 | ) 11 | 12 | // bmpString returns s encoded in UCS-2 with a zero terminator. 13 | func bmpString(s string) ([]byte, error) { 14 | // References: 15 | // https://tools.ietf.org/html/rfc7292#appendix-B.1 16 | // http://en.wikipedia.org/wiki/Plane_(Unicode)#Basic_Multilingual_Plane 17 | // - non-BMP characters are encoded in UTF 16 by using a surrogate pair of 16-bit codes 18 | // EncodeRune returns 0xfffd if the rune does not need special encoding 19 | // - the above RFC provides the info that BMPStrings are NULL terminated. 20 | 21 | ret := make([]byte, 0, 2*len(s)+2) 22 | 23 | for _, r := range s { 24 | if t, _ := utf16.EncodeRune(r); t != 0xfffd { 25 | return nil, errors.New("pkcs12: string contains characters that cannot be encoded in UCS-2") 26 | } 27 | ret = append(ret, byte(r/256), byte(r%256)) 28 | } 29 | 30 | return append(ret, 0, 0), nil 31 | } 32 | 33 | func decodeBMPString(bmpString []byte) (string, error) { 34 | if len(bmpString)%2 != 0 { 35 | return "", errors.New("pkcs12: odd-length BMP string") 36 | } 37 | 38 | // strip terminator if present 39 | if l := len(bmpString); l >= 2 && bmpString[l-1] == 0 && bmpString[l-2] == 0 { 40 | bmpString = bmpString[:l-2] 41 | } 42 | 43 | s := make([]uint16, 0, len(bmpString)/2) 44 | for len(bmpString) > 0 { 45 | s = append(s, uint16(bmpString[0])<<8+uint16(bmpString[1])) 46 | bmpString = bmpString[2:] 47 | } 48 | 49 | return string(utf16.Decode(s)), nil 50 | } 51 | -------------------------------------------------------------------------------- /cmd/r/vendor/golang.org/x/crypto/pkcs12/errors.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 pkcs12 6 | 7 | import "errors" 8 | 9 | var ( 10 | // ErrDecryption represents a failure to decrypt the input. 11 | ErrDecryption = errors.New("pkcs12: decryption error, incorrect padding") 12 | 13 | // ErrIncorrectPassword is returned when an incorrect password is detected. 14 | // Usually, P12/PFX data is signed to be able to verify the password. 15 | ErrIncorrectPassword = errors.New("pkcs12: decryption password incorrect") 16 | ) 17 | 18 | // NotImplementedError indicates that the input is not currently supported. 19 | type NotImplementedError string 20 | 21 | func (e NotImplementedError) Error() string { 22 | return "pkcs12: " + string(e) 23 | } 24 | -------------------------------------------------------------------------------- /cmd/r/vendor/golang.org/x/crypto/pkcs12/internal/rc2/bench_test.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 rc2 6 | 7 | import ( 8 | "testing" 9 | ) 10 | 11 | func BenchmarkEncrypt(b *testing.B) { 12 | r, _ := New([]byte{0, 0, 0, 0, 0, 0, 0, 0}, 64) 13 | b.ResetTimer() 14 | var src [8]byte 15 | for i := 0; i < b.N; i++ { 16 | r.Encrypt(src[:], src[:]) 17 | } 18 | } 19 | 20 | func BenchmarkDecrypt(b *testing.B) { 21 | r, _ := New([]byte{0, 0, 0, 0, 0, 0, 0, 0}, 64) 22 | b.ResetTimer() 23 | var src [8]byte 24 | for i := 0; i < b.N; i++ { 25 | r.Decrypt(src[:], src[:]) 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /cmd/r/vendor/golang.org/x/crypto/pkcs12/mac.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 pkcs12 6 | 7 | import ( 8 | "crypto/hmac" 9 | "crypto/sha1" 10 | "crypto/x509/pkix" 11 | "encoding/asn1" 12 | ) 13 | 14 | type macData struct { 15 | Mac digestInfo 16 | MacSalt []byte 17 | Iterations int `asn1:"optional,default:1"` 18 | } 19 | 20 | // from PKCS#7: 21 | type digestInfo struct { 22 | Algorithm pkix.AlgorithmIdentifier 23 | Digest []byte 24 | } 25 | 26 | var ( 27 | oidSHA1 = asn1.ObjectIdentifier([]int{1, 3, 14, 3, 2, 26}) 28 | ) 29 | 30 | func verifyMac(macData *macData, message, password []byte) error { 31 | if !macData.Mac.Algorithm.Algorithm.Equal(oidSHA1) { 32 | return NotImplementedError("unknown digest algorithm: " + macData.Mac.Algorithm.Algorithm.String()) 33 | } 34 | 35 | key := pbkdf(sha1Sum, 20, 64, macData.MacSalt, password, macData.Iterations, 3, 20) 36 | 37 | mac := hmac.New(sha1.New, key) 38 | mac.Write(message) 39 | expectedMAC := mac.Sum(nil) 40 | 41 | if !hmac.Equal(macData.Mac.Digest, expectedMAC) { 42 | return ErrIncorrectPassword 43 | } 44 | return nil 45 | } 46 | -------------------------------------------------------------------------------- /cmd/r/vendor/golang.org/x/crypto/pkcs12/mac_test.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 pkcs12 6 | 7 | import ( 8 | "encoding/asn1" 9 | "testing" 10 | ) 11 | 12 | func TestVerifyMac(t *testing.T) { 13 | td := macData{ 14 | Mac: digestInfo{ 15 | Digest: []byte{0x18, 0x20, 0x3d, 0xff, 0x1e, 0x16, 0xf4, 0x92, 0xf2, 0xaf, 0xc8, 0x91, 0xa9, 0xba, 0xd6, 0xca, 0x9d, 0xee, 0x51, 0x93}, 16 | }, 17 | MacSalt: []byte{1, 2, 3, 4, 5, 6, 7, 8}, 18 | Iterations: 2048, 19 | } 20 | 21 | message := []byte{11, 12, 13, 14, 15} 22 | password, _ := bmpString("") 23 | 24 | td.Mac.Algorithm.Algorithm = asn1.ObjectIdentifier([]int{1, 2, 3}) 25 | err := verifyMac(&td, message, password) 26 | if _, ok := err.(NotImplementedError); !ok { 27 | t.Errorf("err: %v", err) 28 | } 29 | 30 | td.Mac.Algorithm.Algorithm = asn1.ObjectIdentifier([]int{1, 3, 14, 3, 2, 26}) 31 | err = verifyMac(&td, message, password) 32 | if err != ErrIncorrectPassword { 33 | t.Errorf("Expected incorrect password, got err: %v", err) 34 | } 35 | 36 | password, _ = bmpString("Sesame open") 37 | err = verifyMac(&td, message, password) 38 | if err != nil { 39 | t.Errorf("err: %v", err) 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /cmd/r/vendor/golang.org/x/crypto/pkcs12/pbkdf_test.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 pkcs12 6 | 7 | import ( 8 | "bytes" 9 | "testing" 10 | ) 11 | 12 | func TestThatPBKDFWorksCorrectlyForLongKeys(t *testing.T) { 13 | cipherInfo := shaWithTripleDESCBC{} 14 | 15 | salt := []byte("\xff\xff\xff\xff\xff\xff\xff\xff") 16 | password, _ := bmpString("sesame") 17 | key := cipherInfo.deriveKey(salt, password, 2048) 18 | 19 | if expected := []byte("\x7c\xd9\xfd\x3e\x2b\x3b\xe7\x69\x1a\x44\xe3\xbe\xf0\xf9\xea\x0f\xb9\xb8\x97\xd4\xe3\x25\xd9\xd1"); bytes.Compare(key, expected) != 0 { 20 | t.Fatalf("expected key '%x', but found '%x'", expected, key) 21 | } 22 | } 23 | 24 | func TestThatPBKDFHandlesLeadingZeros(t *testing.T) { 25 | // This test triggers a case where I_j (in step 6C) ends up with leading zero 26 | // byte, meaning that len(Ijb) < v (leading zeros get stripped by big.Int). 27 | // This was previously causing bug whereby certain inputs would break the 28 | // derivation and produce the wrong output. 29 | key := pbkdf(sha1Sum, 20, 64, []byte("\xf3\x7e\x05\xb5\x18\x32\x4b\x4b"), []byte("\x00\x00"), 2048, 1, 24) 30 | expected := []byte("\x00\xf7\x59\xff\x47\xd1\x4d\xd0\x36\x65\xd5\x94\x3c\xb3\xc4\xa3\x9a\x25\x55\xc0\x2a\xed\x66\xe1") 31 | if bytes.Compare(key, expected) != 0 { 32 | t.Fatalf("expected key '%x', but found '%x'", expected, key) 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /cmd/r/vendor/golang.org/x/crypto/poly1305/const_amd64.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 | // This code was translated into a form compatible with 6a from the public 6 | // domain sources in SUPERCOP: http://bench.cr.yp.to/supercop.html 7 | 8 | // +build amd64,!gccgo,!appengine 9 | 10 | DATA ·SCALE(SB)/8, $0x37F4000000000000 11 | GLOBL ·SCALE(SB), 8, $8 12 | DATA ·TWO32(SB)/8, $0x41F0000000000000 13 | GLOBL ·TWO32(SB), 8, $8 14 | DATA ·TWO64(SB)/8, $0x43F0000000000000 15 | GLOBL ·TWO64(SB), 8, $8 16 | DATA ·TWO96(SB)/8, $0x45F0000000000000 17 | GLOBL ·TWO96(SB), 8, $8 18 | DATA ·ALPHA32(SB)/8, $0x45E8000000000000 19 | GLOBL ·ALPHA32(SB), 8, $8 20 | DATA ·ALPHA64(SB)/8, $0x47E8000000000000 21 | GLOBL ·ALPHA64(SB), 8, $8 22 | DATA ·ALPHA96(SB)/8, $0x49E8000000000000 23 | GLOBL ·ALPHA96(SB), 8, $8 24 | DATA ·ALPHA130(SB)/8, $0x4C08000000000000 25 | GLOBL ·ALPHA130(SB), 8, $8 26 | DATA ·DOFFSET0(SB)/8, $0x4330000000000000 27 | GLOBL ·DOFFSET0(SB), 8, $8 28 | DATA ·DOFFSET1(SB)/8, $0x4530000000000000 29 | GLOBL ·DOFFSET1(SB), 8, $8 30 | DATA ·DOFFSET2(SB)/8, $0x4730000000000000 31 | GLOBL ·DOFFSET2(SB), 8, $8 32 | DATA ·DOFFSET3(SB)/8, $0x4930000000000000 33 | GLOBL ·DOFFSET3(SB), 8, $8 34 | DATA ·DOFFSET3MINUSTWO128(SB)/8, $0x492FFFFE00000000 35 | GLOBL ·DOFFSET3MINUSTWO128(SB), 8, $8 36 | DATA ·HOFFSET0(SB)/8, $0x43300001FFFFFFFB 37 | GLOBL ·HOFFSET0(SB), 8, $8 38 | DATA ·HOFFSET1(SB)/8, $0x45300001FFFFFFFE 39 | GLOBL ·HOFFSET1(SB), 8, $8 40 | DATA ·HOFFSET2(SB)/8, $0x47300001FFFFFFFE 41 | GLOBL ·HOFFSET2(SB), 8, $8 42 | DATA ·HOFFSET3(SB)/8, $0x49300003FFFFFFFE 43 | GLOBL ·HOFFSET3(SB), 8, $8 44 | DATA ·ROUNDING(SB)/2, $0x137f 45 | GLOBL ·ROUNDING(SB), 8, $2 46 | -------------------------------------------------------------------------------- /cmd/r/vendor/golang.org/x/crypto/poly1305/poly1305.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 | /* 6 | Package poly1305 implements Poly1305 one-time message authentication code as specified in http://cr.yp.to/mac/poly1305-20050329.pdf. 7 | 8 | Poly1305 is a fast, one-time authentication function. It is infeasible for an 9 | attacker to generate an authenticator for a message without the key. However, a 10 | key must only be used for a single message. Authenticating two different 11 | messages with the same key allows an attacker to forge authenticators for other 12 | messages with the same key. 13 | 14 | Poly1305 was originally coupled with AES in order to make Poly1305-AES. AES was 15 | used with a fixed key in order to generate one-time keys from an nonce. 16 | However, in this package AES isn't used and the one-time key is specified 17 | directly. 18 | */ 19 | package poly1305 // import "golang.org/x/crypto/poly1305" 20 | 21 | import "crypto/subtle" 22 | 23 | // TagSize is the size, in bytes, of a poly1305 authenticator. 24 | const TagSize = 16 25 | 26 | // Verify returns true if mac is a valid authenticator for m with the given 27 | // key. 28 | func Verify(mac *[16]byte, m []byte, key *[32]byte) bool { 29 | var tmp [16]byte 30 | Sum(&tmp, m, key) 31 | return subtle.ConstantTimeCompare(tmp[:], mac[:]) == 1 32 | } 33 | -------------------------------------------------------------------------------- /cmd/r/vendor/golang.org/x/crypto/poly1305/sum_amd64.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 amd64,!gccgo,!appengine 6 | 7 | package poly1305 8 | 9 | // This function is implemented in poly1305_amd64.s 10 | 11 | //go:noescape 12 | 13 | func poly1305(out *[16]byte, m *byte, mlen uint64, key *[32]byte) 14 | 15 | // Sum generates an authenticator for m using a one-time key and puts the 16 | // 16-byte result into out. Authenticating two different messages with the same 17 | // key allows an attacker to forge messages at will. 18 | func Sum(out *[16]byte, m []byte, key *[32]byte) { 19 | var mPtr *byte 20 | if len(m) > 0 { 21 | mPtr = &m[0] 22 | } 23 | poly1305(out, mPtr, uint64(len(m)), key) 24 | } 25 | -------------------------------------------------------------------------------- /cmd/r/vendor/golang.org/x/crypto/poly1305/sum_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 | // +build arm,!gccgo,!appengine 6 | 7 | package poly1305 8 | 9 | // This function is implemented in poly1305_arm.s 10 | 11 | //go:noescape 12 | 13 | func poly1305_auth_armv6(out *[16]byte, m *byte, mlen uint32, key *[32]byte) 14 | 15 | // Sum generates an authenticator for m using a one-time key and puts the 16 | // 16-byte result into out. Authenticating two different messages with the same 17 | // key allows an attacker to forge messages at will. 18 | func Sum(out *[16]byte, m []byte, key *[32]byte) { 19 | var mPtr *byte 20 | if len(m) > 0 { 21 | mPtr = &m[0] 22 | } 23 | poly1305_auth_armv6(out, mPtr, uint32(len(m)), key) 24 | } 25 | -------------------------------------------------------------------------------- /cmd/r/vendor/golang.org/x/crypto/salsa20/salsa/salsa20_amd64.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 amd64,!appengine,!gccgo 6 | 7 | package salsa 8 | 9 | // This function is implemented in salsa2020_amd64.s. 10 | 11 | //go:noescape 12 | 13 | func salsa2020XORKeyStream(out, in *byte, n uint64, nonce, key *byte) 14 | 15 | // XORKeyStream crypts bytes from in to out using the given key and counters. 16 | // In and out may be the same slice but otherwise should not overlap. Counter 17 | // contains the raw salsa20 counter bytes (both nonce and block counter). 18 | func XORKeyStream(out, in []byte, counter *[16]byte, key *[32]byte) { 19 | if len(in) == 0 { 20 | return 21 | } 22 | salsa2020XORKeyStream(&out[0], &in[0], uint64(len(in)), &counter[0], &key[0]) 23 | } 24 | -------------------------------------------------------------------------------- /cmd/r/vendor/golang.org/x/crypto/salsa20/salsa/salsa_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2012 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package salsa 6 | 7 | import "testing" 8 | 9 | func TestCore208(t *testing.T) { 10 | in := [64]byte{ 11 | 0x7e, 0x87, 0x9a, 0x21, 0x4f, 0x3e, 0xc9, 0x86, 12 | 0x7c, 0xa9, 0x40, 0xe6, 0x41, 0x71, 0x8f, 0x26, 13 | 0xba, 0xee, 0x55, 0x5b, 0x8c, 0x61, 0xc1, 0xb5, 14 | 0x0d, 0xf8, 0x46, 0x11, 0x6d, 0xcd, 0x3b, 0x1d, 15 | 0xee, 0x24, 0xf3, 0x19, 0xdf, 0x9b, 0x3d, 0x85, 16 | 0x14, 0x12, 0x1e, 0x4b, 0x5a, 0xc5, 0xaa, 0x32, 17 | 0x76, 0x02, 0x1d, 0x29, 0x09, 0xc7, 0x48, 0x29, 18 | 0xed, 0xeb, 0xc6, 0x8d, 0xb8, 0xb8, 0xc2, 0x5e} 19 | 20 | out := [64]byte{ 21 | 0xa4, 0x1f, 0x85, 0x9c, 0x66, 0x08, 0xcc, 0x99, 22 | 0x3b, 0x81, 0xca, 0xcb, 0x02, 0x0c, 0xef, 0x05, 23 | 0x04, 0x4b, 0x21, 0x81, 0xa2, 0xfd, 0x33, 0x7d, 24 | 0xfd, 0x7b, 0x1c, 0x63, 0x96, 0x68, 0x2f, 0x29, 25 | 0xb4, 0x39, 0x31, 0x68, 0xe3, 0xc9, 0xe6, 0xbc, 26 | 0xfe, 0x6b, 0xc5, 0xb7, 0xa0, 0x6d, 0x96, 0xba, 27 | 0xe4, 0x24, 0xcc, 0x10, 0x2c, 0x91, 0x74, 0x5c, 28 | 0x24, 0xad, 0x67, 0x3d, 0xc7, 0x61, 0x8f, 0x81, 29 | } 30 | 31 | Core208(&in, &in) 32 | if in != out { 33 | t.Errorf("expected %x, got %x", out, in) 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /cmd/r/vendor/golang.org/x/crypto/sha3/register.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build go1.4 6 | 7 | package sha3 8 | 9 | import ( 10 | "crypto" 11 | ) 12 | 13 | func init() { 14 | crypto.RegisterHash(crypto.SHA3_224, New224) 15 | crypto.RegisterHash(crypto.SHA3_256, New256) 16 | crypto.RegisterHash(crypto.SHA3_384, New384) 17 | crypto.RegisterHash(crypto.SHA3_512, New512) 18 | } 19 | -------------------------------------------------------------------------------- /cmd/r/vendor/golang.org/x/crypto/sha3/testdata/keccakKats.json.deflate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jesselucas/r/c35141876aef84856fa6e5f2866c7cd229252ba1/cmd/r/vendor/golang.org/x/crypto/sha3/testdata/keccakKats.json.deflate -------------------------------------------------------------------------------- /cmd/r/vendor/golang.org/x/crypto/sha3/xor.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 !amd64,!386,!ppc64,!ppc64le appengine 6 | 7 | package sha3 8 | 9 | var ( 10 | xorIn = xorInGeneric 11 | copyOut = copyOutGeneric 12 | xorInUnaligned = xorInGeneric 13 | copyOutUnaligned = copyOutGeneric 14 | ) 15 | 16 | const xorImplementationUnaligned = "generic" 17 | -------------------------------------------------------------------------------- /cmd/r/vendor/golang.org/x/crypto/sha3/xor_generic.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 sha3 6 | 7 | import "encoding/binary" 8 | 9 | // xorInGeneric xors the bytes in buf into the state; it 10 | // makes no non-portable assumptions about memory layout 11 | // or alignment. 12 | func xorInGeneric(d *state, buf []byte) { 13 | n := len(buf) / 8 14 | 15 | for i := 0; i < n; i++ { 16 | a := binary.LittleEndian.Uint64(buf) 17 | d.a[i] ^= a 18 | buf = buf[8:] 19 | } 20 | } 21 | 22 | // copyOutGeneric copies ulint64s to a byte buffer. 23 | func copyOutGeneric(d *state, b []byte) { 24 | for i := 0; len(b) >= 8; i++ { 25 | binary.LittleEndian.PutUint64(b, d.a[i]) 26 | b = b[8:] 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /cmd/r/vendor/golang.org/x/crypto/sha3/xor_unaligned.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 amd64 386 ppc64 ppc64le 6 | // +build !appengine 7 | 8 | package sha3 9 | 10 | import "unsafe" 11 | 12 | func xorInUnaligned(d *state, buf []byte) { 13 | bw := (*[maxRate / 8]uint64)(unsafe.Pointer(&buf[0])) 14 | n := len(buf) 15 | if n >= 72 { 16 | d.a[0] ^= bw[0] 17 | d.a[1] ^= bw[1] 18 | d.a[2] ^= bw[2] 19 | d.a[3] ^= bw[3] 20 | d.a[4] ^= bw[4] 21 | d.a[5] ^= bw[5] 22 | d.a[6] ^= bw[6] 23 | d.a[7] ^= bw[7] 24 | d.a[8] ^= bw[8] 25 | } 26 | if n >= 104 { 27 | d.a[9] ^= bw[9] 28 | d.a[10] ^= bw[10] 29 | d.a[11] ^= bw[11] 30 | d.a[12] ^= bw[12] 31 | } 32 | if n >= 136 { 33 | d.a[13] ^= bw[13] 34 | d.a[14] ^= bw[14] 35 | d.a[15] ^= bw[15] 36 | d.a[16] ^= bw[16] 37 | } 38 | if n >= 144 { 39 | d.a[17] ^= bw[17] 40 | } 41 | if n >= 168 { 42 | d.a[18] ^= bw[18] 43 | d.a[19] ^= bw[19] 44 | d.a[20] ^= bw[20] 45 | } 46 | } 47 | 48 | func copyOutUnaligned(d *state, buf []byte) { 49 | ab := (*[maxRate]uint8)(unsafe.Pointer(&d.a[0])) 50 | copy(buf, ab[:]) 51 | } 52 | 53 | var ( 54 | xorIn = xorInUnaligned 55 | copyOut = copyOutUnaligned 56 | ) 57 | 58 | const xorImplementationUnaligned = "unaligned" 59 | -------------------------------------------------------------------------------- /cmd/r/vendor/golang.org/x/crypto/ssh/agent/example_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package agent_test 6 | 7 | import ( 8 | "log" 9 | "os" 10 | "net" 11 | 12 | "golang.org/x/crypto/ssh" 13 | "golang.org/x/crypto/ssh/agent" 14 | ) 15 | 16 | func ExampleClientAgent() { 17 | // ssh-agent has a UNIX socket under $SSH_AUTH_SOCK 18 | socket := os.Getenv("SSH_AUTH_SOCK") 19 | conn, err := net.Dial("unix", socket) 20 | if err != nil { 21 | log.Fatalf("net.Dial: %v", err) 22 | } 23 | agentClient := agent.NewClient(conn) 24 | config := &ssh.ClientConfig{ 25 | User: "username", 26 | Auth: []ssh.AuthMethod{ 27 | // Use a callback rather than PublicKeys 28 | // so we only consult the agent once the remote server 29 | // wants it. 30 | ssh.PublicKeysCallback(agentClient.Signers), 31 | }, 32 | } 33 | 34 | sshc, err := ssh.Dial("tcp", "localhost:22", config) 35 | if err != nil { 36 | log.Fatalf("Dial: %v", err) 37 | } 38 | // .. use sshc 39 | sshc.Close() 40 | } 41 | -------------------------------------------------------------------------------- /cmd/r/vendor/golang.org/x/crypto/ssh/client_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package ssh 6 | 7 | import ( 8 | "net" 9 | "testing" 10 | ) 11 | 12 | func testClientVersion(t *testing.T, config *ClientConfig, expected string) { 13 | clientConn, serverConn := net.Pipe() 14 | defer clientConn.Close() 15 | receivedVersion := make(chan string, 1) 16 | go func() { 17 | version, err := readVersion(serverConn) 18 | if err != nil { 19 | receivedVersion <- "" 20 | } else { 21 | receivedVersion <- string(version) 22 | } 23 | serverConn.Close() 24 | }() 25 | NewClientConn(clientConn, "", config) 26 | actual := <-receivedVersion 27 | if actual != expected { 28 | t.Fatalf("got %s; want %s", actual, expected) 29 | } 30 | } 31 | 32 | func TestCustomClientVersion(t *testing.T) { 33 | version := "Test-Client-Version-0.0" 34 | testClientVersion(t, &ClientConfig{ClientVersion: version}, version) 35 | } 36 | 37 | func TestDefaultClientVersion(t *testing.T) { 38 | testClientVersion(t, &ClientConfig{}, packageVersion) 39 | } 40 | -------------------------------------------------------------------------------- /cmd/r/vendor/golang.org/x/crypto/ssh/doc.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 | /* 6 | Package ssh implements an SSH client and server. 7 | 8 | SSH is a transport security protocol, an authentication protocol and a 9 | family of application protocols. The most typical application level 10 | protocol is a remote shell and this is specifically implemented. However, 11 | the multiplexed nature of SSH is exposed to users that wish to support 12 | others. 13 | 14 | References: 15 | [PROTOCOL.certkeys]: http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/usr.bin/ssh/PROTOCOL.certkeys?rev=HEAD 16 | [SSH-PARAMETERS]: http://www.iana.org/assignments/ssh-parameters/ssh-parameters.xml#ssh-parameters-1 17 | */ 18 | package ssh // import "golang.org/x/crypto/ssh" 19 | -------------------------------------------------------------------------------- /cmd/r/vendor/golang.org/x/crypto/ssh/kex_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package ssh 6 | 7 | // Key exchange tests. 8 | 9 | import ( 10 | "crypto/rand" 11 | "reflect" 12 | "testing" 13 | ) 14 | 15 | func TestKexes(t *testing.T) { 16 | type kexResultErr struct { 17 | result *kexResult 18 | err error 19 | } 20 | 21 | for name, kex := range kexAlgoMap { 22 | a, b := memPipe() 23 | 24 | s := make(chan kexResultErr, 1) 25 | c := make(chan kexResultErr, 1) 26 | var magics handshakeMagics 27 | go func() { 28 | r, e := kex.Client(a, rand.Reader, &magics) 29 | a.Close() 30 | c <- kexResultErr{r, e} 31 | }() 32 | go func() { 33 | r, e := kex.Server(b, rand.Reader, &magics, testSigners["ecdsa"]) 34 | b.Close() 35 | s <- kexResultErr{r, e} 36 | }() 37 | 38 | clientRes := <-c 39 | serverRes := <-s 40 | if clientRes.err != nil { 41 | t.Errorf("client: %v", clientRes.err) 42 | } 43 | if serverRes.err != nil { 44 | t.Errorf("server: %v", serverRes.err) 45 | } 46 | if !reflect.DeepEqual(clientRes.result, serverRes.result) { 47 | t.Errorf("kex %q: mismatch %#v, %#v", name, clientRes.result, serverRes.result) 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /cmd/r/vendor/golang.org/x/crypto/ssh/mac.go: -------------------------------------------------------------------------------- 1 | // Copyright 2012 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package ssh 6 | 7 | // Message authentication support 8 | 9 | import ( 10 | "crypto/hmac" 11 | "crypto/sha1" 12 | "crypto/sha256" 13 | "hash" 14 | ) 15 | 16 | type macMode struct { 17 | keySize int 18 | new func(key []byte) hash.Hash 19 | } 20 | 21 | // truncatingMAC wraps around a hash.Hash and truncates the output digest to 22 | // a given size. 23 | type truncatingMAC struct { 24 | length int 25 | hmac hash.Hash 26 | } 27 | 28 | func (t truncatingMAC) Write(data []byte) (int, error) { 29 | return t.hmac.Write(data) 30 | } 31 | 32 | func (t truncatingMAC) Sum(in []byte) []byte { 33 | out := t.hmac.Sum(in) 34 | return out[:len(in)+t.length] 35 | } 36 | 37 | func (t truncatingMAC) Reset() { 38 | t.hmac.Reset() 39 | } 40 | 41 | func (t truncatingMAC) Size() int { 42 | return t.length 43 | } 44 | 45 | func (t truncatingMAC) BlockSize() int { return t.hmac.BlockSize() } 46 | 47 | var macModes = map[string]*macMode{ 48 | "hmac-sha2-256": {32, func(key []byte) hash.Hash { 49 | return hmac.New(sha256.New, key) 50 | }}, 51 | "hmac-sha1": {20, func(key []byte) hash.Hash { 52 | return hmac.New(sha1.New, key) 53 | }}, 54 | "hmac-sha1-96": {20, func(key []byte) hash.Hash { 55 | return truncatingMAC{12, hmac.New(sha1.New, key)} 56 | }}, 57 | } 58 | -------------------------------------------------------------------------------- /cmd/r/vendor/golang.org/x/crypto/ssh/tcpip_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package ssh 6 | 7 | import ( 8 | "testing" 9 | ) 10 | 11 | func TestAutoPortListenBroken(t *testing.T) { 12 | broken := "SSH-2.0-OpenSSH_5.9hh11" 13 | works := "SSH-2.0-OpenSSH_6.1" 14 | if !isBrokenOpenSSHVersion(broken) { 15 | t.Errorf("version %q not marked as broken", broken) 16 | } 17 | if isBrokenOpenSSHVersion(works) { 18 | t.Errorf("version %q marked as broken", works) 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /cmd/r/vendor/golang.org/x/crypto/ssh/terminal/util_bsd.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build darwin dragonfly freebsd netbsd openbsd 6 | 7 | package terminal 8 | 9 | import "syscall" 10 | 11 | const ioctlReadTermios = syscall.TIOCGETA 12 | const ioctlWriteTermios = syscall.TIOCSETA 13 | -------------------------------------------------------------------------------- /cmd/r/vendor/golang.org/x/crypto/ssh/terminal/util_linux.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package terminal 6 | 7 | // These constants are declared here, rather than importing 8 | // them from the syscall package as some syscall packages, even 9 | // on linux, for example gccgo, do not declare them. 10 | const ioctlReadTermios = 0x5401 // syscall.TCGETS 11 | const ioctlWriteTermios = 0x5402 // syscall.TCSETS 12 | -------------------------------------------------------------------------------- /cmd/r/vendor/golang.org/x/crypto/ssh/test/cert_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build darwin dragonfly freebsd linux netbsd openbsd 6 | 7 | package test 8 | 9 | import ( 10 | "crypto/rand" 11 | "testing" 12 | 13 | "golang.org/x/crypto/ssh" 14 | ) 15 | 16 | func TestCertLogin(t *testing.T) { 17 | s := newServer(t) 18 | defer s.Shutdown() 19 | 20 | // Use a key different from the default. 21 | clientKey := testSigners["dsa"] 22 | caAuthKey := testSigners["ecdsa"] 23 | cert := &ssh.Certificate{ 24 | Key: clientKey.PublicKey(), 25 | ValidPrincipals: []string{username()}, 26 | CertType: ssh.UserCert, 27 | ValidBefore: ssh.CertTimeInfinity, 28 | } 29 | if err := cert.SignCert(rand.Reader, caAuthKey); err != nil { 30 | t.Fatalf("SetSignature: %v", err) 31 | } 32 | 33 | certSigner, err := ssh.NewCertSigner(cert, clientKey) 34 | if err != nil { 35 | t.Fatalf("NewCertSigner: %v", err) 36 | } 37 | 38 | conf := &ssh.ClientConfig{ 39 | User: username(), 40 | } 41 | conf.Auth = append(conf.Auth, ssh.PublicKeys(certSigner)) 42 | client, err := s.TryDial(conf) 43 | if err != nil { 44 | t.Fatalf("TryDial: %v", err) 45 | } 46 | client.Close() 47 | } 48 | -------------------------------------------------------------------------------- /cmd/r/vendor/golang.org/x/crypto/ssh/test/doc.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 | // This package contains integration tests for the 6 | // golang.org/x/crypto/ssh package. 7 | package test // import "golang.org/x/crypto/ssh/test" 8 | -------------------------------------------------------------------------------- /cmd/r/vendor/golang.org/x/crypto/ssh/test/tcpip_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2012 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !windows 6 | 7 | package test 8 | 9 | // direct-tcpip functional tests 10 | 11 | import ( 12 | "io" 13 | "net" 14 | "testing" 15 | ) 16 | 17 | func TestDial(t *testing.T) { 18 | server := newServer(t) 19 | defer server.Shutdown() 20 | sshConn := server.Dial(clientConfig()) 21 | defer sshConn.Close() 22 | 23 | l, err := net.Listen("tcp", "127.0.0.1:0") 24 | if err != nil { 25 | t.Fatalf("Listen: %v", err) 26 | } 27 | defer l.Close() 28 | 29 | go func() { 30 | for { 31 | c, err := l.Accept() 32 | if err != nil { 33 | break 34 | } 35 | 36 | io.WriteString(c, c.RemoteAddr().String()) 37 | c.Close() 38 | } 39 | }() 40 | 41 | conn, err := sshConn.Dial("tcp", l.Addr().String()) 42 | if err != nil { 43 | t.Fatalf("Dial: %v", err) 44 | } 45 | defer conn.Close() 46 | } 47 | -------------------------------------------------------------------------------- /cmd/r/vendor/golang.org/x/crypto/ssh/testdata/doc.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 | // This package contains test data shared between the various subpackages of 6 | // the golang.org/x/crypto/ssh package. Under no circumstance should 7 | // this data be used for production code. 8 | package testdata // import "golang.org/x/crypto/ssh/testdata" 9 | -------------------------------------------------------------------------------- /vendor/github.com/boltdb/bolt/.gitignore: -------------------------------------------------------------------------------- 1 | *.prof 2 | *.test 3 | *.swp 4 | /bin/ 5 | -------------------------------------------------------------------------------- /vendor/github.com/boltdb/bolt/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2013 Ben Johnson 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | this software and associated documentation files (the "Software"), to deal in 7 | the Software without restriction, including without limitation the rights to 8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | the Software, and to permit persons to whom the Software is furnished to do so, 10 | subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /vendor/github.com/boltdb/bolt/Makefile: -------------------------------------------------------------------------------- 1 | BRANCH=`git rev-parse --abbrev-ref HEAD` 2 | COMMIT=`git rev-parse --short HEAD` 3 | GOLDFLAGS="-X main.branch $(BRANCH) -X main.commit $(COMMIT)" 4 | 5 | default: build 6 | 7 | race: 8 | @go test -v -race -test.run="TestSimulate_(100op|1000op)" 9 | 10 | # go get github.com/kisielk/errcheck 11 | errcheck: 12 | @errcheck -ignorepkg=bytes -ignore=os:Remove github.com/boltdb/bolt 13 | 14 | test: 15 | @go test -v -cover . 16 | @go test -v ./cmd/bolt 17 | 18 | .PHONY: fmt test 19 | -------------------------------------------------------------------------------- /vendor/github.com/boltdb/bolt/appveyor.yml: -------------------------------------------------------------------------------- 1 | version: "{build}" 2 | 3 | os: Windows Server 2012 R2 4 | 5 | clone_folder: c:\gopath\src\github.com\boltdb\bolt 6 | 7 | environment: 8 | GOPATH: c:\gopath 9 | 10 | install: 11 | - echo %PATH% 12 | - echo %GOPATH% 13 | - go version 14 | - go env 15 | - go get -v -t ./... 16 | 17 | build_script: 18 | - go test -v ./... 19 | -------------------------------------------------------------------------------- /vendor/github.com/boltdb/bolt/bolt_386.go: -------------------------------------------------------------------------------- 1 | package bolt 2 | 3 | // maxMapSize represents the largest mmap size supported by Bolt. 4 | const maxMapSize = 0x7FFFFFFF // 2GB 5 | 6 | // maxAllocSize is the size used when creating array pointers. 7 | const maxAllocSize = 0xFFFFFFF 8 | 9 | // Are unaligned load/stores broken on this arch? 10 | var brokenUnaligned = false 11 | -------------------------------------------------------------------------------- /vendor/github.com/boltdb/bolt/bolt_amd64.go: -------------------------------------------------------------------------------- 1 | package bolt 2 | 3 | // maxMapSize represents the largest mmap size supported by Bolt. 4 | const maxMapSize = 0xFFFFFFFFFFFF // 256TB 5 | 6 | // maxAllocSize is the size used when creating array pointers. 7 | const maxAllocSize = 0x7FFFFFFF 8 | 9 | // Are unaligned load/stores broken on this arch? 10 | var brokenUnaligned = false 11 | -------------------------------------------------------------------------------- /vendor/github.com/boltdb/bolt/bolt_arm.go: -------------------------------------------------------------------------------- 1 | package bolt 2 | 3 | import "unsafe" 4 | 5 | // maxMapSize represents the largest mmap size supported by Bolt. 6 | const maxMapSize = 0x7FFFFFFF // 2GB 7 | 8 | // maxAllocSize is the size used when creating array pointers. 9 | const maxAllocSize = 0xFFFFFFF 10 | 11 | // Are unaligned load/stores broken on this arch? 12 | var brokenUnaligned bool 13 | 14 | func init() { 15 | // Simple check to see whether this arch handles unaligned load/stores 16 | // correctly. 17 | 18 | // ARM9 and older devices require load/stores to be from/to aligned 19 | // addresses. If not, the lower 2 bits are cleared and that address is 20 | // read in a jumbled up order. 21 | 22 | // See http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.faqs/ka15414.html 23 | 24 | raw := [6]byte{0xfe, 0xef, 0x11, 0x22, 0x22, 0x11} 25 | val := *(*uint32)(unsafe.Pointer(uintptr(unsafe.Pointer(&raw)) + 2)) 26 | 27 | brokenUnaligned = val != 0x11222211 28 | } 29 | -------------------------------------------------------------------------------- /vendor/github.com/boltdb/bolt/bolt_arm64.go: -------------------------------------------------------------------------------- 1 | // +build arm64 2 | 3 | package bolt 4 | 5 | // maxMapSize represents the largest mmap size supported by Bolt. 6 | const maxMapSize = 0xFFFFFFFFFFFF // 256TB 7 | 8 | // maxAllocSize is the size used when creating array pointers. 9 | const maxAllocSize = 0x7FFFFFFF 10 | 11 | // Are unaligned load/stores broken on this arch? 12 | var brokenUnaligned = false 13 | -------------------------------------------------------------------------------- /vendor/github.com/boltdb/bolt/bolt_linux.go: -------------------------------------------------------------------------------- 1 | package bolt 2 | 3 | import ( 4 | "syscall" 5 | ) 6 | 7 | // fdatasync flushes written data to a file descriptor. 8 | func fdatasync(db *DB) error { 9 | return syscall.Fdatasync(int(db.file.Fd())) 10 | } 11 | -------------------------------------------------------------------------------- /vendor/github.com/boltdb/bolt/bolt_openbsd.go: -------------------------------------------------------------------------------- 1 | package bolt 2 | 3 | import ( 4 | "syscall" 5 | "unsafe" 6 | ) 7 | 8 | const ( 9 | msAsync = 1 << iota // perform asynchronous writes 10 | msSync // perform synchronous writes 11 | msInvalidate // invalidate cached data 12 | ) 13 | 14 | func msync(db *DB) error { 15 | _, _, errno := syscall.Syscall(syscall.SYS_MSYNC, uintptr(unsafe.Pointer(db.data)), uintptr(db.datasz), msInvalidate) 16 | if errno != 0 { 17 | return errno 18 | } 19 | return nil 20 | } 21 | 22 | func fdatasync(db *DB) error { 23 | if db.data != nil { 24 | return msync(db) 25 | } 26 | return db.file.Sync() 27 | } 28 | -------------------------------------------------------------------------------- /vendor/github.com/boltdb/bolt/bolt_ppc.go: -------------------------------------------------------------------------------- 1 | // +build ppc 2 | 3 | package bolt 4 | 5 | // maxMapSize represents the largest mmap size supported by Bolt. 6 | const maxMapSize = 0x7FFFFFFF // 2GB 7 | 8 | // maxAllocSize is the size used when creating array pointers. 9 | const maxAllocSize = 0xFFFFFFF 10 | -------------------------------------------------------------------------------- /vendor/github.com/boltdb/bolt/bolt_ppc64.go: -------------------------------------------------------------------------------- 1 | // +build ppc64 2 | 3 | package bolt 4 | 5 | // maxMapSize represents the largest mmap size supported by Bolt. 6 | const maxMapSize = 0xFFFFFFFFFFFF // 256TB 7 | 8 | // maxAllocSize is the size used when creating array pointers. 9 | const maxAllocSize = 0x7FFFFFFF 10 | 11 | // Are unaligned load/stores broken on this arch? 12 | var brokenUnaligned = false 13 | -------------------------------------------------------------------------------- /vendor/github.com/boltdb/bolt/bolt_ppc64le.go: -------------------------------------------------------------------------------- 1 | // +build ppc64le 2 | 3 | package bolt 4 | 5 | // maxMapSize represents the largest mmap size supported by Bolt. 6 | const maxMapSize = 0xFFFFFFFFFFFF // 256TB 7 | 8 | // maxAllocSize is the size used when creating array pointers. 9 | const maxAllocSize = 0x7FFFFFFF 10 | 11 | // Are unaligned load/stores broken on this arch? 12 | var brokenUnaligned = false 13 | -------------------------------------------------------------------------------- /vendor/github.com/boltdb/bolt/bolt_s390x.go: -------------------------------------------------------------------------------- 1 | // +build s390x 2 | 3 | package bolt 4 | 5 | // maxMapSize represents the largest mmap size supported by Bolt. 6 | const maxMapSize = 0xFFFFFFFFFFFF // 256TB 7 | 8 | // maxAllocSize is the size used when creating array pointers. 9 | const maxAllocSize = 0x7FFFFFFF 10 | 11 | // Are unaligned load/stores broken on this arch? 12 | var brokenUnaligned = false 13 | -------------------------------------------------------------------------------- /vendor/github.com/boltdb/bolt/boltsync_unix.go: -------------------------------------------------------------------------------- 1 | // +build !windows,!plan9,!linux,!openbsd 2 | 3 | package bolt 4 | 5 | // fdatasync flushes written data to a file descriptor. 6 | func fdatasync(db *DB) error { 7 | return db.file.Sync() 8 | } 9 | -------------------------------------------------------------------------------- /vendor/github.com/chzyer/readline/.gitignore: -------------------------------------------------------------------------------- 1 | *.exe 2 | *.tmp 3 | -------------------------------------------------------------------------------- /vendor/github.com/chzyer/readline/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | go: 3 | - 1.5 4 | before_install: 5 | - go get golang.org/x/crypto/ssh/terminal 6 | script: 7 | - GOOS=windows go install github.com/chzyer/readline/example/... 8 | - GOOS=linux go install github.com/chzyer/readline/example/... 9 | - GOOS=darwin go install github.com/chzyer/readline/example/... 10 | - go test -v 11 | -------------------------------------------------------------------------------- /vendor/github.com/chzyer/readline/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Chzyer 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /vendor/github.com/chzyer/readline/char.go: -------------------------------------------------------------------------------- 1 | package readline 2 | 3 | const ( 4 | CharLineStart = 1 5 | CharBackward = 2 6 | CharInterrupt = 3 7 | CharDelete = 4 8 | CharLineEnd = 5 9 | CharForward = 6 10 | CharBell = 7 11 | CharCtrlH = 8 12 | CharTab = 9 13 | CharCtrlJ = 10 14 | CharKill = 11 15 | CharCtrlL = 12 16 | CharEnter = 13 17 | CharNext = 14 18 | CharPrev = 16 19 | CharBckSearch = 18 20 | CharFwdSearch = 19 21 | CharTranspose = 20 22 | CharCtrlU = 21 23 | CharCtrlW = 23 24 | CharCtrlZ = 26 25 | CharEsc = 27 26 | CharEscapeEx = 91 27 | CharBackspace = 127 28 | ) 29 | 30 | const ( 31 | MetaBackward rune = -iota - 1 32 | MetaForward 33 | MetaDelete 34 | MetaBackspace 35 | MetaTranspose 36 | ) 37 | -------------------------------------------------------------------------------- /vendor/github.com/chzyer/readline/debug.go: -------------------------------------------------------------------------------- 1 | package readline 2 | 3 | import ( 4 | "container/list" 5 | "fmt" 6 | "os" 7 | "time" 8 | ) 9 | 10 | func sleep(n int) { 11 | Debug(n) 12 | time.Sleep(2000 * time.Millisecond) 13 | } 14 | 15 | // print a linked list to Debug() 16 | func debugList(l *list.List) { 17 | idx := 0 18 | for e := l.Front(); e != nil; e = e.Next() { 19 | Debug(idx, fmt.Sprintf("%+v", e.Value)) 20 | idx++ 21 | } 22 | } 23 | 24 | // append log info to another file 25 | func Debug(o ...interface{}) { 26 | f, _ := os.OpenFile("debug.tmp", os.O_RDWR|os.O_CREATE|os.O_APPEND, 0666) 27 | fmt.Fprintln(f, o...) 28 | f.Close() 29 | } 30 | -------------------------------------------------------------------------------- /vendor/github.com/chzyer/readline/doc.go: -------------------------------------------------------------------------------- 1 | // Readline is a pure go implementation for GNU-Readline kind library. 2 | // 3 | // WHY: Readline will support most of features which GNU Readline is supported, and provide a pure go environment and a MIT license. 4 | // 5 | // example: 6 | // rl, err := readline.New("> ") 7 | // if err != nil { 8 | // panic(err) 9 | // } 10 | // defer rl.Close() 11 | // 12 | // for { 13 | // line, err := rl.Readline() 14 | // if err != nil { // io.EOF 15 | // break 16 | // } 17 | // println(line) 18 | // } 19 | // 20 | package readline 21 | -------------------------------------------------------------------------------- /vendor/github.com/chzyer/readline/example/readline-im/README.md: -------------------------------------------------------------------------------- 1 | # readline-im 2 | 3 | ![readline-im](https://dl.dropboxusercontent.com/s/52hc7bo92g3pgi5/03F93B8D-9B4B-4D35-BBAA-22FBDAC7F299-26173-000164AA33980001.gif?dl=0) 4 | -------------------------------------------------------------------------------- /vendor/github.com/chzyer/readline/example/readline-im/readline-im.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "math/rand" 6 | "time" 7 | 8 | "github.com/chzyer/readline" 9 | ) 10 | import "log" 11 | 12 | func main() { 13 | rl, err := readline.NewEx(&readline.Config{ 14 | UniqueEditLine: true, 15 | }) 16 | if err != nil { 17 | panic(err) 18 | } 19 | defer rl.Close() 20 | 21 | rl.SetPrompt("username: ") 22 | username, err := rl.Readline() 23 | if err != nil { 24 | return 25 | } 26 | rl.ResetHistory() 27 | log.SetOutput(rl.Stderr()) 28 | 29 | fmt.Fprintln(rl, "Hi,", username+"! My name is Dave.") 30 | rl.SetPrompt(username + "> ") 31 | 32 | done := make(chan struct{}) 33 | go func() { 34 | rand.Seed(time.Now().Unix()) 35 | loop: 36 | for { 37 | select { 38 | case <-time.After(time.Duration(rand.Intn(20)) * 100 * time.Millisecond): 39 | case <-done: 40 | break loop 41 | } 42 | log.Println("Dave:", "hello") 43 | } 44 | log.Println("Dave:", "bye") 45 | done <- struct{}{} 46 | }() 47 | 48 | for { 49 | ln := rl.Line() 50 | if ln.CanContinue() { 51 | continue 52 | } else if ln.CanBreak() { 53 | break 54 | } 55 | log.Println(username+":", ln.Line) 56 | } 57 | rl.Clean() 58 | done <- struct{}{} 59 | <-done 60 | } 61 | -------------------------------------------------------------------------------- /vendor/github.com/chzyer/readline/example/readline-multiline/readline-multiline.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "strings" 5 | 6 | "github.com/chzyer/readline" 7 | ) 8 | 9 | func main() { 10 | rl, err := readline.NewEx(&readline.Config{ 11 | Prompt: "> ", 12 | HistoryFile: "/tmp/readline-multiline", 13 | DisableAutoSaveHistory: true, 14 | }) 15 | if err != nil { 16 | panic(err) 17 | } 18 | defer rl.Close() 19 | 20 | var cmds []string 21 | for { 22 | line, err := rl.Readline() 23 | if err != nil { 24 | break 25 | } 26 | line = strings.TrimSpace(line) 27 | if len(line) == 0 { 28 | continue 29 | } 30 | cmds = append(cmds, line) 31 | if !strings.HasSuffix(line, ";") { 32 | rl.SetPrompt(">>> ") 33 | continue 34 | } 35 | cmd := strings.Join(cmds, " ") 36 | cmds = cmds[:0] 37 | rl.SetPrompt("> ") 38 | rl.SaveHistory(cmd) 39 | println(cmd) 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /vendor/github.com/chzyer/readline/example/readline-remote/readline-remote-client/client.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import "github.com/chzyer/readline" 4 | 5 | func main() { 6 | if err := readline.DialRemote("tcp", ":12344"); err != nil { 7 | println(err.Error()) 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /vendor/github.com/chzyer/readline/example/readline-remote/readline-remote-server/server.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | 6 | "github.com/chzyer/readline" 7 | ) 8 | 9 | func main() { 10 | cfg := &readline.Config{ 11 | Prompt: "readline-remote: ", 12 | } 13 | handleFunc := func(rl *readline.Instance) { 14 | for { 15 | line, err := rl.Readline() 16 | if err != nil { 17 | break 18 | } 19 | fmt.Fprintln(rl.Stdout(), "receive:"+line) 20 | } 21 | } 22 | err := readline.ListenRemote("tcp", ":12344", cfg, handleFunc) 23 | if err != nil { 24 | println(err.Error()) 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /vendor/github.com/chzyer/readline/password.go: -------------------------------------------------------------------------------- 1 | package readline 2 | 3 | type opPassword struct { 4 | o *Operation 5 | backupCfg *Config 6 | } 7 | 8 | func newOpPassword(o *Operation) *opPassword { 9 | return &opPassword{o: o} 10 | } 11 | 12 | func (o *opPassword) ExitPasswordMode() { 13 | o.o.SetConfig(o.backupCfg) 14 | o.backupCfg = nil 15 | } 16 | 17 | func (o *opPassword) EnterPasswordMode(cfg *Config) (err error) { 18 | o.backupCfg, err = o.o.SetConfig(cfg) 19 | return 20 | } 21 | 22 | func (o *opPassword) PasswordConfig() *Config { 23 | return &Config{ 24 | EnableMask: true, 25 | InterruptPrompt: "\n", 26 | EOFPrompt: "\n", 27 | HistoryLimit: -1, 28 | 29 | Stdout: o.o.cfg.Stdout, 30 | Stderr: o.o.cfg.Stderr, 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /vendor/github.com/chzyer/readline/runes/runes_test.go: -------------------------------------------------------------------------------- 1 | package runes 2 | 3 | import ( 4 | "reflect" 5 | "testing" 6 | ) 7 | 8 | type twidth struct { 9 | r []rune 10 | length int 11 | } 12 | 13 | func TestRuneWidth(t *testing.T) { 14 | runes := []twidth{ 15 | {[]rune("☭"), 1}, 16 | {[]rune("a"), 1}, 17 | {[]rune("你"), 2}, 18 | {ColorFilter([]rune("☭\033[13;1m你")), 3}, 19 | } 20 | for _, r := range runes { 21 | if w := WidthAll(r.r); w != r.length { 22 | t.Fatal("result not expect", r.r, r.length, w) 23 | } 24 | } 25 | } 26 | 27 | type tagg struct { 28 | r [][]rune 29 | e [][]rune 30 | length int 31 | } 32 | 33 | func TestAggRunes(t *testing.T) { 34 | runes := []tagg{ 35 | { 36 | [][]rune{[]rune("ab"), []rune("a"), []rune("abc")}, 37 | [][]rune{[]rune("b"), []rune(""), []rune("bc")}, 38 | 1, 39 | }, 40 | { 41 | [][]rune{[]rune("addb"), []rune("ajkajsdf"), []rune("aasdfkc")}, 42 | [][]rune{[]rune("ddb"), []rune("jkajsdf"), []rune("asdfkc")}, 43 | 1, 44 | }, 45 | { 46 | [][]rune{[]rune("ddb"), []rune("ajksdf"), []rune("aasdfkc")}, 47 | [][]rune{[]rune("ddb"), []rune("ajksdf"), []rune("aasdfkc")}, 48 | 0, 49 | }, 50 | { 51 | [][]rune{[]rune("ddb"), []rune("ddajksdf"), []rune("ddaasdfkc")}, 52 | [][]rune{[]rune("b"), []rune("ajksdf"), []rune("aasdfkc")}, 53 | 2, 54 | }, 55 | } 56 | for _, r := range runes { 57 | same, off := Aggregate(r.r) 58 | if off != r.length { 59 | t.Fatal("result not expect", off) 60 | } 61 | if len(same) != off { 62 | t.Fatal("result not expect", same) 63 | } 64 | if !reflect.DeepEqual(r.r, r.e) { 65 | t.Fatal("result not expect") 66 | } 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /vendor/github.com/chzyer/readline/runes_test.go: -------------------------------------------------------------------------------- 1 | package readline 2 | 3 | import ( 4 | "reflect" 5 | "testing" 6 | ) 7 | 8 | type twidth struct { 9 | r []rune 10 | length int 11 | } 12 | 13 | func TestRuneWidth(t *testing.T) { 14 | rs := []twidth{ 15 | {[]rune("☭"), 1}, 16 | {[]rune("a"), 1}, 17 | {[]rune("你"), 2}, 18 | {runes.ColorFilter([]rune("☭\033[13;1m你")), 3}, 19 | } 20 | for _, r := range rs { 21 | if w := runes.WidthAll(r.r); w != r.length { 22 | t.Fatal("result not expect", r.r, r.length, w) 23 | } 24 | } 25 | } 26 | 27 | type tagg struct { 28 | r [][]rune 29 | e [][]rune 30 | length int 31 | } 32 | 33 | func TestAggRunes(t *testing.T) { 34 | rs := []tagg{ 35 | { 36 | [][]rune{[]rune("ab"), []rune("a"), []rune("abc")}, 37 | [][]rune{[]rune("b"), []rune(""), []rune("bc")}, 38 | 1, 39 | }, 40 | { 41 | [][]rune{[]rune("addb"), []rune("ajkajsdf"), []rune("aasdfkc")}, 42 | [][]rune{[]rune("ddb"), []rune("jkajsdf"), []rune("asdfkc")}, 43 | 1, 44 | }, 45 | { 46 | [][]rune{[]rune("ddb"), []rune("ajksdf"), []rune("aasdfkc")}, 47 | [][]rune{[]rune("ddb"), []rune("ajksdf"), []rune("aasdfkc")}, 48 | 0, 49 | }, 50 | { 51 | [][]rune{[]rune("ddb"), []rune("ddajksdf"), []rune("ddaasdfkc")}, 52 | [][]rune{[]rune("b"), []rune("ajksdf"), []rune("aasdfkc")}, 53 | 2, 54 | }, 55 | } 56 | for _, r := range rs { 57 | same, off := runes.Aggregate(r.r) 58 | if off != r.length { 59 | t.Fatal("result not expect", off) 60 | } 61 | if len(same) != off { 62 | t.Fatal("result not expect", same) 63 | } 64 | if !reflect.DeepEqual(r.r, r.e) { 65 | t.Fatal("result not expect") 66 | } 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /vendor/github.com/chzyer/readline/std.go: -------------------------------------------------------------------------------- 1 | package readline 2 | 3 | import ( 4 | "io" 5 | "os" 6 | "sync" 7 | ) 8 | 9 | var ( 10 | Stdin io.ReadCloser = os.Stdin 11 | Stdout io.WriteCloser = os.Stdout 12 | Stderr io.WriteCloser = os.Stderr 13 | ) 14 | 15 | var ( 16 | std *Instance 17 | stdOnce sync.Once 18 | ) 19 | 20 | // global instance will not submit history automatic 21 | func getInstance() *Instance { 22 | stdOnce.Do(func() { 23 | std, _ = NewEx(&Config{ 24 | DisableAutoSaveHistory: true, 25 | }) 26 | }) 27 | return std 28 | } 29 | 30 | // let readline load history from filepath 31 | // and try to persist history into disk 32 | // set fp to "" to prevent readline persisting history to disk 33 | // so the `AddHistory` will return nil error forever. 34 | func SetHistoryPath(fp string) { 35 | ins := getInstance() 36 | cfg := ins.Config.Clone() 37 | cfg.HistoryFile = fp 38 | ins.SetConfig(cfg) 39 | } 40 | 41 | // set auto completer to global instance 42 | func SetAutoComplete(completer AutoCompleter) { 43 | ins := getInstance() 44 | cfg := ins.Config.Clone() 45 | cfg.AutoComplete = completer 46 | ins.SetConfig(cfg) 47 | } 48 | 49 | // add history to global instance manually 50 | // raise error only if `SetHistoryPath` is set with a non-empty path 51 | func AddHistory(content string) error { 52 | ins := getInstance() 53 | return ins.SaveHistory(content) 54 | } 55 | 56 | func Password(prompt string) ([]byte, error) { 57 | ins := getInstance() 58 | return ins.ReadPassword(prompt) 59 | } 60 | 61 | // readline with global configs 62 | func Line(prompt string) (string, error) { 63 | ins := getInstance() 64 | ins.SetPrompt(prompt) 65 | return ins.Readline() 66 | } 67 | -------------------------------------------------------------------------------- /vendor/github.com/chzyer/readline/std_windows.go: -------------------------------------------------------------------------------- 1 | // +build windows 2 | 3 | package readline 4 | 5 | func init() { 6 | Stdin = NewRawReader() 7 | Stdout = NewANSIWriter(Stdout) 8 | Stderr = NewANSIWriter(Stderr) 9 | } 10 | -------------------------------------------------------------------------------- /vendor/github.com/chzyer/readline/term_bsd.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build darwin dragonfly freebsd netbsd openbsd 6 | 7 | package readline 8 | 9 | import "syscall" 10 | 11 | const ioctlReadTermios = syscall.TIOCGETA 12 | const ioctlWriteTermios = syscall.TIOCSETA 13 | -------------------------------------------------------------------------------- /vendor/github.com/chzyer/readline/term_linux.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package readline 6 | 7 | // These constants are declared here, rather than importing 8 | // them from the syscall package as some syscall packages, even 9 | // on linux, for example gccgo, do not declare them. 10 | const ioctlReadTermios = 0x5401 // syscall.TCGETS 11 | const ioctlWriteTermios = 0x5402 // syscall.TCSETS 12 | -------------------------------------------------------------------------------- /vendor/github.com/chzyer/readline/utils_test.go: -------------------------------------------------------------------------------- 1 | package readline 2 | -------------------------------------------------------------------------------- /vendor/github.com/chzyer/readline/utils_windows.go: -------------------------------------------------------------------------------- 1 | // +build windows 2 | 3 | package readline 4 | 5 | import ( 6 | "io" 7 | "syscall" 8 | ) 9 | 10 | func SuspendMe() { 11 | } 12 | 13 | func GetStdin() int { 14 | return int(syscall.Stdin) 15 | } 16 | 17 | func init() { 18 | isWindows = true 19 | } 20 | 21 | // get width of the terminal 22 | func GetScreenWidth() int { 23 | info, _ := GetConsoleScreenBufferInfo() 24 | if info == nil { 25 | return -1 26 | } 27 | return int(info.dwSize.x) 28 | } 29 | 30 | // ClearScreen clears the console screen 31 | func ClearScreen(_ io.Writer) error { 32 | return SetConsoleCursorPosition(&_COORD{0, 0}) 33 | } 34 | 35 | func DefaultIsTerminal() bool { 36 | return true 37 | } 38 | 39 | func DefaultOnWidthChanged(func()) { 40 | 41 | } 42 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/.gitattributes: -------------------------------------------------------------------------------- 1 | # Treat all files in this repo as binary, with no git magic updating 2 | # line endings. Windows users contributing to Go will need to use a 3 | # modern version of git and editors capable of LF line endings. 4 | # 5 | # We'll prevent accidental CRLF line endings from entering the repo 6 | # via the git-review gofmt checks. 7 | # 8 | # See golang.org/issue/9281 9 | 10 | * -text 11 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/.gitignore: -------------------------------------------------------------------------------- 1 | # Add no patterns to .hgignore except for files generated by the build. 2 | last-change 3 | -------------------------------------------------------------------------------- /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/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing to Go 2 | 3 | Go is an open source project. 4 | 5 | It is the work of hundreds of contributors. We appreciate your help! 6 | 7 | 8 | ## Filing issues 9 | 10 | When [filing an issue](https://golang.org/issue/new), make sure to answer these five questions: 11 | 12 | 1. What version of Go are you using (`go version`)? 13 | 2. What operating system and processor architecture are you using? 14 | 3. What did you do? 15 | 4. What did you expect to see? 16 | 5. What did you see instead? 17 | 18 | General questions should go to the [golang-nuts mailing list](https://groups.google.com/group/golang-nuts) instead of the issue tracker. 19 | The gophers there will answer or ask you to file an issue if you've tripped over a bug. 20 | 21 | ## Contributing code 22 | 23 | Please read the [Contribution Guidelines](https://golang.org/doc/contribute.html) 24 | before sending patches. 25 | 26 | **We do not accept GitHub pull requests** 27 | (we use [Gerrit](https://code.google.com/p/gerrit/) instead for code review). 28 | 29 | Unless otherwise noted, the Go source files are distributed under 30 | the BSD-style license found in the LICENSE file. 31 | 32 | -------------------------------------------------------------------------------- /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/README.md: -------------------------------------------------------------------------------- 1 | # sys 2 | 3 | This repository holds supplemental Go packages for low-level interactions with 4 | the operating system. 5 | 6 | ## Download/Install 7 | 8 | The easiest way to install is to run `go get -u golang.org/x/sys`. You can 9 | also manually git clone the repository to `$GOPATH/src/golang.org/x/sys`. 10 | 11 | ## Report Issues / Send Patches 12 | 13 | This repository uses Gerrit for code changes. To learn how to submit changes to 14 | this repository, see https://golang.org/doc/contribute.html. 15 | 16 | The main issue tracker for the sys repository is located at 17 | https://github.com/golang/go/issues. Prefix your issue with "x/sys:" in the 18 | subject line, so it is easy to find. 19 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/codereview.cfg: -------------------------------------------------------------------------------- 1 | issuerepo: golang/go 2 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/plan9/asm.s: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | #include "textflag.h" 6 | 7 | TEXT ·use(SB),NOSPLIT,$0 8 | RET 9 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/plan9/asm_plan9_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 | #include "textflag.h" 6 | 7 | // 8 | // System call support for 386, Plan 9 9 | // 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-32 15 | JMP syscall·Syscall(SB) 16 | 17 | TEXT ·Syscall6(SB),NOSPLIT,$0-44 18 | JMP syscall·Syscall6(SB) 19 | 20 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28 21 | JMP syscall·RawSyscall(SB) 22 | 23 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 24 | JMP syscall·RawSyscall6(SB) 25 | 26 | TEXT ·seek(SB),NOSPLIT,$0-36 27 | JMP syscall·seek(SB) 28 | 29 | TEXT ·exit(SB),NOSPLIT,$4-4 30 | JMP syscall·exit(SB) 31 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/plan9/asm_plan9_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 | #include "textflag.h" 6 | 7 | // 8 | // System call support for amd64, Plan 9 9 | // 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-64 15 | JMP syscall·Syscall(SB) 16 | 17 | TEXT ·Syscall6(SB),NOSPLIT,$0-88 18 | JMP syscall·Syscall6(SB) 19 | 20 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 21 | JMP syscall·RawSyscall(SB) 22 | 23 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 24 | JMP syscall·RawSyscall6(SB) 25 | 26 | TEXT ·seek(SB),NOSPLIT,$0-56 27 | JMP syscall·seek(SB) 28 | 29 | TEXT ·exit(SB),NOSPLIT,$8-8 30 | JMP syscall·exit(SB) 31 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/plan9/const_plan9.go: -------------------------------------------------------------------------------- 1 | package plan9 2 | 3 | // Plan 9 Constants 4 | 5 | // Open modes 6 | const ( 7 | O_RDONLY = 0 8 | O_WRONLY = 1 9 | O_RDWR = 2 10 | O_TRUNC = 16 11 | O_CLOEXEC = 32 12 | O_EXCL = 0x1000 13 | ) 14 | 15 | // Rfork flags 16 | const ( 17 | RFNAMEG = 1 << 0 18 | RFENVG = 1 << 1 19 | RFFDG = 1 << 2 20 | RFNOTEG = 1 << 3 21 | RFPROC = 1 << 4 22 | RFMEM = 1 << 5 23 | RFNOWAIT = 1 << 6 24 | RFCNAMEG = 1 << 10 25 | RFCENVG = 1 << 11 26 | RFCFDG = 1 << 12 27 | RFREND = 1 << 13 28 | RFNOMNT = 1 << 14 29 | ) 30 | 31 | // Qid.Type bits 32 | const ( 33 | QTDIR = 0x80 34 | QTAPPEND = 0x40 35 | QTEXCL = 0x20 36 | QTMOUNT = 0x10 37 | QTAUTH = 0x08 38 | QTTMP = 0x04 39 | QTFILE = 0x00 40 | ) 41 | 42 | // Dir.Mode bits 43 | const ( 44 | DMDIR = 0x80000000 45 | DMAPPEND = 0x40000000 46 | DMEXCL = 0x20000000 47 | DMMOUNT = 0x10000000 48 | DMAUTH = 0x08000000 49 | DMTMP = 0x04000000 50 | DMREAD = 0x4 51 | DMWRITE = 0x2 52 | DMEXEC = 0x1 53 | ) 54 | 55 | const ( 56 | STATMAX = 65535 57 | ERRMAX = 128 58 | STATFIXLEN = 49 59 | ) 60 | 61 | // Mount and bind flags 62 | const ( 63 | MREPL = 0x0000 64 | MBEFORE = 0x0001 65 | MAFTER = 0x0002 66 | MORDER = 0x0003 67 | MCREATE = 0x0004 68 | MCACHE = 0x0010 69 | MMASK = 0x0017 70 | ) 71 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/plan9/env_plan9.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 | // Plan 9 environment variables. 6 | 7 | package plan9 8 | 9 | import ( 10 | "syscall" 11 | ) 12 | 13 | func Getenv(key string) (value string, found bool) { 14 | return syscall.Getenv(key) 15 | } 16 | 17 | func Setenv(key, value string) error { 18 | return syscall.Setenv(key, value) 19 | } 20 | 21 | func Clearenv() { 22 | syscall.Clearenv() 23 | } 24 | 25 | func Environ() []string { 26 | return syscall.Environ() 27 | } 28 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/plan9/env_unset.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build go1.4 6 | 7 | package plan9 8 | 9 | import "syscall" 10 | 11 | func Unsetenv(key string) error { 12 | // This was added in Go 1.4. 13 | return syscall.Unsetenv(key) 14 | } 15 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/plan9/mksysnum_plan9.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Copyright 2009 The Go Authors. All rights reserved. 3 | # Use of this source code is governed by a BSD-style 4 | # license that can be found in the LICENSE file. 5 | 6 | COMMAND="mksysnum_plan9.sh $@" 7 | 8 | cat <= 10 { 16 | buf[i] = byte(val%10 + '0') 17 | i-- 18 | val /= 10 19 | } 20 | buf[i] = byte(val + '0') 21 | return string(buf[i:]) 22 | } 23 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/plan9/syscall_test.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 plan9 6 | 7 | package plan9_test 8 | 9 | import ( 10 | "testing" 11 | 12 | "golang.org/x/sys/plan9" 13 | ) 14 | 15 | func testSetGetenv(t *testing.T, key, value string) { 16 | err := plan9.Setenv(key, value) 17 | if err != nil { 18 | t.Fatalf("Setenv failed to set %q: %v", value, err) 19 | } 20 | newvalue, found := plan9.Getenv(key) 21 | if !found { 22 | t.Fatalf("Getenv failed to find %v variable (want value %q)", key, value) 23 | } 24 | if newvalue != value { 25 | t.Fatalf("Getenv(%v) = %q; want %q", key, newvalue, value) 26 | } 27 | } 28 | 29 | func TestEnv(t *testing.T) { 30 | testSetGetenv(t, "TESTENV", "AVALUE") 31 | // make sure TESTENV gets set to "", not deleted 32 | testSetGetenv(t, "TESTENV", "") 33 | } 34 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/plan9/zsysnum_plan9.go: -------------------------------------------------------------------------------- 1 | // mksysnum_plan9.sh /opt/plan9/sys/src/libc/9syscall/sys.h 2 | // MACHINE GENERATED BY THE ABOVE COMMAND; DO NOT EDIT 3 | 4 | package plan9 5 | 6 | const ( 7 | SYS_SYSR1 = 0 8 | SYS_BIND = 2 9 | SYS_CHDIR = 3 10 | SYS_CLOSE = 4 11 | SYS_DUP = 5 12 | SYS_ALARM = 6 13 | SYS_EXEC = 7 14 | SYS_EXITS = 8 15 | SYS_FAUTH = 10 16 | SYS_SEGBRK = 12 17 | SYS_OPEN = 14 18 | SYS_OSEEK = 16 19 | SYS_SLEEP = 17 20 | SYS_RFORK = 19 21 | SYS_PIPE = 21 22 | SYS_CREATE = 22 23 | SYS_FD2PATH = 23 24 | SYS_BRK_ = 24 25 | SYS_REMOVE = 25 26 | SYS_NOTIFY = 28 27 | SYS_NOTED = 29 28 | SYS_SEGATTACH = 30 29 | SYS_SEGDETACH = 31 30 | SYS_SEGFREE = 32 31 | SYS_SEGFLUSH = 33 32 | SYS_RENDEZVOUS = 34 33 | SYS_UNMOUNT = 35 34 | SYS_SEMACQUIRE = 37 35 | SYS_SEMRELEASE = 38 36 | SYS_SEEK = 39 37 | SYS_FVERSION = 40 38 | SYS_ERRSTR = 41 39 | SYS_STAT = 42 40 | SYS_FSTAT = 43 41 | SYS_WSTAT = 44 42 | SYS_FWSTAT = 45 43 | SYS_MOUNT = 46 44 | SYS_AWAIT = 47 45 | SYS_PREAD = 50 46 | SYS_PWRITE = 51 47 | SYS_TSEMACQUIRE = 52 48 | SYS_NSEC = 53 49 | ) 50 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/.gitignore: -------------------------------------------------------------------------------- 1 | _obj/ 2 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_darwin_386.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for 386, Darwin 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-28 17 | JMP syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-40 20 | JMP syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-52 23 | JMP syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28 26 | JMP syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 29 | JMP syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_darwin_amd64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for AMD64, Darwin 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-56 17 | JMP syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 20 | JMP syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-104 23 | JMP syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 26 | JMP syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 29 | JMP syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_darwin_arm.s: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | // +build arm,darwin 7 | 8 | #include "textflag.h" 9 | 10 | // 11 | // System call support for ARM, Darwin 12 | // 13 | 14 | // Just jump to package syscall's implementation for all these functions. 15 | // The runtime may know about them. 16 | 17 | TEXT ·Syscall(SB),NOSPLIT,$0-28 18 | B syscall·Syscall(SB) 19 | 20 | TEXT ·Syscall6(SB),NOSPLIT,$0-40 21 | B syscall·Syscall6(SB) 22 | 23 | TEXT ·Syscall9(SB),NOSPLIT,$0-52 24 | B syscall·Syscall9(SB) 25 | 26 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28 27 | B syscall·RawSyscall(SB) 28 | 29 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 30 | B syscall·RawSyscall6(SB) 31 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_darwin_arm64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | // +build arm64,darwin 7 | 8 | #include "textflag.h" 9 | 10 | // 11 | // System call support for AMD64, Darwin 12 | // 13 | 14 | // Just jump to package syscall's implementation for all these functions. 15 | // The runtime may know about them. 16 | 17 | TEXT ·Syscall(SB),NOSPLIT,$0-56 18 | B syscall·Syscall(SB) 19 | 20 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 21 | B syscall·Syscall6(SB) 22 | 23 | TEXT ·Syscall9(SB),NOSPLIT,$0-104 24 | B syscall·Syscall9(SB) 25 | 26 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 27 | B syscall·RawSyscall(SB) 28 | 29 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 30 | B syscall·RawSyscall6(SB) 31 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_dragonfly_amd64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for AMD64, DragonFly 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-64 17 | JMP syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-88 20 | JMP syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-112 23 | JMP syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-64 26 | JMP syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-88 29 | JMP syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_freebsd_386.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for 386, FreeBSD 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-28 17 | JMP syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-40 20 | JMP syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-52 23 | JMP syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28 26 | JMP syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 29 | JMP syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_freebsd_amd64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for AMD64, FreeBSD 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-56 17 | JMP syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 20 | JMP syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-104 23 | JMP syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 26 | JMP syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 29 | JMP syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_freebsd_arm.s: -------------------------------------------------------------------------------- 1 | // Copyright 2012 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for ARM, FreeBSD 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-28 17 | B syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-40 20 | B syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-52 23 | B syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28 26 | B syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 29 | B syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_linux_386.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System calls for 386, Linux 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-28 17 | JMP syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-40 20 | JMP syscall·Syscall6(SB) 21 | 22 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28 23 | JMP syscall·RawSyscall(SB) 24 | 25 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 26 | JMP syscall·RawSyscall6(SB) 27 | 28 | TEXT ·socketcall(SB),NOSPLIT,$0-36 29 | JMP syscall·socketcall(SB) 30 | 31 | TEXT ·rawsocketcall(SB),NOSPLIT,$0-36 32 | JMP syscall·rawsocketcall(SB) 33 | 34 | TEXT ·seek(SB),NOSPLIT,$0-28 35 | JMP syscall·seek(SB) 36 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_linux_amd64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System calls for AMD64, Linux 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-56 17 | JMP syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 20 | JMP syscall·Syscall6(SB) 21 | 22 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 23 | JMP syscall·RawSyscall(SB) 24 | 25 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 26 | JMP syscall·RawSyscall6(SB) 27 | 28 | TEXT ·gettimeofday(SB),NOSPLIT,$0-16 29 | JMP syscall·gettimeofday(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_linux_arm.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System calls for arm, Linux 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-28 17 | B syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-40 20 | B syscall·Syscall6(SB) 21 | 22 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28 23 | B syscall·RawSyscall(SB) 24 | 25 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 26 | B syscall·RawSyscall6(SB) 27 | 28 | TEXT ·seek(SB),NOSPLIT,$0-32 29 | B syscall·seek(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_linux_arm64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build linux 6 | // +build arm64 7 | // +build !gccgo 8 | 9 | #include "textflag.h" 10 | 11 | // Just jump to package syscall's implementation for all these functions. 12 | // The runtime may know about them. 13 | 14 | TEXT ·Syscall(SB),NOSPLIT,$0-56 15 | B syscall·Syscall(SB) 16 | 17 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 18 | B syscall·Syscall6(SB) 19 | 20 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 21 | B syscall·RawSyscall(SB) 22 | 23 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 24 | B syscall·RawSyscall6(SB) 25 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_linux_mips64x.s: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build linux 6 | // +build mips64 mips64le 7 | // +build !gccgo 8 | 9 | #include "textflag.h" 10 | 11 | // 12 | // System calls for mips64, Linux 13 | // 14 | 15 | // Just jump to package syscall's implementation for all these functions. 16 | // The runtime may know about them. 17 | 18 | TEXT ·Syscall(SB),NOSPLIT,$0-56 19 | JMP syscall·Syscall(SB) 20 | 21 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 22 | JMP syscall·Syscall6(SB) 23 | 24 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 25 | JMP syscall·RawSyscall(SB) 26 | 27 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 28 | JMP syscall·RawSyscall6(SB) 29 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_linux_mipsx.s: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build linux 6 | // +build mips mipsle 7 | // +build !gccgo 8 | 9 | #include "textflag.h" 10 | 11 | // 12 | // System calls for mips, Linux 13 | // 14 | 15 | // Just jump to package syscall's implementation for all these functions. 16 | // The runtime may know about them. 17 | 18 | TEXT ·Syscall(SB),NOSPLIT,$0-28 19 | JMP syscall·Syscall(SB) 20 | 21 | TEXT ·Syscall6(SB),NOSPLIT,$0-40 22 | JMP syscall·Syscall6(SB) 23 | 24 | TEXT ·Syscall9(SB),NOSPLIT,$0-52 25 | JMP syscall·Syscall9(SB) 26 | 27 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28 28 | JMP syscall·RawSyscall(SB) 29 | 30 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 31 | JMP syscall·RawSyscall6(SB) 32 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_linux_ppc64x.s: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build linux 6 | // +build ppc64 ppc64le 7 | // +build !gccgo 8 | 9 | #include "textflag.h" 10 | 11 | // 12 | // System calls for ppc64, Linux 13 | // 14 | 15 | // Just jump to package syscall's implementation for all these functions. 16 | // The runtime may know about them. 17 | 18 | TEXT ·Syscall(SB),NOSPLIT,$0-56 19 | BR syscall·Syscall(SB) 20 | 21 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 22 | BR syscall·Syscall6(SB) 23 | 24 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 25 | BR syscall·RawSyscall(SB) 26 | 27 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 28 | BR syscall·RawSyscall6(SB) 29 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_linux_s390x.s: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build s390x 6 | // +build linux 7 | // +build !gccgo 8 | 9 | #include "textflag.h" 10 | 11 | // 12 | // System calls for s390x, Linux 13 | // 14 | 15 | // Just jump to package syscall's implementation for all these functions. 16 | // The runtime may know about them. 17 | 18 | TEXT ·Syscall(SB),NOSPLIT,$0-56 19 | BR syscall·Syscall(SB) 20 | 21 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 22 | BR syscall·Syscall6(SB) 23 | 24 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 25 | BR syscall·RawSyscall(SB) 26 | 27 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 28 | BR syscall·RawSyscall6(SB) 29 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_netbsd_386.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for 386, NetBSD 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-28 17 | JMP syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-40 20 | JMP syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-52 23 | JMP syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28 26 | JMP syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 29 | JMP syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_netbsd_amd64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for AMD64, NetBSD 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-56 17 | JMP syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 20 | JMP syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-104 23 | JMP syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 26 | JMP syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 29 | JMP syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_netbsd_arm.s: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for ARM, NetBSD 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-28 17 | B syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-40 20 | B syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-52 23 | B syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28 26 | B syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 29 | B syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_openbsd_386.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for 386, OpenBSD 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-28 17 | JMP syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-40 20 | JMP syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-52 23 | JMP syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28 26 | JMP syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 29 | JMP syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_openbsd_amd64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for AMD64, OpenBSD 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-56 17 | JMP syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 20 | JMP syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-104 23 | JMP syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 26 | JMP syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 29 | JMP syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_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_solaris_amd64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System calls for amd64, Solaris are implemented in runtime/syscall_solaris.go 11 | // 12 | 13 | TEXT ·sysvicall6(SB),NOSPLIT,$0-88 14 | JMP syscall·sysvicall6(SB) 15 | 16 | TEXT ·rawSysvicall6(SB),NOSPLIT,$0-88 17 | JMP syscall·rawSysvicall6(SB) 18 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/bluetooth_linux.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // Bluetooth sockets and messages 6 | 7 | package unix 8 | 9 | // Bluetooth Protocols 10 | const ( 11 | BTPROTO_L2CAP = 0 12 | BTPROTO_HCI = 1 13 | BTPROTO_SCO = 2 14 | BTPROTO_RFCOMM = 3 15 | BTPROTO_BNEP = 4 16 | BTPROTO_CMTP = 5 17 | BTPROTO_HIDP = 6 18 | BTPROTO_AVDTP = 7 19 | ) 20 | 21 | const ( 22 | HCI_CHANNEL_RAW = 0 23 | HCI_CHANNEL_USER = 1 24 | HCI_CHANNEL_MONITOR = 2 25 | HCI_CHANNEL_CONTROL = 3 26 | ) 27 | 28 | // Socketoption Level 29 | const ( 30 | SOL_BLUETOOTH = 0x112 31 | SOL_HCI = 0x0 32 | SOL_L2CAP = 0x6 33 | SOL_RFCOMM = 0x12 34 | SOL_SCO = 0x11 35 | ) 36 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/constants.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build darwin dragonfly freebsd linux netbsd openbsd solaris 6 | 7 | package unix 8 | 9 | const ( 10 | R_OK = 0x4 11 | W_OK = 0x2 12 | X_OK = 0x1 13 | ) 14 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/dev_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_darwin_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package unix_test 6 | 7 | import ( 8 | "fmt" 9 | "testing" 10 | 11 | "golang.org/x/sys/unix" 12 | ) 13 | 14 | func TestDevices(t *testing.T) { 15 | testCases := []struct { 16 | path string 17 | major uint32 18 | minor uint32 19 | }{ 20 | // Most of the device major/minor numbers on Darwin are 21 | // dynamically generated by devfs. These are some well-known 22 | // static numbers. 23 | {"/dev/ttyp0", 4, 0}, 24 | {"/dev/ttys0", 4, 48}, 25 | {"/dev/ptyp0", 5, 0}, 26 | {"/dev/ptyr0", 5, 32}, 27 | } 28 | for _, tc := range testCases { 29 | t.Run(fmt.Sprintf("%s %v:%v", tc.path, tc.major, tc.minor), func(t *testing.T) { 30 | var stat unix.Stat_t 31 | err := unix.Stat(tc.path, &stat) 32 | if err != nil { 33 | t.Errorf("failed to stat device: %v", err) 34 | return 35 | } 36 | 37 | dev := uint64(stat.Rdev) 38 | if unix.Major(dev) != tc.major { 39 | t.Errorf("for %s Major(%#x) == %d, want %d", tc.path, dev, unix.Major(dev), tc.major) 40 | } 41 | if unix.Minor(dev) != tc.minor { 42 | t.Errorf("for %s Minor(%#x) == %d, want %d", tc.path, dev, unix.Minor(dev), tc.minor) 43 | } 44 | if unix.Mkdev(tc.major, tc.minor) != dev { 45 | t.Errorf("for %s Mkdev(%d, %d) == %#x, want %#x", tc.path, tc.major, tc.minor, unix.Mkdev(tc.major, tc.minor), dev) 46 | } 47 | }) 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /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_dragonfly_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package unix_test 6 | 7 | import ( 8 | "fmt" 9 | "testing" 10 | 11 | "golang.org/x/sys/unix" 12 | ) 13 | 14 | func TestDevices(t *testing.T) { 15 | testCases := []struct { 16 | path string 17 | major uint32 18 | minor uint32 19 | }{ 20 | // Minor is a cookie instead of an index on DragonFlyBSD 21 | {"/dev/null", 10, 0x00000002}, 22 | {"/dev/random", 10, 0x00000003}, 23 | {"/dev/urandom", 10, 0x00000004}, 24 | {"/dev/zero", 10, 0x0000000c}, 25 | {"/dev/bpf", 15, 0xffff00ff}, 26 | } 27 | for _, tc := range testCases { 28 | t.Run(fmt.Sprintf("%s %v:%v", tc.path, tc.major, tc.minor), func(t *testing.T) { 29 | var stat unix.Stat_t 30 | err := unix.Stat(tc.path, &stat) 31 | if err != nil { 32 | t.Errorf("failed to stat device: %v", err) 33 | return 34 | } 35 | 36 | dev := uint64(stat.Rdev) 37 | if unix.Major(dev) != tc.major { 38 | t.Errorf("for %s Major(%#x) == %d, want %d", tc.path, dev, unix.Major(dev), tc.major) 39 | } 40 | if unix.Minor(dev) != tc.minor { 41 | t.Errorf("for %s Minor(%#x) == %d, want %d", tc.path, dev, unix.Minor(dev), tc.minor) 42 | } 43 | if unix.Mkdev(tc.major, tc.minor) != dev { 44 | t.Errorf("for %s Mkdev(%d, %d) == %#x, want %#x", tc.path, tc.major, tc.minor, unix.Mkdev(tc.major, tc.minor), dev) 45 | } 46 | }) 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /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_linux_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package unix_test 6 | 7 | import ( 8 | "fmt" 9 | "testing" 10 | 11 | "golang.org/x/sys/unix" 12 | ) 13 | 14 | func TestDevices(t *testing.T) { 15 | testCases := []struct { 16 | path string 17 | major uint32 18 | minor uint32 19 | }{ 20 | // well known major/minor numbers according to 21 | // https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/admin-guide/devices.txt 22 | {"/dev/null", 1, 3}, 23 | {"/dev/zero", 1, 5}, 24 | {"/dev/random", 1, 8}, 25 | {"/dev/full", 1, 7}, 26 | {"/dev/urandom", 1, 9}, 27 | {"/dev/tty", 5, 0}, 28 | } 29 | for _, tc := range testCases { 30 | t.Run(fmt.Sprintf("%s %v:%v", tc.path, tc.major, tc.minor), func(t *testing.T) { 31 | var stat unix.Stat_t 32 | err := unix.Stat(tc.path, &stat) 33 | if err != nil { 34 | t.Errorf("failed to stat device: %v", err) 35 | return 36 | } 37 | 38 | dev := uint64(stat.Rdev) 39 | if unix.Major(dev) != tc.major { 40 | t.Errorf("for %s Major(%#x) == %d, want %d", tc.path, dev, unix.Major(dev), tc.major) 41 | } 42 | if unix.Minor(dev) != tc.minor { 43 | t.Errorf("for %s Minor(%#x) == %d, want %d", tc.path, dev, unix.Minor(dev), tc.minor) 44 | } 45 | if unix.Mkdev(tc.major, tc.minor) != dev { 46 | t.Errorf("for %s Mkdev(%d, %d) == %#x, want %#x", tc.path, tc.major, tc.minor, unix.Mkdev(tc.major, tc.minor), dev) 47 | } 48 | }) 49 | 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /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_netbsd_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package unix_test 6 | 7 | import ( 8 | "fmt" 9 | "testing" 10 | 11 | "golang.org/x/sys/unix" 12 | ) 13 | 14 | func TestDevices(t *testing.T) { 15 | testCases := []struct { 16 | path string 17 | major uint32 18 | minor uint32 19 | }{ 20 | // well known major/minor numbers according to /dev/MAKEDEV on 21 | // NetBSD 7.0 22 | {"/dev/null", 2, 2}, 23 | {"/dev/zero", 2, 12}, 24 | {"/dev/ttyp0", 5, 0}, 25 | {"/dev/ttyp1", 5, 1}, 26 | {"/dev/random", 46, 0}, 27 | {"/dev/urandom", 46, 1}, 28 | } 29 | for _, tc := range testCases { 30 | t.Run(fmt.Sprintf("%s %v:%v", tc.path, tc.major, tc.minor), func(t *testing.T) { 31 | var stat unix.Stat_t 32 | err := unix.Stat(tc.path, &stat) 33 | if err != nil { 34 | t.Errorf("failed to stat device: %v", err) 35 | return 36 | } 37 | 38 | dev := uint64(stat.Rdev) 39 | if unix.Major(dev) != tc.major { 40 | t.Errorf("for %s Major(%#x) == %d, want %d", tc.path, dev, unix.Major(dev), tc.major) 41 | } 42 | if unix.Minor(dev) != tc.minor { 43 | t.Errorf("for %s Minor(%#x) == %d, want %d", tc.path, dev, unix.Minor(dev), tc.minor) 44 | } 45 | if unix.Mkdev(tc.major, tc.minor) != dev { 46 | t.Errorf("for %s Mkdev(%d, %d) == %#x, want %#x", tc.path, tc.major, tc.minor, unix.Mkdev(tc.major, tc.minor), dev) 47 | } 48 | }) 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /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/dev_openbsd_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package unix_test 6 | 7 | import ( 8 | "fmt" 9 | "testing" 10 | 11 | "golang.org/x/sys/unix" 12 | ) 13 | 14 | func TestDevices(t *testing.T) { 15 | testCases := []struct { 16 | path string 17 | major uint32 18 | minor uint32 19 | }{ 20 | // well known major/minor numbers according to /dev/MAKEDEV on 21 | // OpenBSD 6.0 22 | {"/dev/null", 2, 2}, 23 | {"/dev/zero", 2, 12}, 24 | {"/dev/ttyp0", 5, 0}, 25 | {"/dev/ttyp1", 5, 1}, 26 | {"/dev/random", 45, 0}, 27 | {"/dev/srandom", 45, 1}, 28 | {"/dev/urandom", 45, 2}, 29 | {"/dev/arandom", 45, 3}, 30 | } 31 | for _, tc := range testCases { 32 | t.Run(fmt.Sprintf("%s %v:%v", tc.path, tc.major, tc.minor), func(t *testing.T) { 33 | var stat unix.Stat_t 34 | err := unix.Stat(tc.path, &stat) 35 | if err != nil { 36 | t.Errorf("failed to stat device: %v", err) 37 | return 38 | } 39 | 40 | dev := uint64(stat.Rdev) 41 | if unix.Major(dev) != tc.major { 42 | t.Errorf("for %s Major(%#x) == %d, want %d", tc.path, dev, unix.Major(dev), tc.major) 43 | } 44 | if unix.Minor(dev) != tc.minor { 45 | t.Errorf("for %s Minor(%#x) == %d, want %d", tc.path, dev, unix.Minor(dev), tc.minor) 46 | } 47 | if unix.Mkdev(tc.major, tc.minor) != dev { 48 | t.Errorf("for %s Mkdev(%d, %d) == %#x, want %#x", tc.path, tc.major, tc.minor, unix.Mkdev(tc.major, tc.minor), dev) 49 | } 50 | }) 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/dev_solaris_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package unix_test 6 | 7 | import ( 8 | "fmt" 9 | "testing" 10 | 11 | "golang.org/x/sys/unix" 12 | ) 13 | 14 | func TestDevices(t *testing.T) { 15 | testCases := []struct { 16 | path string 17 | major uint32 18 | minor uint32 19 | }{ 20 | // Well-known major/minor numbers on OpenSolaris according to 21 | // /etc/name_to_major 22 | {"/dev/zero", 134, 12}, 23 | {"/dev/null", 134, 2}, 24 | {"/dev/ptyp0", 172, 0}, 25 | {"/dev/ttyp0", 175, 0}, 26 | {"/dev/ttyp1", 175, 1}, 27 | } 28 | for _, tc := range testCases { 29 | t.Run(fmt.Sprintf("%s %v:%v", tc.path, tc.major, tc.minor), func(t *testing.T) { 30 | var stat unix.Stat_t 31 | err := unix.Stat(tc.path, &stat) 32 | if err != nil { 33 | t.Errorf("failed to stat device: %v", err) 34 | return 35 | } 36 | 37 | dev := uint64(stat.Rdev) 38 | if unix.Major(dev) != tc.major { 39 | t.Errorf("for %s Major(%#x) == %d, want %d", tc.path, dev, unix.Major(dev), tc.major) 40 | } 41 | if unix.Minor(dev) != tc.minor { 42 | t.Errorf("for %s Minor(%#x) == %d, want %d", tc.path, dev, unix.Minor(dev), tc.minor) 43 | } 44 | if unix.Mkdev(tc.major, tc.minor) != dev { 45 | t.Errorf("for %s Mkdev(%d, %d) == %#x, want %#x", tc.path, tc.major, tc.minor, unix.Mkdev(tc.major, tc.minor), dev) 46 | } 47 | }) 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/endian_big.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | // 5 | // +build ppc64 s390x mips mips64 6 | 7 | package unix 8 | 9 | const isBigEndian = true 10 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/endian_little.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | // 5 | // +build 386 amd64 amd64p32 arm arm64 ppc64le mipsle mips64le 6 | 7 | package unix 8 | 9 | const isBigEndian = false 10 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/env_unix.go: -------------------------------------------------------------------------------- 1 | // Copyright 2010 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build darwin dragonfly freebsd linux netbsd openbsd solaris 6 | 7 | // Unix environment variables. 8 | 9 | package unix 10 | 11 | import "syscall" 12 | 13 | func Getenv(key string) (value string, found bool) { 14 | return syscall.Getenv(key) 15 | } 16 | 17 | func Setenv(key, value string) error { 18 | return syscall.Setenv(key, value) 19 | } 20 | 21 | func Clearenv() { 22 | syscall.Clearenv() 23 | } 24 | 25 | func Environ() []string { 26 | return syscall.Environ() 27 | } 28 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/env_unset.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build go1.4 6 | 7 | package unix 8 | 9 | import "syscall" 10 | 11 | func Unsetenv(key string) error { 12 | // This was added in Go 1.4. 13 | return syscall.Unsetenv(key) 14 | } 15 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/export_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build darwin dragonfly freebsd linux netbsd openbsd solaris 6 | 7 | package unix 8 | 9 | var Itoa = itoa 10 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/file_unix.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package unix 6 | 7 | import ( 8 | "os" 9 | "syscall" 10 | ) 11 | 12 | // FIXME: unexported function from os 13 | // syscallMode returns the syscall-specific mode bits from Go's portable mode bits. 14 | func syscallMode(i os.FileMode) (o uint32) { 15 | o |= uint32(i.Perm()) 16 | if i&os.ModeSetuid != 0 { 17 | o |= syscall.S_ISUID 18 | } 19 | if i&os.ModeSetgid != 0 { 20 | o |= syscall.S_ISGID 21 | } 22 | if i&os.ModeSticky != 0 { 23 | o |= syscall.S_ISVTX 24 | } 25 | // No mapping for Go's ModeTemporary (plan9 only). 26 | return 27 | } 28 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/flock.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build darwin dragonfly freebsd linux netbsd openbsd 6 | 7 | package unix 8 | 9 | import "unsafe" 10 | 11 | // fcntl64Syscall is usually SYS_FCNTL, but is overridden on 32-bit Linux 12 | // systems by flock_linux_32bit.go to be SYS_FCNTL64. 13 | var fcntl64Syscall uintptr = SYS_FCNTL 14 | 15 | // FcntlFlock performs a fcntl syscall for the F_GETLK, F_SETLK or F_SETLKW command. 16 | func FcntlFlock(fd uintptr, cmd int, lk *Flock_t) error { 17 | _, _, errno := Syscall(fcntl64Syscall, fd, uintptr(cmd), uintptr(unsafe.Pointer(lk))) 18 | if errno == 0 { 19 | return nil 20 | } 21 | return errno 22 | } 23 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/flock_linux_32bit.go: -------------------------------------------------------------------------------- 1 | // +build linux,386 linux,arm linux,mips linux,mipsle 2 | 3 | // Copyright 2014 The Go Authors. All rights reserved. 4 | // Use of this source code is governed by a BSD-style 5 | // license that can be found in the LICENSE file. 6 | 7 | package unix 8 | 9 | func init() { 10 | // On 32-bit Linux systems, the fcntl syscall that matches Go's 11 | // Flock_t type is SYS_FCNTL64, not SYS_FCNTL. 12 | fcntl64Syscall = SYS_FCNTL64 13 | } 14 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/gccgo.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build gccgo 6 | 7 | package unix 8 | 9 | import "syscall" 10 | 11 | // We can't use the gc-syntax .s files for gccgo. On the plus side 12 | // much of the functionality can be written directly in Go. 13 | 14 | //extern gccgoRealSyscall 15 | func realSyscall(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r, errno uintptr) 16 | 17 | func Syscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.Errno) { 18 | syscall.Entersyscall() 19 | r, errno := realSyscall(trap, a1, a2, a3, 0, 0, 0, 0, 0, 0) 20 | syscall.Exitsyscall() 21 | return r, 0, syscall.Errno(errno) 22 | } 23 | 24 | func Syscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err syscall.Errno) { 25 | syscall.Entersyscall() 26 | r, errno := realSyscall(trap, a1, a2, a3, a4, a5, a6, 0, 0, 0) 27 | syscall.Exitsyscall() 28 | return r, 0, syscall.Errno(errno) 29 | } 30 | 31 | func Syscall9(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) { 32 | syscall.Entersyscall() 33 | r, errno := realSyscall(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9) 34 | syscall.Exitsyscall() 35 | return r, 0, syscall.Errno(errno) 36 | } 37 | 38 | func RawSyscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.Errno) { 39 | r, errno := realSyscall(trap, a1, a2, a3, 0, 0, 0, 0, 0, 0) 40 | return r, 0, syscall.Errno(errno) 41 | } 42 | 43 | func RawSyscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err syscall.Errno) { 44 | r, errno := realSyscall(trap, a1, a2, a3, a4, a5, a6, 0, 0, 0) 45 | return r, 0, syscall.Errno(errno) 46 | } 47 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/gccgo_c.c: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build gccgo 6 | 7 | #include 8 | #include 9 | #include 10 | 11 | #define _STRINGIFY2_(x) #x 12 | #define _STRINGIFY_(x) _STRINGIFY2_(x) 13 | #define GOSYM_PREFIX _STRINGIFY_(__USER_LABEL_PREFIX__) 14 | 15 | // Call syscall from C code because the gccgo support for calling from 16 | // Go to C does not support varargs functions. 17 | 18 | struct ret { 19 | uintptr_t r; 20 | uintptr_t err; 21 | }; 22 | 23 | struct ret 24 | gccgoRealSyscall(uintptr_t trap, uintptr_t a1, uintptr_t a2, uintptr_t a3, uintptr_t a4, uintptr_t a5, uintptr_t a6, uintptr_t a7, uintptr_t a8, uintptr_t a9) 25 | { 26 | struct ret r; 27 | 28 | errno = 0; 29 | r.r = syscall(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9); 30 | r.err = errno; 31 | return r; 32 | } 33 | 34 | // Define the use function in C so that it is not inlined. 35 | 36 | extern void use(void *) __asm__ (GOSYM_PREFIX GOPKGPATH ".use") __attribute__((noinline)); 37 | 38 | void 39 | use(void *p __attribute__ ((unused))) 40 | { 41 | } 42 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/gccgo_linux_amd64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build gccgo,linux,amd64 6 | 7 | package unix 8 | 9 | import "syscall" 10 | 11 | //extern gettimeofday 12 | func realGettimeofday(*Timeval, *byte) int32 13 | 14 | func gettimeofday(tv *Timeval) (err syscall.Errno) { 15 | r := realGettimeofday(tv, nil) 16 | if r < 0 { 17 | return syscall.GetErrno() 18 | } 19 | return 0 20 | } 21 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/mksysnum_darwin.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | # Copyright 2009 The Go Authors. All rights reserved. 3 | # Use of this source code is governed by a BSD-style 4 | # license that can be found in the LICENSE file. 5 | # 6 | # Generate system call table for Darwin from sys/syscall.h 7 | 8 | use strict; 9 | 10 | if($ENV{'GOARCH'} eq "" || $ENV{'GOOS'} eq "") { 11 | print STDERR "GOARCH or GOOS not defined in environment\n"; 12 | exit 1; 13 | } 14 | 15 | my $command = "mksysnum_darwin.pl " . join(' ', @ARGV); 16 | 17 | print <){ 29 | if(/^#define\s+SYS_(\w+)\s+([0-9]+)/){ 30 | my $name = $1; 31 | my $num = $2; 32 | $name =~ y/a-z/A-Z/; 33 | print " SYS_$name = $num;" 34 | } 35 | } 36 | 37 | print <){ 30 | if(/^([0-9]+)\s+STD\s+({ \S+\s+(\w+).*)$/){ 31 | my $num = $1; 32 | my $proto = $2; 33 | my $name = "SYS_$3"; 34 | $name =~ y/a-z/A-Z/; 35 | 36 | # There are multiple entries for enosys and nosys, so comment them out. 37 | if($name =~ /^SYS_E?NOSYS$/){ 38 | $name = "// $name"; 39 | } 40 | if($name eq 'SYS_SYS_EXIT'){ 41 | $name = 'SYS_EXIT'; 42 | } 43 | 44 | print " $name = $num; // $proto\n"; 45 | } 46 | } 47 | 48 | print <){ 30 | if(/^([0-9]+)\s+\S+\s+STD\s+({ \S+\s+(\w+).*)$/){ 31 | my $num = $1; 32 | my $proto = $2; 33 | my $name = "SYS_$3"; 34 | $name =~ y/a-z/A-Z/; 35 | 36 | # There are multiple entries for enosys and nosys, so comment them out. 37 | if($name =~ /^SYS_E?NOSYS$/){ 38 | $name = "// $name"; 39 | } 40 | if($name eq 'SYS_SYS_EXIT'){ 41 | $name = 'SYS_EXIT'; 42 | } 43 | 44 | print " $name = $num; // $proto\n"; 45 | } 46 | } 47 | 48 | print <){ 31 | if($line =~ /^(.*)\\$/) { 32 | # Handle continuation 33 | $line = $1; 34 | $_ =~ s/^\s+//; 35 | $line .= $_; 36 | } else { 37 | # New line 38 | $line = $_; 39 | } 40 | next if $line =~ /\\$/; 41 | if($line =~ /^([0-9]+)\s+((STD)|(NOERR))\s+(RUMP\s+)?({\s+\S+\s*\*?\s*\|(\S+)\|(\S*)\|(\w+).*\s+})(\s+(\S+))?$/) { 42 | my $num = $1; 43 | my $proto = $6; 44 | my $compat = $8; 45 | my $name = "$7_$9"; 46 | 47 | $name = "$7_$11" if $11 ne ''; 48 | $name =~ y/a-z/A-Z/; 49 | 50 | if($compat eq '' || $compat eq '13' || $compat eq '30' || $compat eq '50') { 51 | print " $name = $num; // $proto\n"; 52 | } 53 | } 54 | } 55 | 56 | print <){ 30 | if(/^([0-9]+)\s+STD\s+(NOLOCK\s+)?({ \S+\s+\*?(\w+).*)$/){ 31 | my $num = $1; 32 | my $proto = $3; 33 | my $name = $4; 34 | $name =~ y/a-z/A-Z/; 35 | 36 | # There are multiple entries for enosys and nosys, so comment them out. 37 | if($name =~ /^SYS_E?NOSYS$/){ 38 | $name = "// $name"; 39 | } 40 | if($name eq 'SYS_SYS_EXIT'){ 41 | $name = 'SYS_EXIT'; 42 | } 43 | 44 | print " $name = $num; // $proto\n"; 45 | } 46 | } 47 | 48 | print <= 10 { 20 | buf[i] = byte(val%10 + '0') 21 | i-- 22 | val /= 10 23 | } 24 | buf[i] = byte(val + '0') 25 | return string(buf[i:]) 26 | } 27 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_bsd_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build darwin dragonfly freebsd openbsd 6 | 7 | package unix_test 8 | 9 | import ( 10 | "os/exec" 11 | "runtime" 12 | "testing" 13 | 14 | "golang.org/x/sys/unix" 15 | ) 16 | 17 | const MNT_WAIT = 1 18 | const MNT_NOWAIT = 2 19 | 20 | func TestGetfsstat(t *testing.T) { 21 | const flags = MNT_NOWAIT // see golang.org/issue/16937 22 | n, err := unix.Getfsstat(nil, flags) 23 | if err != nil { 24 | t.Fatal(err) 25 | } 26 | 27 | data := make([]unix.Statfs_t, n) 28 | n2, err := unix.Getfsstat(data, flags) 29 | if err != nil { 30 | t.Fatal(err) 31 | } 32 | if n != n2 { 33 | t.Errorf("Getfsstat(nil) = %d, but subsequent Getfsstat(slice) = %d", n, n2) 34 | } 35 | for i, stat := range data { 36 | if stat == (unix.Statfs_t{}) { 37 | t.Errorf("index %v is an empty Statfs_t struct", i) 38 | } 39 | } 40 | if t.Failed() { 41 | for i, stat := range data[:n2] { 42 | t.Logf("data[%v] = %+v", i, stat) 43 | } 44 | mount, err := exec.Command("mount").CombinedOutput() 45 | if err != nil { 46 | t.Logf("mount: %v\n%s", err, mount) 47 | } else { 48 | t.Logf("mount: %s", mount) 49 | } 50 | } 51 | } 52 | 53 | func TestSysctlRaw(t *testing.T) { 54 | if runtime.GOOS == "openbsd" { 55 | t.Skip("kern.proc.pid does not exist on OpenBSD") 56 | } 57 | 58 | _, err := unix.SysctlRaw("kern.proc.pid", unix.Getpid()) 59 | if err != nil { 60 | t.Fatal(err) 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /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 TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) } 15 | 16 | func NsecToTimespec(nsec int64) (ts Timespec) { 17 | ts.Sec = nsec / 1e9 18 | ts.Nsec = nsec % 1e9 19 | return 20 | } 21 | 22 | func NsecToTimeval(nsec int64) (tv Timeval) { 23 | nsec += 999 // round up to microsecond 24 | tv.Usec = nsec % 1e9 / 1e3 25 | tv.Sec = int64(nsec / 1e9) 26 | return 27 | } 28 | 29 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 30 | k.Ident = uint64(fd) 31 | k.Filter = int16(mode) 32 | k.Flags = uint16(flags) 33 | } 34 | 35 | func (iov *Iovec) SetLen(length int) { 36 | iov.Len = uint64(length) 37 | } 38 | 39 | func (msghdr *Msghdr) SetControllen(length int) { 40 | msghdr.Controllen = uint32(length) 41 | } 42 | 43 | func (cmsg *Cmsghdr) SetLen(length int) { 44 | cmsg.Len = uint32(length) 45 | } 46 | 47 | func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) { 48 | var writtenOut uint64 = 0 49 | _, _, e1 := Syscall9(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr(count), 0, uintptr(unsafe.Pointer(&writtenOut)), 0, 0, 0) 50 | 51 | written = int(writtenOut) 52 | 53 | if e1 != 0 { 54 | err = e1 55 | } 56 | return 57 | } 58 | 59 | func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) 60 | -------------------------------------------------------------------------------- /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 TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) } 15 | 16 | func NsecToTimespec(nsec int64) (ts Timespec) { 17 | ts.Sec = int32(nsec / 1e9) 18 | ts.Nsec = int32(nsec % 1e9) 19 | return 20 | } 21 | 22 | func NsecToTimeval(nsec int64) (tv Timeval) { 23 | nsec += 999 // round up to microsecond 24 | tv.Usec = int32(nsec % 1e9 / 1e3) 25 | tv.Sec = int32(nsec / 1e9) 26 | return 27 | } 28 | 29 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 30 | k.Ident = uint32(fd) 31 | k.Filter = int16(mode) 32 | k.Flags = uint16(flags) 33 | } 34 | 35 | func (iov *Iovec) SetLen(length int) { 36 | iov.Len = uint32(length) 37 | } 38 | 39 | func (msghdr *Msghdr) SetControllen(length int) { 40 | msghdr.Controllen = uint32(length) 41 | } 42 | 43 | func (cmsg *Cmsghdr) SetLen(length int) { 44 | cmsg.Len = uint32(length) 45 | } 46 | 47 | func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) { 48 | var writtenOut uint64 = 0 49 | _, _, e1 := Syscall9(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr((*offset)>>32), uintptr(count), 0, uintptr(unsafe.Pointer(&writtenOut)), 0, 0) 50 | 51 | written = int(writtenOut) 52 | 53 | if e1 != 0 { 54 | err = e1 55 | } 56 | return 57 | } 58 | 59 | func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) 60 | -------------------------------------------------------------------------------- /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 TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) } 15 | 16 | func NsecToTimespec(nsec int64) (ts Timespec) { 17 | ts.Sec = nsec / 1e9 18 | ts.Nsec = nsec % 1e9 19 | return 20 | } 21 | 22 | func NsecToTimeval(nsec int64) (tv Timeval) { 23 | nsec += 999 // round up to microsecond 24 | tv.Usec = nsec % 1e9 / 1e3 25 | tv.Sec = int64(nsec / 1e9) 26 | return 27 | } 28 | 29 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 30 | k.Ident = uint64(fd) 31 | k.Filter = int16(mode) 32 | k.Flags = uint16(flags) 33 | } 34 | 35 | func (iov *Iovec) SetLen(length int) { 36 | iov.Len = uint64(length) 37 | } 38 | 39 | func (msghdr *Msghdr) SetControllen(length int) { 40 | msghdr.Controllen = uint32(length) 41 | } 42 | 43 | func (cmsg *Cmsghdr) SetLen(length int) { 44 | cmsg.Len = uint32(length) 45 | } 46 | 47 | func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) { 48 | var writtenOut uint64 = 0 49 | _, _, e1 := Syscall9(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr(count), 0, uintptr(unsafe.Pointer(&writtenOut)), 0, 0, 0) 50 | 51 | written = int(writtenOut) 52 | 53 | if e1 != 0 { 54 | err = e1 55 | } 56 | return 57 | } 58 | 59 | func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) 60 | -------------------------------------------------------------------------------- /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 TimespecToNsec(ts Timespec) int64 { return ts.Sec*1e9 + int64(ts.Nsec) } 15 | 16 | func NsecToTimespec(nsec int64) (ts Timespec) { 17 | ts.Sec = nsec / 1e9 18 | ts.Nsec = int32(nsec % 1e9) 19 | return 20 | } 21 | 22 | func NsecToTimeval(nsec int64) (tv Timeval) { 23 | nsec += 999 // round up to microsecond 24 | tv.Usec = int32(nsec % 1e9 / 1e3) 25 | tv.Sec = nsec / 1e9 26 | return 27 | } 28 | 29 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 30 | k.Ident = uint32(fd) 31 | k.Filter = int16(mode) 32 | k.Flags = uint16(flags) 33 | } 34 | 35 | func (iov *Iovec) SetLen(length int) { 36 | iov.Len = uint32(length) 37 | } 38 | 39 | func (msghdr *Msghdr) SetControllen(length int) { 40 | msghdr.Controllen = uint32(length) 41 | } 42 | 43 | func (cmsg *Cmsghdr) SetLen(length int) { 44 | cmsg.Len = uint32(length) 45 | } 46 | 47 | func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) { 48 | var writtenOut uint64 = 0 49 | _, _, e1 := Syscall9(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr((*offset)>>32), uintptr(count), 0, uintptr(unsafe.Pointer(&writtenOut)), 0, 0) 50 | 51 | written = int(writtenOut) 52 | 53 | if e1 != 0 { 54 | err = e1 55 | } 56 | return 57 | } 58 | 59 | func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) 60 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_linux_amd64_gc.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build amd64,linux 6 | // +build !gccgo 7 | 8 | package unix 9 | 10 | import "syscall" 11 | 12 | //go:noescape 13 | func gettimeofday(tv *Timeval) (err syscall.Errno) 14 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_netbsd_386.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build 386,netbsd 6 | 7 | package unix 8 | 9 | func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) } 10 | 11 | func NsecToTimespec(nsec int64) (ts Timespec) { 12 | ts.Sec = int64(nsec / 1e9) 13 | ts.Nsec = int32(nsec % 1e9) 14 | return 15 | } 16 | 17 | func NsecToTimeval(nsec int64) (tv Timeval) { 18 | nsec += 999 // round up to microsecond 19 | tv.Usec = int32(nsec % 1e9 / 1e3) 20 | tv.Sec = int64(nsec / 1e9) 21 | return 22 | } 23 | 24 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 25 | k.Ident = uint32(fd) 26 | k.Filter = uint32(mode) 27 | k.Flags = uint32(flags) 28 | } 29 | 30 | func (iov *Iovec) SetLen(length int) { 31 | iov.Len = uint32(length) 32 | } 33 | 34 | func (msghdr *Msghdr) SetControllen(length int) { 35 | msghdr.Controllen = uint32(length) 36 | } 37 | 38 | func (cmsg *Cmsghdr) SetLen(length int) { 39 | cmsg.Len = uint32(length) 40 | } 41 | -------------------------------------------------------------------------------- /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 TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) } 10 | 11 | func NsecToTimespec(nsec int64) (ts Timespec) { 12 | ts.Sec = int64(nsec / 1e9) 13 | ts.Nsec = int64(nsec % 1e9) 14 | return 15 | } 16 | 17 | func NsecToTimeval(nsec int64) (tv Timeval) { 18 | nsec += 999 // round up to microsecond 19 | tv.Usec = int32(nsec % 1e9 / 1e3) 20 | tv.Sec = int64(nsec / 1e9) 21 | return 22 | } 23 | 24 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 25 | k.Ident = uint64(fd) 26 | k.Filter = uint32(mode) 27 | k.Flags = uint32(flags) 28 | } 29 | 30 | func (iov *Iovec) SetLen(length int) { 31 | iov.Len = uint64(length) 32 | } 33 | 34 | func (msghdr *Msghdr) SetControllen(length int) { 35 | msghdr.Controllen = uint32(length) 36 | } 37 | 38 | func (cmsg *Cmsghdr) SetLen(length int) { 39 | cmsg.Len = uint32(length) 40 | } 41 | -------------------------------------------------------------------------------- /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 TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) } 10 | 11 | func NsecToTimespec(nsec int64) (ts Timespec) { 12 | ts.Sec = int64(nsec / 1e9) 13 | ts.Nsec = int32(nsec % 1e9) 14 | return 15 | } 16 | 17 | func NsecToTimeval(nsec int64) (tv Timeval) { 18 | nsec += 999 // round up to microsecond 19 | tv.Usec = int32(nsec % 1e9 / 1e3) 20 | tv.Sec = int64(nsec / 1e9) 21 | return 22 | } 23 | 24 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 25 | k.Ident = uint32(fd) 26 | k.Filter = uint32(mode) 27 | k.Flags = uint32(flags) 28 | } 29 | 30 | func (iov *Iovec) SetLen(length int) { 31 | iov.Len = uint32(length) 32 | } 33 | 34 | func (msghdr *Msghdr) SetControllen(length int) { 35 | msghdr.Controllen = uint32(length) 36 | } 37 | 38 | func (cmsg *Cmsghdr) SetLen(length int) { 39 | cmsg.Len = uint32(length) 40 | } 41 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_no_getwd.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build dragonfly freebsd netbsd openbsd 6 | 7 | package unix 8 | 9 | const ImplementsGetwd = false 10 | 11 | func Getwd() (string, error) { return "", ENOTSUP } 12 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_openbsd_386.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build 386,openbsd 6 | 7 | package unix 8 | 9 | func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) } 10 | 11 | func NsecToTimespec(nsec int64) (ts Timespec) { 12 | ts.Sec = int64(nsec / 1e9) 13 | ts.Nsec = int32(nsec % 1e9) 14 | return 15 | } 16 | 17 | func NsecToTimeval(nsec int64) (tv Timeval) { 18 | nsec += 999 // round up to microsecond 19 | tv.Usec = int32(nsec % 1e9 / 1e3) 20 | tv.Sec = int64(nsec / 1e9) 21 | return 22 | } 23 | 24 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 25 | k.Ident = uint32(fd) 26 | k.Filter = int16(mode) 27 | k.Flags = uint16(flags) 28 | } 29 | 30 | func (iov *Iovec) SetLen(length int) { 31 | iov.Len = uint32(length) 32 | } 33 | 34 | func (msghdr *Msghdr) SetControllen(length int) { 35 | msghdr.Controllen = uint32(length) 36 | } 37 | 38 | func (cmsg *Cmsghdr) SetLen(length int) { 39 | cmsg.Len = uint32(length) 40 | } 41 | -------------------------------------------------------------------------------- /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 TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) } 10 | 11 | func NsecToTimespec(nsec int64) (ts Timespec) { 12 | ts.Sec = nsec / 1e9 13 | ts.Nsec = nsec % 1e9 14 | return 15 | } 16 | 17 | func NsecToTimeval(nsec int64) (tv Timeval) { 18 | nsec += 999 // round up to microsecond 19 | tv.Usec = nsec % 1e9 / 1e3 20 | tv.Sec = nsec / 1e9 21 | return 22 | } 23 | 24 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 25 | k.Ident = uint64(fd) 26 | k.Filter = int16(mode) 27 | k.Flags = uint16(flags) 28 | } 29 | 30 | func (iov *Iovec) SetLen(length int) { 31 | iov.Len = uint64(length) 32 | } 33 | 34 | func (msghdr *Msghdr) SetControllen(length int) { 35 | msghdr.Controllen = uint32(length) 36 | } 37 | 38 | func (cmsg *Cmsghdr) SetLen(length int) { 39 | cmsg.Len = uint32(length) 40 | } 41 | -------------------------------------------------------------------------------- /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 TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) } 10 | 11 | func NsecToTimespec(nsec int64) (ts Timespec) { 12 | ts.Sec = int64(nsec / 1e9) 13 | ts.Nsec = int32(nsec % 1e9) 14 | return 15 | } 16 | 17 | func NsecToTimeval(nsec int64) (tv Timeval) { 18 | nsec += 999 // round up to microsecond 19 | tv.Usec = int32(nsec % 1e9 / 1e3) 20 | tv.Sec = int64(nsec / 1e9) 21 | return 22 | } 23 | 24 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 25 | k.Ident = uint32(fd) 26 | k.Filter = int16(mode) 27 | k.Flags = uint16(flags) 28 | } 29 | 30 | func (iov *Iovec) SetLen(length int) { 31 | iov.Len = uint32(length) 32 | } 33 | 34 | func (msghdr *Msghdr) SetControllen(length int) { 35 | msghdr.Controllen = uint32(length) 36 | } 37 | 38 | func (cmsg *Cmsghdr) SetLen(length int) { 39 | cmsg.Len = uint32(length) 40 | } 41 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_solaris_amd64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build amd64,solaris 6 | 7 | package unix 8 | 9 | func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) } 10 | 11 | func NsecToTimespec(nsec int64) (ts Timespec) { 12 | ts.Sec = nsec / 1e9 13 | ts.Nsec = nsec % 1e9 14 | return 15 | } 16 | 17 | func NsecToTimeval(nsec int64) (tv Timeval) { 18 | nsec += 999 // round up to microsecond 19 | tv.Usec = nsec % 1e9 / 1e3 20 | tv.Sec = int64(nsec / 1e9) 21 | return 22 | } 23 | 24 | func (iov *Iovec) SetLen(length int) { 25 | iov.Len = uint64(length) 26 | } 27 | 28 | func (cmsg *Cmsghdr) SetLen(length int) { 29 | cmsg.Len = uint32(length) 30 | } 31 | 32 | func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) { 33 | // TODO(aram): implement this, see issue 5847. 34 | panic("unimplemented") 35 | } 36 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_solaris_test.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 solaris 6 | 7 | package unix_test 8 | 9 | import ( 10 | "os/exec" 11 | "testing" 12 | 13 | "golang.org/x/sys/unix" 14 | ) 15 | 16 | func TestStatvfs(t *testing.T) { 17 | if err := unix.Statvfs("", nil); err == nil { 18 | t.Fatal(`Statvfs("") expected failure`) 19 | } 20 | 21 | statvfs := unix.Statvfs_t{} 22 | if err := unix.Statvfs("/", &statvfs); err != nil { 23 | t.Errorf(`Statvfs("/") failed: %v`, err) 24 | } 25 | 26 | if t.Failed() { 27 | mount, err := exec.Command("mount").CombinedOutput() 28 | if err != nil { 29 | t.Logf("mount: %v\n%s", err, mount) 30 | } else { 31 | t.Logf("mount: %s", mount) 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build darwin dragonfly freebsd linux netbsd openbsd solaris 6 | 7 | package unix_test 8 | 9 | import ( 10 | "fmt" 11 | "testing" 12 | 13 | "golang.org/x/sys/unix" 14 | ) 15 | 16 | func testSetGetenv(t *testing.T, key, value string) { 17 | err := unix.Setenv(key, value) 18 | if err != nil { 19 | t.Fatalf("Setenv failed to set %q: %v", value, err) 20 | } 21 | newvalue, found := unix.Getenv(key) 22 | if !found { 23 | t.Fatalf("Getenv failed to find %v variable (want value %q)", key, value) 24 | } 25 | if newvalue != value { 26 | t.Fatalf("Getenv(%v) = %q; want %q", key, newvalue, value) 27 | } 28 | } 29 | 30 | func TestEnv(t *testing.T) { 31 | testSetGetenv(t, "TESTENV", "AVALUE") 32 | // make sure TESTENV gets set to "", not deleted 33 | testSetGetenv(t, "TESTENV", "") 34 | } 35 | 36 | func TestItoa(t *testing.T) { 37 | // Make most negative integer: 0x8000... 38 | i := 1 39 | for i<<1 != 0 { 40 | i <<= 1 41 | } 42 | if i >= 0 { 43 | t.Fatal("bad math") 44 | } 45 | s := unix.Itoa(i) 46 | f := fmt.Sprint(i) 47 | if s != f { 48 | t.Fatalf("itoa(%d) = %s, want %s", i, s, f) 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_unix_gc.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build darwin dragonfly freebsd linux netbsd openbsd solaris 6 | // +build !gccgo 7 | 8 | package unix 9 | 10 | import "syscall" 11 | 12 | func Syscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.Errno) 13 | func Syscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err syscall.Errno) 14 | func RawSyscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.Errno) 15 | func RawSyscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err syscall.Errno) 16 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/zsysnum_solaris_amd64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build amd64,solaris 6 | 7 | package unix 8 | 9 | // TODO(aram): remove these before Go 1.3. 10 | const ( 11 | SYS_EXECVE = 59 12 | SYS_FCNTL = 62 13 | ) 14 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/windows/asm_windows_386.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // 6 | // System calls for 386, Windows are implemented in runtime/syscall_windows.goc 7 | // 8 | 9 | TEXT ·getprocaddress(SB), 7, $0-8 10 | JMP syscall·getprocaddress(SB) 11 | 12 | TEXT ·loadlibrary(SB), 7, $0-4 13 | JMP syscall·loadlibrary(SB) 14 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/windows/asm_windows_amd64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // 6 | // System calls for amd64, Windows are implemented in runtime/syscall_windows.goc 7 | // 8 | 9 | TEXT ·getprocaddress(SB), 7, $0-32 10 | JMP syscall·getprocaddress(SB) 11 | 12 | TEXT ·loadlibrary(SB), 7, $0-8 13 | JMP syscall·loadlibrary(SB) 14 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/windows/env_unset.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build windows 6 | // +build go1.4 7 | 8 | package windows 9 | 10 | import "syscall" 11 | 12 | func Unsetenv(key string) error { 13 | // This was added in Go 1.4. 14 | return syscall.Unsetenv(key) 15 | } 16 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/windows/env_windows.go: -------------------------------------------------------------------------------- 1 | // Copyright 2010 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // Windows environment variables. 6 | 7 | package windows 8 | 9 | import "syscall" 10 | 11 | func Getenv(key string) (value string, found bool) { 12 | return syscall.Getenv(key) 13 | } 14 | 15 | func Setenv(key, value string) error { 16 | return syscall.Setenv(key, value) 17 | } 18 | 19 | func Clearenv() { 20 | syscall.Clearenv() 21 | } 22 | 23 | func Environ() []string { 24 | return syscall.Environ() 25 | } 26 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/windows/eventlog.go: -------------------------------------------------------------------------------- 1 | // Copyright 2012 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build windows 6 | 7 | package windows 8 | 9 | const ( 10 | EVENTLOG_SUCCESS = 0 11 | EVENTLOG_ERROR_TYPE = 1 12 | EVENTLOG_WARNING_TYPE = 2 13 | EVENTLOG_INFORMATION_TYPE = 4 14 | EVENTLOG_AUDIT_SUCCESS = 8 15 | EVENTLOG_AUDIT_FAILURE = 16 16 | ) 17 | 18 | //sys RegisterEventSource(uncServerName *uint16, sourceName *uint16) (handle Handle, err error) [failretval==0] = advapi32.RegisterEventSourceW 19 | //sys DeregisterEventSource(handle Handle) (err error) = advapi32.DeregisterEventSource 20 | //sys ReportEvent(log Handle, etype uint16, category uint16, eventId uint32, usrSId uintptr, numStrings uint16, dataSize uint32, strings **uint16, rawData *byte) (err error) = advapi32.ReportEventW 21 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/windows/memory_windows.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package windows 6 | 7 | const ( 8 | MEM_COMMIT = 0x00001000 9 | MEM_RESERVE = 0x00002000 10 | MEM_DECOMMIT = 0x00004000 11 | MEM_RELEASE = 0x00008000 12 | MEM_RESET = 0x00080000 13 | MEM_TOP_DOWN = 0x00100000 14 | MEM_WRITE_WATCH = 0x00200000 15 | MEM_PHYSICAL = 0x00400000 16 | MEM_RESET_UNDO = 0x01000000 17 | MEM_LARGE_PAGES = 0x20000000 18 | 19 | PAGE_NOACCESS = 0x01 20 | PAGE_READONLY = 0x02 21 | PAGE_READWRITE = 0x04 22 | PAGE_WRITECOPY = 0x08 23 | PAGE_EXECUTE_READ = 0x20 24 | PAGE_EXECUTE_READWRITE = 0x40 25 | PAGE_EXECUTE_WRITECOPY = 0x80 26 | ) 27 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/windows/mksyscall.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package windows 6 | 7 | //go:generate go run $GOROOT/src/syscall/mksyscall_windows.go -output zsyscall_windows.go eventlog.go service.go syscall_windows.go security_windows.go 8 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/windows/race.go: -------------------------------------------------------------------------------- 1 | // Copyright 2012 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build windows,race 6 | 7 | package windows 8 | 9 | import ( 10 | "runtime" 11 | "unsafe" 12 | ) 13 | 14 | const raceenabled = true 15 | 16 | func raceAcquire(addr unsafe.Pointer) { 17 | runtime.RaceAcquire(addr) 18 | } 19 | 20 | func raceReleaseMerge(addr unsafe.Pointer) { 21 | runtime.RaceReleaseMerge(addr) 22 | } 23 | 24 | func raceReadRange(addr unsafe.Pointer, len int) { 25 | runtime.RaceReadRange(addr, len) 26 | } 27 | 28 | func raceWriteRange(addr unsafe.Pointer, len int) { 29 | runtime.RaceWriteRange(addr, len) 30 | } 31 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/windows/race0.go: -------------------------------------------------------------------------------- 1 | // Copyright 2012 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build windows,!race 6 | 7 | package windows 8 | 9 | import ( 10 | "unsafe" 11 | ) 12 | 13 | const raceenabled = false 14 | 15 | func raceAcquire(addr unsafe.Pointer) { 16 | } 17 | 18 | func raceReleaseMerge(addr unsafe.Pointer) { 19 | } 20 | 21 | func raceReadRange(addr unsafe.Pointer, len int) { 22 | } 23 | 24 | func raceWriteRange(addr unsafe.Pointer, len int) { 25 | } 26 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/windows/registry/export_test.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 windows 6 | 7 | package registry 8 | 9 | func (k Key) SetValue(name string, valtype uint32, data []byte) error { 10 | return k.setValue(name, valtype, data) 11 | } 12 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/windows/registry/mksyscall.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 registry 6 | 7 | //go:generate go run $GOROOT/src/syscall/mksyscall_windows.go -output zsyscall_windows.go syscall.go 8 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/windows/str.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build windows 6 | 7 | package windows 8 | 9 | func itoa(val int) string { // do it here rather than with fmt to avoid dependency 10 | if val < 0 { 11 | return "-" + itoa(-val) 12 | } 13 | var buf [32]byte // big enough for int64 14 | i := len(buf) - 1 15 | for val >= 10 { 16 | buf[i] = byte(val%10 + '0') 17 | i-- 18 | val /= 10 19 | } 20 | buf[i] = byte(val + '0') 21 | return string(buf[i:]) 22 | } 23 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/windows/svc/debug/log.go: -------------------------------------------------------------------------------- 1 | // Copyright 2012 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build windows 6 | 7 | package debug 8 | 9 | import ( 10 | "os" 11 | "strconv" 12 | ) 13 | 14 | // Log interface allows different log implementations to be used. 15 | type Log interface { 16 | Close() error 17 | Info(eid uint32, msg string) error 18 | Warning(eid uint32, msg string) error 19 | Error(eid uint32, msg string) error 20 | } 21 | 22 | // ConsoleLog provides access to the console. 23 | type ConsoleLog struct { 24 | Name string 25 | } 26 | 27 | // New creates new ConsoleLog. 28 | func New(source string) *ConsoleLog { 29 | return &ConsoleLog{Name: source} 30 | } 31 | 32 | // Close closes console log l. 33 | func (l *ConsoleLog) Close() error { 34 | return nil 35 | } 36 | 37 | func (l *ConsoleLog) report(kind string, eid uint32, msg string) error { 38 | s := l.Name + "." + kind + "(" + strconv.Itoa(int(eid)) + "): " + msg + "\n" 39 | _, err := os.Stdout.Write([]byte(s)) 40 | return err 41 | } 42 | 43 | // Info writes an information event msg with event id eid to the console l. 44 | func (l *ConsoleLog) Info(eid uint32, msg string) error { 45 | return l.report("info", eid, msg) 46 | } 47 | 48 | // Warning writes an warning event msg with event id eid to the console l. 49 | func (l *ConsoleLog) Warning(eid uint32, msg string) error { 50 | return l.report("warn", eid, msg) 51 | } 52 | 53 | // Error writes an error event msg with event id eid to the console l. 54 | func (l *ConsoleLog) Error(eid uint32, msg string) error { 55 | return l.report("error", eid, msg) 56 | } 57 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/windows/svc/debug/service.go: -------------------------------------------------------------------------------- 1 | // Copyright 2012 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build windows 6 | 7 | // Package debug provides facilities to execute svc.Handler on console. 8 | // 9 | package debug 10 | 11 | import ( 12 | "os" 13 | "os/signal" 14 | "syscall" 15 | 16 | "golang.org/x/sys/windows/svc" 17 | ) 18 | 19 | // Run executes service name by calling appropriate handler function. 20 | // The process is running on console, unlike real service. Use Ctrl+C to 21 | // send "Stop" command to your service. 22 | func Run(name string, handler svc.Handler) error { 23 | cmds := make(chan svc.ChangeRequest) 24 | changes := make(chan svc.Status) 25 | 26 | sig := make(chan os.Signal) 27 | signal.Notify(sig) 28 | 29 | go func() { 30 | status := svc.Status{State: svc.Stopped} 31 | for { 32 | select { 33 | case <-sig: 34 | cmds <- svc.ChangeRequest{svc.Stop, 0, 0, status} 35 | case status = <-changes: 36 | } 37 | } 38 | }() 39 | 40 | _, errno := handler.Execute([]string{name}, cmds, changes) 41 | if errno != 0 { 42 | return syscall.Errno(errno) 43 | } 44 | return nil 45 | } 46 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/windows/svc/event.go: -------------------------------------------------------------------------------- 1 | // Copyright 2012 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build windows 6 | 7 | package svc 8 | 9 | import ( 10 | "errors" 11 | 12 | "golang.org/x/sys/windows" 13 | ) 14 | 15 | // event represents auto-reset, initially non-signaled Windows event. 16 | // It is used to communicate between go and asm parts of this package. 17 | type event struct { 18 | h windows.Handle 19 | } 20 | 21 | func newEvent() (*event, error) { 22 | h, err := windows.CreateEvent(nil, 0, 0, nil) 23 | if err != nil { 24 | return nil, err 25 | } 26 | return &event{h: h}, nil 27 | } 28 | 29 | func (e *event) Close() error { 30 | return windows.CloseHandle(e.h) 31 | } 32 | 33 | func (e *event) Set() error { 34 | return windows.SetEvent(e.h) 35 | } 36 | 37 | func (e *event) Wait() error { 38 | s, err := windows.WaitForSingleObject(e.h, windows.INFINITE) 39 | switch s { 40 | case windows.WAIT_OBJECT_0: 41 | break 42 | case windows.WAIT_FAILED: 43 | return err 44 | default: 45 | return errors.New("unexpected result from WaitForSingleObject") 46 | } 47 | return nil 48 | } 49 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/windows/svc/eventlog/log_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2012 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build windows 6 | 7 | package eventlog_test 8 | 9 | import ( 10 | "testing" 11 | 12 | "golang.org/x/sys/windows/svc/eventlog" 13 | ) 14 | 15 | func TestLog(t *testing.T) { 16 | if testing.Short() { 17 | t.Skip("skipping test in short mode - it modifies system logs") 18 | } 19 | 20 | const name = "mylog" 21 | const supports = eventlog.Error | eventlog.Warning | eventlog.Info 22 | err := eventlog.InstallAsEventCreate(name, supports) 23 | if err != nil { 24 | t.Fatalf("Install failed: %s", err) 25 | } 26 | defer func() { 27 | err = eventlog.Remove(name) 28 | if err != nil { 29 | t.Fatalf("Remove failed: %s", err) 30 | } 31 | }() 32 | 33 | l, err := eventlog.Open(name) 34 | if err != nil { 35 | t.Fatalf("Open failed: %s", err) 36 | } 37 | defer l.Close() 38 | 39 | err = l.Info(1, "info") 40 | if err != nil { 41 | t.Fatalf("Info failed: %s", err) 42 | } 43 | err = l.Warning(2, "warning") 44 | if err != nil { 45 | t.Fatalf("Warning failed: %s", err) 46 | } 47 | err = l.Error(3, "error") 48 | if err != nil { 49 | t.Fatalf("Error failed: %s", err) 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/windows/svc/example/beep.go: -------------------------------------------------------------------------------- 1 | // Copyright 2012 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build windows 6 | 7 | package main 8 | 9 | import ( 10 | "syscall" 11 | ) 12 | 13 | // BUG(brainman): MessageBeep Windows api is broken on Windows 7, 14 | // so this example does not beep when runs as service on Windows 7. 15 | 16 | var ( 17 | beepFunc = syscall.MustLoadDLL("user32.dll").MustFindProc("MessageBeep") 18 | ) 19 | 20 | func beep() { 21 | beepFunc.Call(0xffffffff) 22 | } 23 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/windows/svc/example/manage.go: -------------------------------------------------------------------------------- 1 | // Copyright 2012 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build windows 6 | 7 | package main 8 | 9 | import ( 10 | "fmt" 11 | "time" 12 | 13 | "golang.org/x/sys/windows/svc" 14 | "golang.org/x/sys/windows/svc/mgr" 15 | ) 16 | 17 | func startService(name string) error { 18 | m, err := mgr.Connect() 19 | if err != nil { 20 | return err 21 | } 22 | defer m.Disconnect() 23 | s, err := m.OpenService(name) 24 | if err != nil { 25 | return fmt.Errorf("could not access service: %v", err) 26 | } 27 | defer s.Close() 28 | err = s.Start("is", "manual-started") 29 | if err != nil { 30 | return fmt.Errorf("could not start service: %v", err) 31 | } 32 | return nil 33 | } 34 | 35 | func controlService(name string, c svc.Cmd, to svc.State) error { 36 | m, err := mgr.Connect() 37 | if err != nil { 38 | return err 39 | } 40 | defer m.Disconnect() 41 | s, err := m.OpenService(name) 42 | if err != nil { 43 | return fmt.Errorf("could not access service: %v", err) 44 | } 45 | defer s.Close() 46 | status, err := s.Control(c) 47 | if err != nil { 48 | return fmt.Errorf("could not send control=%d: %v", c, err) 49 | } 50 | timeout := time.Now().Add(10 * time.Second) 51 | for status.State != to { 52 | if timeout.Before(time.Now()) { 53 | return fmt.Errorf("timeout waiting for service to go to state=%d", to) 54 | } 55 | time.Sleep(300 * time.Millisecond) 56 | status, err = s.Query() 57 | if err != nil { 58 | return fmt.Errorf("could not retrieve service status: %v", err) 59 | } 60 | } 61 | return nil 62 | } 63 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/windows/svc/go12.c: -------------------------------------------------------------------------------- 1 | // Copyright 2012 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build windows 6 | // +build !go1.3 7 | 8 | // copied from pkg/runtime 9 | typedef unsigned int uint32; 10 | typedef unsigned long long int uint64; 11 | #ifdef _64BIT 12 | typedef uint64 uintptr; 13 | #else 14 | typedef uint32 uintptr; 15 | #endif 16 | 17 | // from sys_386.s or sys_amd64.s 18 | void ·servicemain(void); 19 | 20 | void 21 | ·getServiceMain(uintptr *r) 22 | { 23 | *r = (uintptr)·servicemain; 24 | } 25 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/windows/svc/go12.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build windows 6 | // +build !go1.3 7 | 8 | package svc 9 | 10 | // from go12.c 11 | func getServiceMain(r *uintptr) 12 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/windows/svc/go13.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build windows 6 | // +build go1.3 7 | 8 | package svc 9 | 10 | import "unsafe" 11 | 12 | const ptrSize = 4 << (^uintptr(0) >> 63) // unsafe.Sizeof(uintptr(0)) but an ideal const 13 | 14 | // Should be a built-in for unsafe.Pointer? 15 | func add(p unsafe.Pointer, x uintptr) unsafe.Pointer { 16 | return unsafe.Pointer(uintptr(p) + x) 17 | } 18 | 19 | // funcPC returns the entry PC of the function f. 20 | // It assumes that f is a func value. Otherwise the behavior is undefined. 21 | func funcPC(f interface{}) uintptr { 22 | return **(**uintptr)(add(unsafe.Pointer(&f), ptrSize)) 23 | } 24 | 25 | // from sys_386.s and sys_amd64.s 26 | func servicectlhandler(ctl uint32) uintptr 27 | func servicemain(argc uint32, argv **uint16) 28 | 29 | func getServiceMain(r *uintptr) { 30 | *r = funcPC(servicemain) 31 | } 32 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/windows/svc/sys_386.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 windows 6 | 7 | // func servicemain(argc uint32, argv **uint16) 8 | TEXT ·servicemain(SB),7,$0 9 | MOVL argc+0(FP), AX 10 | MOVL AX, ·sArgc(SB) 11 | MOVL argv+4(FP), AX 12 | MOVL AX, ·sArgv(SB) 13 | 14 | PUSHL BP 15 | PUSHL BX 16 | PUSHL SI 17 | PUSHL DI 18 | 19 | SUBL $12, SP 20 | 21 | MOVL ·sName(SB), AX 22 | MOVL AX, (SP) 23 | MOVL $·servicectlhandler(SB), AX 24 | MOVL AX, 4(SP) 25 | MOVL $0, 8(SP) 26 | MOVL ·cRegisterServiceCtrlHandlerExW(SB), AX 27 | MOVL SP, BP 28 | CALL AX 29 | MOVL BP, SP 30 | CMPL AX, $0 31 | JE exit 32 | MOVL AX, ·ssHandle(SB) 33 | 34 | MOVL ·goWaitsH(SB), AX 35 | MOVL AX, (SP) 36 | MOVL ·cSetEvent(SB), AX 37 | MOVL SP, BP 38 | CALL AX 39 | MOVL BP, SP 40 | 41 | MOVL ·cWaitsH(SB), AX 42 | MOVL AX, (SP) 43 | MOVL $-1, AX 44 | MOVL AX, 4(SP) 45 | MOVL ·cWaitForSingleObject(SB), AX 46 | MOVL SP, BP 47 | CALL AX 48 | MOVL BP, SP 49 | 50 | exit: 51 | ADDL $12, SP 52 | 53 | POPL DI 54 | POPL SI 55 | POPL BX 56 | POPL BP 57 | 58 | MOVL 0(SP), CX 59 | ADDL $12, SP 60 | JMP CX 61 | 62 | // I do not know why, but this seems to be the only way to call 63 | // ctlHandlerProc on Windows 7. 64 | 65 | // func servicectlhandler(ctl uint32, evtype uint32, evdata uintptr, context uintptr) uintptr { 66 | TEXT ·servicectlhandler(SB),7,$0 67 | MOVL ·ctlHandlerExProc(SB), CX 68 | JMP CX 69 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/windows/svc/sys_amd64.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 windows 6 | 7 | // func servicemain(argc uint32, argv **uint16) 8 | TEXT ·servicemain(SB),7,$0 9 | MOVL CX, ·sArgc(SB) 10 | MOVL DX, ·sArgv(SB) 11 | 12 | SUBQ $32, SP // stack for the first 4 syscall params 13 | 14 | MOVQ ·sName(SB), CX 15 | MOVQ $·servicectlhandler(SB), DX 16 | // BUG(pastarmovj): Figure out a way to pass in context in R8. 17 | MOVQ ·cRegisterServiceCtrlHandlerExW(SB), AX 18 | CALL AX 19 | CMPQ AX, $0 20 | JE exit 21 | MOVQ AX, ·ssHandle(SB) 22 | 23 | MOVQ ·goWaitsH(SB), CX 24 | MOVQ ·cSetEvent(SB), AX 25 | CALL AX 26 | 27 | MOVQ ·cWaitsH(SB), CX 28 | MOVQ $4294967295, DX 29 | MOVQ ·cWaitForSingleObject(SB), AX 30 | CALL AX 31 | 32 | exit: 33 | ADDQ $32, SP 34 | RET 35 | 36 | // I do not know why, but this seems to be the only way to call 37 | // ctlHandlerProc on Windows 7. 38 | 39 | // func ·servicectlhandler(ctl uint32, evtype uint32, evdata uintptr, context uintptr) uintptr { 40 | TEXT ·servicectlhandler(SB),7,$0 41 | MOVQ ·ctlHandlerExProc(SB), AX 42 | JMP AX 43 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/windows/syscall_test.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 windows 6 | 7 | package windows_test 8 | 9 | import ( 10 | "testing" 11 | 12 | "golang.org/x/sys/windows" 13 | ) 14 | 15 | func testSetGetenv(t *testing.T, key, value string) { 16 | err := windows.Setenv(key, value) 17 | if err != nil { 18 | t.Fatalf("Setenv failed to set %q: %v", value, err) 19 | } 20 | newvalue, found := windows.Getenv(key) 21 | if !found { 22 | t.Fatalf("Getenv failed to find %v variable (want value %q)", key, value) 23 | } 24 | if newvalue != value { 25 | t.Fatalf("Getenv(%v) = %q; want %q", key, newvalue, value) 26 | } 27 | } 28 | 29 | func TestEnv(t *testing.T) { 30 | testSetGetenv(t, "TESTENV", "AVALUE") 31 | // make sure TESTENV gets set to "", not deleted 32 | testSetGetenv(t, "TESTENV", "") 33 | } 34 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/windows/types_windows_386.go: -------------------------------------------------------------------------------- 1 | // Copyright 2011 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package windows 6 | 7 | type WSAData struct { 8 | Version uint16 9 | HighVersion uint16 10 | Description [WSADESCRIPTION_LEN + 1]byte 11 | SystemStatus [WSASYS_STATUS_LEN + 1]byte 12 | MaxSockets uint16 13 | MaxUdpDg uint16 14 | VendorInfo *byte 15 | } 16 | 17 | type Servent struct { 18 | Name *byte 19 | Aliases **byte 20 | Port uint16 21 | Proto *byte 22 | } 23 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/windows/types_windows_amd64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2011 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package windows 6 | 7 | type WSAData struct { 8 | Version uint16 9 | HighVersion uint16 10 | MaxSockets uint16 11 | MaxUdpDg uint16 12 | VendorInfo *byte 13 | Description [WSADESCRIPTION_LEN + 1]byte 14 | SystemStatus [WSASYS_STATUS_LEN + 1]byte 15 | } 16 | 17 | type Servent struct { 18 | Name *byte 19 | Aliases **byte 20 | Proto *byte 21 | Port uint16 22 | } 23 | --------------------------------------------------------------------------------