├── .gitignore ├── Dockerfile ├── LICENSE ├── README.md ├── adapter ├── IDataBaseAPI.go └── mysql │ ├── mysql_api.go │ ├── mysql_api_test.go │ ├── mysql_sql.go │ └── mysql_sql_test.go ├── build.sh ├── main.go ├── server ├── cron.go ├── endpoints_new.go ├── helpers.go ├── key │ └── key.go ├── lib │ └── logger.go ├── server.go ├── static │ └── swagger-ui.html.go └── swagger │ ├── constructor_helper.go │ ├── swagger_definition_tags_ref.go │ ├── swagger_gen.go │ ├── swagger_gen_test.go │ ├── swagger_path.go │ ├── swagger_schema.go │ └── swagger_schema_test.go ├── types └── type.go └── vendor ├── github.com ├── Bowery │ └── prompt │ │ ├── CONTRIBUTORS.md │ │ ├── LICENSE │ │ ├── README.md │ │ ├── ansi_unix.go │ │ ├── ansi_windows.go │ │ ├── buffer.go │ │ ├── buffer_unix.go │ │ ├── buffer_windows.go │ │ ├── ioctl_bsd.go │ │ ├── ioctl_linux.go │ │ ├── ioctl_solaris.go │ │ ├── ioctl_unix.go │ │ ├── keys.go │ │ ├── keys_unix.go │ │ ├── keys_windows.go │ │ ├── prompt.go │ │ ├── term.go │ │ ├── term_unix.go │ │ └── term_windows.go ├── PuerkitoBio │ ├── purell │ │ ├── LICENSE │ │ ├── README.md │ │ └── purell.go │ └── urlesc │ │ ├── LICENSE │ │ ├── README.md │ │ └── urlesc.go ├── dgrijalva │ └── jwt-go │ │ ├── LICENSE │ │ ├── MIGRATION_GUIDE.md │ │ ├── README.md │ │ ├── VERSION_HISTORY.md │ │ ├── claims.go │ │ ├── doc.go │ │ ├── ecdsa.go │ │ ├── ecdsa_utils.go │ │ ├── errors.go │ │ ├── hmac.go │ │ ├── map_claims.go │ │ ├── none.go │ │ ├── parser.go │ │ ├── rsa.go │ │ ├── rsa_pss.go │ │ ├── rsa_utils.go │ │ ├── signing_method.go │ │ └── token.go ├── go-openapi │ ├── jsonpointer │ │ ├── CODE_OF_CONDUCT.md │ │ ├── LICENSE │ │ ├── README.md │ │ └── pointer.go │ ├── jsonreference │ │ ├── CODE_OF_CONDUCT.md │ │ ├── LICENSE │ │ ├── README.md │ │ └── reference.go │ ├── spec │ │ ├── CODE_OF_CONDUCT.md │ │ ├── LICENSE │ │ ├── README.md │ │ ├── bindata.go │ │ ├── contact_info.go │ │ ├── expander.go │ │ ├── external_docs.go │ │ ├── header.go │ │ ├── info.go │ │ ├── items.go │ │ ├── license.go │ │ ├── operation.go │ │ ├── parameter.go │ │ ├── path_item.go │ │ ├── paths.go │ │ ├── ref.go │ │ ├── response.go │ │ ├── responses.go │ │ ├── schema.go │ │ ├── security_scheme.go │ │ ├── spec.go │ │ ├── swagger.go │ │ ├── tag.go │ │ └── xml_object.go │ └── swag │ │ ├── CODE_OF_CONDUCT.md │ │ ├── LICENSE │ │ ├── README.md │ │ ├── convert.go │ │ ├── convert_types.go │ │ ├── json.go │ │ ├── loading.go │ │ ├── net.go │ │ ├── path.go │ │ ├── util.go │ │ └── yaml.go ├── go-sql-driver │ └── mysql │ │ ├── AUTHORS │ │ ├── CHANGELOG.md │ │ ├── CONTRIBUTING.md │ │ ├── LICENSE │ │ ├── README.md │ │ ├── appengine.go │ │ ├── buffer.go │ │ ├── collations.go │ │ ├── connection.go │ │ ├── const.go │ │ ├── driver.go │ │ ├── dsn.go │ │ ├── errors.go │ │ ├── fields.go │ │ ├── infile.go │ │ ├── packets.go │ │ ├── result.go │ │ ├── rows.go │ │ ├── statement.go │ │ ├── transaction.go │ │ └── utils.go ├── labstack │ ├── echo │ │ ├── Gopkg.lock │ │ ├── Gopkg.toml │ │ ├── LICENSE │ │ ├── Makefile │ │ ├── README.md │ │ ├── bind.go │ │ ├── context.go │ │ ├── echo.go │ │ ├── echo_go1.8.go │ │ ├── group.go │ │ ├── log.go │ │ ├── middleware │ │ │ ├── basic_auth.go │ │ │ ├── body_dump.go │ │ │ ├── body_limit.go │ │ │ ├── compress.go │ │ │ ├── cors.go │ │ │ ├── csrf.go │ │ │ ├── jwt.go │ │ │ ├── key_auth.go │ │ │ ├── logger.go │ │ │ ├── method_override.go │ │ │ ├── middleware.go │ │ │ ├── proxy.go │ │ │ ├── recover.go │ │ │ ├── redirect.go │ │ │ ├── request_id.go │ │ │ ├── secure.go │ │ │ ├── slash.go │ │ │ └── static.go │ │ ├── response.go │ │ ├── router.go │ │ ├── util_go17.go │ │ └── util_go18.go │ └── gommon │ │ ├── LICENSE │ │ ├── bytes │ │ ├── README.md │ │ └── bytes.go │ │ ├── color │ │ ├── README.md │ │ └── color.go │ │ ├── log │ │ ├── README.md │ │ ├── color.go │ │ ├── log.go │ │ └── white.go │ │ └── random │ │ └── random.go ├── mailru │ └── easyjson │ │ ├── LICENSE │ │ ├── buffer │ │ └── pool.go │ │ ├── jlexer │ │ ├── bytestostr.go │ │ ├── bytestostr_nounsafe.go │ │ ├── error.go │ │ └── lexer.go │ │ └── jwriter │ │ └── writer.go ├── mattn │ ├── go-colorable │ │ ├── LICENSE │ │ ├── README.md │ │ ├── colorable_appengine.go │ │ ├── colorable_others.go │ │ ├── colorable_windows.go │ │ └── noncolorable.go │ └── go-isatty │ │ ├── LICENSE │ │ ├── README.md │ │ ├── doc.go │ │ ├── isatty_appengine.go │ │ ├── isatty_bsd.go │ │ ├── isatty_linux.go │ │ ├── isatty_others.go │ │ ├── isatty_solaris.go │ │ └── isatty_windows.go ├── mediocregopher │ └── gojson │ │ ├── LICENSE │ │ ├── README.md │ │ ├── decode.go │ │ ├── encode.go │ │ ├── indent.go │ │ ├── scanner.go │ │ ├── stream.go │ │ └── tags.go ├── mkideal │ ├── cli │ │ ├── CHANGELOG.md │ │ ├── LICENSE │ │ ├── README.md │ │ ├── builtin.go │ │ ├── cli.go │ │ ├── cliutil.go │ │ ├── coder.go │ │ ├── command.go │ │ ├── context.go │ │ ├── editor.go │ │ ├── errors.go │ │ ├── flag.go │ │ ├── flag_set.go │ │ ├── fuzzy.go │ │ ├── http.go │ │ ├── parser.go │ │ ├── run-examples.sh │ │ └── tag.go │ └── pkg │ │ ├── LICENSE │ │ └── expr │ │ ├── README.md │ │ ├── eval.go │ │ ├── expr.go │ │ ├── internal.go │ │ ├── pool.go │ │ └── value.go ├── robfig │ └── cron │ │ ├── LICENSE │ │ ├── README.md │ │ ├── constantdelay.go │ │ ├── cron.go │ │ ├── doc.go │ │ ├── parser.go │ │ └── spec.go └── valyala │ ├── bytebufferpool │ ├── LICENSE │ ├── README.md │ ├── bytebuffer.go │ ├── doc.go │ └── pool.go │ └── fasttemplate │ ├── LICENSE │ ├── README.md │ ├── template.go │ ├── unsafe.go │ └── unsafe_gae.go ├── golang.org └── x │ ├── crypto │ ├── LICENSE │ ├── PATENTS │ └── acme │ │ ├── acme.go │ │ ├── autocert │ │ ├── autocert.go │ │ ├── cache.go │ │ ├── listener.go │ │ └── renewal.go │ │ ├── jws.go │ │ └── types.go │ ├── net │ ├── LICENSE │ ├── PATENTS │ └── idna │ │ ├── idna.go │ │ └── punycode.go │ ├── sys │ ├── LICENSE │ ├── PATENTS │ └── unix │ │ ├── README.md │ │ ├── asm_darwin_386.s │ │ ├── asm_darwin_amd64.s │ │ ├── asm_darwin_arm.s │ │ ├── asm_darwin_arm64.s │ │ ├── asm_dragonfly_amd64.s │ │ ├── asm_freebsd_386.s │ │ ├── asm_freebsd_amd64.s │ │ ├── asm_freebsd_arm.s │ │ ├── asm_linux_386.s │ │ ├── asm_linux_amd64.s │ │ ├── asm_linux_arm.s │ │ ├── asm_linux_arm64.s │ │ ├── asm_linux_mips64x.s │ │ ├── asm_linux_mipsx.s │ │ ├── asm_linux_ppc64x.s │ │ ├── asm_linux_s390x.s │ │ ├── asm_netbsd_386.s │ │ ├── asm_netbsd_amd64.s │ │ ├── asm_netbsd_arm.s │ │ ├── asm_openbsd_386.s │ │ ├── asm_openbsd_amd64.s │ │ ├── asm_solaris_amd64.s │ │ ├── bluetooth_linux.go │ │ ├── constants.go │ │ ├── dirent.go │ │ ├── endian_big.go │ │ ├── endian_little.go │ │ ├── env_unix.go │ │ ├── env_unset.go │ │ ├── flock.go │ │ ├── flock_linux_32bit.go │ │ ├── gccgo.go │ │ ├── gccgo_c.c │ │ ├── gccgo_linux_amd64.go │ │ ├── gccgo_linux_sparc64.go │ │ ├── mkall.sh │ │ ├── mkerrors.sh │ │ ├── mksyscall.pl │ │ ├── mksyscall_solaris.pl │ │ ├── mksysctl_openbsd.pl │ │ ├── mksysnum_darwin.pl │ │ ├── mksysnum_dragonfly.pl │ │ ├── mksysnum_freebsd.pl │ │ ├── mksysnum_netbsd.pl │ │ ├── mksysnum_openbsd.pl │ │ ├── openbsd_pledge.go │ │ ├── race.go │ │ ├── race0.go │ │ ├── sockcmsg_linux.go │ │ ├── sockcmsg_unix.go │ │ ├── str.go │ │ ├── syscall.go │ │ ├── syscall_bsd.go │ │ ├── syscall_darwin.go │ │ ├── syscall_darwin_386.go │ │ ├── syscall_darwin_amd64.go │ │ ├── syscall_darwin_arm.go │ │ ├── syscall_darwin_arm64.go │ │ ├── syscall_dragonfly.go │ │ ├── syscall_dragonfly_amd64.go │ │ ├── syscall_freebsd.go │ │ ├── syscall_freebsd_386.go │ │ ├── syscall_freebsd_amd64.go │ │ ├── syscall_freebsd_arm.go │ │ ├── syscall_linux.go │ │ ├── syscall_linux_386.go │ │ ├── syscall_linux_amd64.go │ │ ├── syscall_linux_amd64_gc.go │ │ ├── syscall_linux_arm.go │ │ ├── syscall_linux_arm64.go │ │ ├── syscall_linux_mips64x.go │ │ ├── syscall_linux_mipsx.go │ │ ├── syscall_linux_ppc64x.go │ │ ├── syscall_linux_s390x.go │ │ ├── syscall_linux_sparc64.go │ │ ├── syscall_netbsd.go │ │ ├── syscall_netbsd_386.go │ │ ├── syscall_netbsd_amd64.go │ │ ├── syscall_netbsd_arm.go │ │ ├── syscall_no_getwd.go │ │ ├── syscall_openbsd.go │ │ ├── syscall_openbsd_386.go │ │ ├── syscall_openbsd_amd64.go │ │ ├── syscall_solaris.go │ │ ├── syscall_solaris_amd64.go │ │ ├── syscall_unix.go │ │ ├── syscall_unix_gc.go │ │ ├── zerrors_darwin_386.go │ │ ├── zerrors_darwin_amd64.go │ │ ├── zerrors_darwin_arm.go │ │ ├── zerrors_darwin_arm64.go │ │ ├── zerrors_dragonfly_amd64.go │ │ ├── zerrors_freebsd_386.go │ │ ├── zerrors_freebsd_amd64.go │ │ ├── zerrors_freebsd_arm.go │ │ ├── zerrors_linux_386.go │ │ ├── zerrors_linux_amd64.go │ │ ├── zerrors_linux_arm.go │ │ ├── zerrors_linux_arm64.go │ │ ├── zerrors_linux_mips.go │ │ ├── zerrors_linux_mips64.go │ │ ├── zerrors_linux_mips64le.go │ │ ├── zerrors_linux_mipsle.go │ │ ├── zerrors_linux_ppc64.go │ │ ├── zerrors_linux_ppc64le.go │ │ ├── zerrors_linux_s390x.go │ │ ├── zerrors_linux_sparc64.go │ │ ├── zerrors_netbsd_386.go │ │ ├── zerrors_netbsd_amd64.go │ │ ├── zerrors_netbsd_arm.go │ │ ├── zerrors_openbsd_386.go │ │ ├── zerrors_openbsd_amd64.go │ │ ├── zerrors_solaris_amd64.go │ │ ├── zsyscall_darwin_386.go │ │ ├── zsyscall_darwin_amd64.go │ │ ├── zsyscall_darwin_arm.go │ │ ├── zsyscall_darwin_arm64.go │ │ ├── zsyscall_dragonfly_amd64.go │ │ ├── zsyscall_freebsd_386.go │ │ ├── zsyscall_freebsd_amd64.go │ │ ├── zsyscall_freebsd_arm.go │ │ ├── zsyscall_linux_386.go │ │ ├── zsyscall_linux_amd64.go │ │ ├── zsyscall_linux_arm.go │ │ ├── zsyscall_linux_arm64.go │ │ ├── zsyscall_linux_mips.go │ │ ├── zsyscall_linux_mips64.go │ │ ├── zsyscall_linux_mips64le.go │ │ ├── zsyscall_linux_mipsle.go │ │ ├── zsyscall_linux_ppc64.go │ │ ├── zsyscall_linux_ppc64le.go │ │ ├── zsyscall_linux_s390x.go │ │ ├── zsyscall_linux_sparc64.go │ │ ├── zsyscall_netbsd_386.go │ │ ├── zsyscall_netbsd_amd64.go │ │ ├── zsyscall_netbsd_arm.go │ │ ├── zsyscall_openbsd_386.go │ │ ├── zsyscall_openbsd_amd64.go │ │ ├── zsyscall_solaris_amd64.go │ │ ├── zsysctl_openbsd.go │ │ ├── zsysnum_darwin_386.go │ │ ├── zsysnum_darwin_amd64.go │ │ ├── zsysnum_darwin_arm.go │ │ ├── zsysnum_darwin_arm64.go │ │ ├── zsysnum_dragonfly_amd64.go │ │ ├── zsysnum_freebsd_386.go │ │ ├── zsysnum_freebsd_amd64.go │ │ ├── zsysnum_freebsd_arm.go │ │ ├── zsysnum_linux_386.go │ │ ├── zsysnum_linux_amd64.go │ │ ├── zsysnum_linux_arm.go │ │ ├── zsysnum_linux_arm64.go │ │ ├── zsysnum_linux_mips.go │ │ ├── zsysnum_linux_mips64.go │ │ ├── zsysnum_linux_mips64le.go │ │ ├── zsysnum_linux_mipsle.go │ │ ├── zsysnum_linux_ppc64.go │ │ ├── zsysnum_linux_ppc64le.go │ │ ├── zsysnum_linux_s390x.go │ │ ├── zsysnum_linux_sparc64.go │ │ ├── zsysnum_netbsd_386.go │ │ ├── zsysnum_netbsd_amd64.go │ │ ├── zsysnum_netbsd_arm.go │ │ ├── zsysnum_openbsd_386.go │ │ ├── zsysnum_openbsd_amd64.go │ │ ├── zsysnum_solaris_amd64.go │ │ ├── ztypes_darwin_386.go │ │ ├── ztypes_darwin_amd64.go │ │ ├── ztypes_darwin_arm.go │ │ ├── ztypes_darwin_arm64.go │ │ ├── ztypes_dragonfly_amd64.go │ │ ├── ztypes_freebsd_386.go │ │ ├── ztypes_freebsd_amd64.go │ │ ├── ztypes_freebsd_arm.go │ │ ├── ztypes_linux_386.go │ │ ├── ztypes_linux_amd64.go │ │ ├── ztypes_linux_arm.go │ │ ├── ztypes_linux_arm64.go │ │ ├── ztypes_linux_mips.go │ │ ├── ztypes_linux_mips64.go │ │ ├── ztypes_linux_mips64le.go │ │ ├── ztypes_linux_mipsle.go │ │ ├── ztypes_linux_ppc64.go │ │ ├── ztypes_linux_ppc64le.go │ │ ├── ztypes_linux_s390x.go │ │ ├── ztypes_linux_sparc64.go │ │ ├── ztypes_netbsd_386.go │ │ ├── ztypes_netbsd_amd64.go │ │ ├── ztypes_netbsd_arm.go │ │ ├── ztypes_openbsd_386.go │ │ ├── ztypes_openbsd_amd64.go │ │ └── ztypes_solaris_amd64.go │ └── text │ ├── LICENSE │ ├── PATENTS │ ├── transform │ └── transform.go │ ├── unicode │ └── norm │ │ ├── composition.go │ │ ├── forminfo.go │ │ ├── input.go │ │ ├── iter.go │ │ ├── normalize.go │ │ ├── readwriter.go │ │ ├── tables.go │ │ ├── transform.go │ │ └── trie.go │ └── width │ ├── kind_string.go │ ├── tables.go │ ├── transform.go │ ├── trieval.go │ └── width.go ├── gopkg.in ├── doug-martin │ └── goqu.v4 │ │ ├── CONTRIBUTING.md │ │ ├── HISTORY.md │ │ ├── README.md │ │ ├── adapters.go │ │ ├── adapters │ │ └── mysql │ │ │ └── mysql.go │ │ ├── crud_exec.go │ │ ├── database.go │ │ ├── dataset.go │ │ ├── dataset_actions.go │ │ ├── dataset_delete.go │ │ ├── dataset_insert.go │ │ ├── dataset_select.go │ │ ├── dataset_update.go │ │ ├── default_adapter.go │ │ ├── docker-compose.yml │ │ ├── errors.go │ │ ├── expressions.go │ │ ├── go.test.sh │ │ ├── goqu.go │ │ ├── sql_builder.go │ │ └── tags.go └── yaml.v2 │ ├── LICENSE │ ├── LICENSE.libyaml │ ├── README.md │ ├── apic.go │ ├── decode.go │ ├── emitterc.go │ ├── encode.go │ ├── parserc.go │ ├── readerc.go │ ├── resolve.go │ ├── scannerc.go │ ├── sorter.go │ ├── writerc.go │ ├── yaml.go │ ├── yamlh.go │ └── yamlprivateh.go └── vendor.json /.gitignore: -------------------------------------------------------------------------------- 1 | # Binaries for programs and plugins 2 | *.exe 3 | *.dll 4 | *.so 5 | *.dylib 6 | 7 | # Test binary, build with `go test -c` 8 | *.test 9 | 10 | # Output of the go coverage tool, specifically when used with LiteIDE 11 | *.out 12 | 13 | # Project-local glide cache, RE: https://github.com/Masterminds/glide/issues/736 14 | .glide/ 15 | 16 | # godep 17 | 18 | *.test 19 | *debug* 20 | 21 | .vscode 22 | 23 | # ide 24 | 25 | .idea 26 | 27 | *.iml 28 | /*.docx 29 | 30 | *go-mysql-api* -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu 2 | 3 | ENV API_HOST_LS :1323 4 | 5 | COPY go-mysql-api-linux-amd64 /go-mysql-api 6 | 7 | EXPOSE 1323 8 | 9 | CMD ["/go-mysql-api"] 10 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Theo Sun 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 | -------------------------------------------------------------------------------- /adapter/IDataBaseAPI.go: -------------------------------------------------------------------------------- 1 | package adapter 2 | 3 | import ( 4 | "database/sql" 5 | . "github.com/Soontao/go-mysql-api/types" 6 | ) 7 | 8 | type IDatabaseAPI interface { 9 | Create(table string, obj map[string]interface{}) (rs sql.Result, err error) 10 | Update(table string, id interface{}, obj map[string]interface{}) (rs sql.Result, err error) 11 | Delete(table string, id interface{}, obj map[string]interface{}) (rs sql.Result, err error) 12 | Select(option QueryOption) (rs []map[string]interface{}, err error) 13 | GetDatabaseMetadata() *DataBaseMetadata 14 | UpdateAPIMetadata() (api IDatabaseAPI) 15 | } 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /adapter/mysql/mysql_api_test.go: -------------------------------------------------------------------------------- 1 | package mysql 2 | 3 | import ( 4 | "encoding/json" 5 | "fmt" 6 | "log" 7 | "os" 8 | "testing" 9 | ) 10 | 11 | var connectionStr = os.Getenv("API_CONN_STR") 12 | 13 | func TestCreateMysqlAPIInstance(t *testing.T) { 14 | api := NewMysqlAPI(connectionStr, true) 15 | rows, err := api.connection.Query("select 1") 16 | if err != nil { 17 | log.Fatal(err) 18 | } 19 | for rows.Next() { 20 | var col1 string 21 | if err := rows.Scan(&col1); err != nil { 22 | log.Fatal(err) 23 | } 24 | println(col1) 25 | } 26 | api.Stop() 27 | } 28 | 29 | func TestCurrentDatabaseName(t *testing.T) { 30 | api := NewMysqlAPI(connectionStr, true) 31 | res := api.CurrentDatabaseName() 32 | println(res) 33 | api.Stop() 34 | } 35 | 36 | func TestRetriveMetadata(t *testing.T) { 37 | api := NewMysqlAPI(connectionStr, true) 38 | res := api.retriveDatabaseMetadata("monitor") 39 | println(res.Tables[0].Columns[0].ColumnName) 40 | api.Stop() 41 | } 42 | 43 | func TestRowScan(t *testing.T) { 44 | api := NewMysqlAPI(connectionStr, true) 45 | defer api.Stop() 46 | rs, err := api.query("select * from monitor Limit ?", 2) 47 | if err != nil { 48 | t.Error(err) 49 | } 50 | for _, row := range rs { 51 | jsonStr, _ := json.Marshal(row) // use gojson avoid base64 encode of []byte 52 | fmt.Printf("%s\n", jsonStr) 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /adapter/mysql/mysql_sql_test.go: -------------------------------------------------------------------------------- 1 | package mysql 2 | 3 | import ( 4 | "testing" 5 | 6 | "gopkg.in/doug-martin/goqu.v4" 7 | // mysql dialect 8 | _ "gopkg.in/doug-martin/goqu.v4/adapters/mysql" 9 | ) 10 | 11 | func TestSQL_GetByTableAndID(t *testing.T) { 12 | api := NewMysqlAPI(connectionStr, false) 13 | defer api.Stop() 14 | } 15 | 16 | func TestInsertSQLFromMap(t *testing.T) { 17 | m := map[string]interface{}{"name": "monitor", "seq": 1} 18 | s := goqu.From("Table").Insert(m).Sql 19 | println(s) 20 | } 21 | 22 | func TestDeleteSQLFromMap(t *testing.T) { 23 | m := map[string]interface{}{"name": "monitor", "seq": 1} 24 | builder := goqu.From("DTable") 25 | for k, v := range m { 26 | builder = builder.Where(goqu.Ex{k: v}) 27 | } 28 | s := builder.Delete().Sql 29 | println(s) 30 | } 31 | 32 | func TestUpdateSQLFromMap(t *testing.T) { 33 | api := NewMysqlAPI(connectionStr) 34 | defer api.Stop() 35 | if sql, err := api.sql.UpdateByTableAndId("monitor", 1, map[string]interface{}{"target": "change it"}); err != nil { 36 | t.Error(err) 37 | } else { 38 | println(sql) 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -v on 4 | 5 | if which govendor 2>/dev/null; then 6 | echo 'govendor exist' 7 | else 8 | go get -u -v github.com/kardianos/govendor 9 | echo 'govendor does not exist' 10 | fi 11 | 12 | 13 | export GOOS=linux GOARCH=amd64 14 | govendor build -o "${PWD##*/}-${GOOS}-${GOARCH}" 15 | export GOOS=linux GOARCH=386 16 | govendor build -o "${PWD##*/}-${GOOS}-${GOARCH}" 17 | export GOOS=linux GOARCH=arm64 18 | govendor build -o "${PWD##*/}-${GOOS}-${GOARCH}" 19 | export GOOS=darwin GOARCH=amd64 20 | govendor build -o "${PWD##*/}-${GOOS}-${GOARCH}" 21 | export GOOS=windows GOARCH=amd64 22 | govendor build -o "${PWD##*/}-${GOOS}-${GOARCH}.exe" -------------------------------------------------------------------------------- /main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "github.com/Soontao/go-mysql-api/server" 5 | "github.com/mkideal/cli" 6 | "github.com/Soontao/go-mysql-api/adapter/mysql" 7 | ) 8 | 9 | type cliArgs struct { 10 | cli.Helper 11 | ConnectionStr string `cli:"*c,*conn" usage:"mysql connection str" dft:"$API_CONN_STR"` 12 | ListenAddress string `cli:"*l,*listen" usage:"listen host and port" dft:"$API_HOST_LS"` 13 | NoInfomationSchema bool `cli:"n,noinfo" usage:"dont use mysql information shcema" dft:"$API_NO_USE_INFO"` 14 | } 15 | 16 | func main() { 17 | 18 | cli.Run(new(cliArgs), func(ctx *cli.Context) error { 19 | argv := ctx.Argv().(*cliArgs) 20 | // if you want adapt other databases, implement adapter.IDataBaseAPI interface and rewrite main function. 21 | api := mysql.NewMysqlAPI(argv.ConnectionStr, !argv.NoInfomationSchema) 22 | server.New(api).Start(argv.ListenAddress) 23 | return nil 24 | }) 25 | 26 | } 27 | -------------------------------------------------------------------------------- /server/cron.go: -------------------------------------------------------------------------------- 1 | package server 2 | 3 | import ( 4 | "github.com/robfig/cron" 5 | ) 6 | 7 | // StartMetadataRefreshCron task 8 | func (m *MysqlAPIServer) StartMetadataRefreshCron() { 9 | c := cron.New() 10 | c.AddFunc("@every 5m", func() { 11 | m.api.UpdateAPIMetadata() 12 | m.Logger.Infof("metadata updated !") 13 | }) 14 | c.Start() 15 | } 16 | -------------------------------------------------------------------------------- /server/key/key.go: -------------------------------------------------------------------------------- 1 | package key 2 | 3 | var KEY_QUERY_FIELDS = "_fields" 4 | var KEY_QUERY_FIELD = "_field" 5 | var KEY_QUERY_LINK = "_link" 6 | var KEY_QUERY_WHERE = "_where" 7 | var KEY_QUERY_SEARCH = "_search" 8 | var KEY_QUERY_SKIP = "_skip" 9 | var KEY_QUERY_LIMIT = "_limit" 10 | -------------------------------------------------------------------------------- /server/lib/logger.go: -------------------------------------------------------------------------------- 1 | package lib 2 | 3 | import ( 4 | "os" 5 | 6 | "github.com/labstack/gommon/log" 7 | ) 8 | 9 | // Logger public Logger 10 | var Logger = NewLogger() 11 | 12 | // NewLogger for instance 13 | func NewLogger() (l *log.Logger) { 14 | l = log.New("database-api-server") 15 | l.SetHeader(`[${level}] ${time_rfc3339_nano}`) 16 | l.SetLevel(log.DEBUG) 17 | l.SetOutput(os.Stdout) 18 | return 19 | } 20 | -------------------------------------------------------------------------------- /server/server.go: -------------------------------------------------------------------------------- 1 | package server 2 | 3 | import ( 4 | "github.com/Soontao/go-mysql-api/server/lib" 5 | "github.com/labstack/echo" 6 | "github.com/Soontao/go-mysql-api/adapter" 7 | ) 8 | 9 | // MysqlAPIServer is a http server could access mysql api 10 | type MysqlAPIServer struct { 11 | *echo.Echo // echo web server 12 | api adapter.IDatabaseAPI // database api adapter 13 | } 14 | 15 | // New create a new MysqlAPIServer instance 16 | func New(api adapter.IDatabaseAPI) *MysqlAPIServer { 17 | server := &MysqlAPIServer{} 18 | server.Echo = echo.New() 19 | server.HTTPErrorHandler = customErrorHandler 20 | server.HideBanner = true 21 | server.Logger = lib.Logger 22 | server.Use(loggerMiddleware()) 23 | server.api = api 24 | mountEndpoints(server.Echo, server.api) 25 | return server 26 | } 27 | 28 | // Start server 29 | func (server *MysqlAPIServer) Start(address string) *MysqlAPIServer { 30 | server.StartMetadataRefreshCron() 31 | server.Logger.Infof("server start at %s", address) 32 | server.Logger.Fatal(server.Echo.Start(address)) 33 | return server 34 | } 35 | -------------------------------------------------------------------------------- /server/static/swagger-ui.html.go: -------------------------------------------------------------------------------- 1 | package static 2 | 3 | var SWAGGER_UI_HTML = ` 4 | 5 | 6 | 7 | 8 | 9 | Swagger UI 10 | 11 | 12 | 17 | 18 | 19 | 20 |
21 | 22 | 23 | 24 | 51 | 52 | 53 | 54 | ` 55 | -------------------------------------------------------------------------------- /server/swagger/swagger_definition_tags_ref.go: -------------------------------------------------------------------------------- 1 | package swagger 2 | 3 | import ( 4 | "github.com/go-openapi/spec" 5 | "github.com/go-openapi/jsonreference" 6 | types "github.com/Soontao/go-mysql-api/types" 7 | "fmt" 8 | ) 9 | 10 | func SwaggerDefinationsFromDabaseMetadata(dbMeta *types.DataBaseMetadata) (definations spec.Definitions) { 11 | definations = spec.Definitions{} 12 | for _, t := range dbMeta.Tables { 13 | schema := spec.Schema{} 14 | schema.Type = spec.StringOrArray{"object"} 15 | schema.Title = t.TableName 16 | schema.Description = t.Comment 17 | schema.SchemaProps = SchemaPropsFromTbmeta(t) 18 | definations[t.TableName] = schema 19 | } 20 | return 21 | } 22 | 23 | func getTableSwaggerRef(t string) (ref spec.Ref) { 24 | ref = spec.Ref{} 25 | ref.Ref, _ = jsonreference.New(fmt.Sprintf("#/definitions/%s", t)) 26 | return 27 | } 28 | 29 | func getTableSwaggerRefAble(t string) (refable spec.Refable) { 30 | refable = spec.Refable{getTableSwaggerRef(t)} 31 | return 32 | } 33 | 34 | func GetTagsFromDBMetadata(meta *types.DataBaseMetadata) (tags []spec.Tag) { 35 | tags = make([]spec.Tag, 0) 36 | for _, t := range meta.Tables { 37 | tags = append(tags, spec.Tag{TagProps: spec.TagProps{Name: t.TableName, Description: t.Comment}}) 38 | } 39 | return 40 | } 41 | -------------------------------------------------------------------------------- /server/swagger/swagger_gen.go: -------------------------------------------------------------------------------- 1 | package swagger 2 | 3 | import ( 4 | "github.com/go-openapi/spec" 5 | types "github.com/Soontao/go-mysql-api/types" 6 | ) 7 | 8 | func GenSwaggerFromDBMetadata(dbMetadata *types.DataBaseMetadata) (s *spec.Swagger) { 9 | s = &spec.Swagger{} 10 | s.SwaggerProps = spec.SwaggerProps{} 11 | s.Swagger = "2.0" 12 | s.Schemes = []string{"http"} 13 | s.Tags = GetTagsFromDBMetadata(dbMetadata) 14 | s.Info = NewSwaggerInfo(dbMetadata, "version 1") 15 | s.Definitions = SwaggerDefinationsFromDabaseMetadata(dbMetadata) 16 | s.Paths = &spec.Paths{Paths: SwaggerPathsFromDatabaseMetadata(dbMetadata)} 17 | return 18 | } 19 | -------------------------------------------------------------------------------- /server/swagger/swagger_gen_test.go: -------------------------------------------------------------------------------- 1 | package swagger 2 | 3 | import ( 4 | "fmt" 5 | "testing" 6 | 7 | "os" 8 | 9 | "github.com/Soontao/go-mysql-api/adapter/mysql" 10 | "github.com/Soontao/go-mysql-api/server/swaggerswagger" 11 | ) 12 | 13 | var connectionStr = os.Getenv("API_CONN_STR") 14 | 15 | func TestGenerateSwaggerConfig(t *testing.T) { 16 | api := mysql.NewMysqlAPI(connectionStr, true) 17 | defer api.Stop() 18 | s := swagger.GenSwaggerFromDBMetadata(api.GetDatabaseMetadata()) 19 | j, _ := s.MarshalJSON() 20 | fmt.Println(string(j)) 21 | } 22 | -------------------------------------------------------------------------------- /server/swagger/swagger_schema.go: -------------------------------------------------------------------------------- 1 | package swagger 2 | 3 | import ( 4 | "regexp" 5 | "strings" 6 | 7 | "github.com/go-openapi/spec" 8 | "fmt" 9 | types "github.com/Soontao/go-mysql-api/types" 10 | ) 11 | 12 | func dbTypeToSchemaType(t string) (rt_t string) { 13 | switch t { 14 | default: 15 | rt_t = "string" 16 | case "int", "integer", "bigint", "tinyint", "smallint", "mediumint": 17 | rt_t = "integer" 18 | case "float", "double", "decimal": 19 | rt_t = "number" 20 | case "bool", "boolean": 21 | rt_t = "boolean" 22 | } 23 | return 24 | } 25 | 26 | func getEnumIfItIs(c *types.ColumnMetadata) (enum []interface{}) { 27 | enum = make([]interface{}, 0) 28 | re := regexp.MustCompile("\\'([\\w]+)\\'") 29 | if strings.HasPrefix(c.ColumnType, "enum") { 30 | enumStrArr := re.FindAllString(c.ColumnType, -1) 31 | for _, enumItem := range enumStrArr { 32 | enum = append(enum, enumItem) 33 | } 34 | } 35 | return 36 | } 37 | 38 | func ColumnSchema(col *types.ColumnMetadata) (s *spec.Schema) { 39 | s = &spec.Schema{ 40 | SchemaProps: spec.SchemaProps{ 41 | Type: spec.StringOrArray{dbTypeToSchemaType(col.DataType)}, 42 | }, 43 | } 44 | return 45 | } 46 | 47 | func SchemaPropsFromTbmeta(tMeta *types.TableMetadata) (tableSchema spec.SchemaProps) { 48 | tableSchema = spec.SchemaProps{} 49 | tableSchema.Required = []string{} 50 | tableSchema.Properties = map[string]spec.Schema{} 51 | for _, col := range tMeta.Columns { 52 | if col.NullAble == "NO" && col.Extra != "auto_increment" { 53 | tableSchema.Required = append(tableSchema.Required, col.ColumnName) 54 | } 55 | desc := col.Comment 56 | if col.Key == "PRI" { 57 | desc = fmt.Sprintf("(PK) %s", col.Comment) 58 | } 59 | tableSchema.Properties[col.ColumnName] = spec.Schema{ 60 | SchemaProps: spec.SchemaProps{ 61 | Type: spec.StringOrArray{dbTypeToSchemaType(col.DataType)}, 62 | Description: desc, 63 | Title: col.ColumnName, 64 | Default: col.GetDefaultValue(), 65 | Enum: getEnumIfItIs(col), 66 | }, 67 | } 68 | 69 | } 70 | return 71 | } 72 | 73 | func getTableSwaggerRefSchema(t string) (s *spec.Schema) { 74 | s = &spec.Schema{ 75 | SchemaProps: spec.SchemaProps{ 76 | Ref: getTableSwaggerRef(t), 77 | }, 78 | } 79 | return 80 | } 81 | -------------------------------------------------------------------------------- /server/swagger/swagger_schema_test.go: -------------------------------------------------------------------------------- 1 | package swagger 2 | 3 | import ( 4 | "fmt" 5 | "regexp" 6 | "testing" 7 | ) 8 | 9 | func Test_getEnumIfItIs(t *testing.T) { 10 | re := regexp.MustCompile("\\'([\\w]+)\\'") 11 | enum := re.FindAllString("enum('circulated','reserved','finished')", -1) 12 | fmt.Println(len(enum)) 13 | fmt.Println(enum) 14 | } 15 | -------------------------------------------------------------------------------- /vendor/github.com/Bowery/prompt/CONTRIBUTORS.md: -------------------------------------------------------------------------------- 1 | - [Larz Conwell](https://github.com/larzconwell) 2 | - [Steve Kaliski](https://github.com/sjkaliski) 3 | - [NHOrus](https://github.com/NHOrus) 4 | - [Attila Fülöp](https://github.com/AttilaFueloep) 5 | - [Gereon Frey](https://github.com/gfrey) 6 | - [Aaron Bieber](https://github.com/qbit) 7 | - [Ricky Medina](https://github.com/r-medina) 8 | -------------------------------------------------------------------------------- /vendor/github.com/Bowery/prompt/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2013-2015 Bowery, Inc. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /vendor/github.com/Bowery/prompt/README.md: -------------------------------------------------------------------------------- 1 | # Prompt 2 | 3 | [![Circle CI](https://circleci.com/gh/Bowery/prompt/tree/master.png?style=badge)](https://circleci.com/gh/Bowery/prompt/tree/master) 4 | 5 | [![GoDoc](https://godoc.org/github.com/Bowery/prompt?status.png)](https://godoc.org/github.com/Bowery/prompt) 6 | 7 | Prompt is a cross platform line-editing prompting library. Read the GoDoc page 8 | for more info and for API details. 9 | 10 | ## Features 11 | - Keyboard shortcuts in prompts 12 | - History support 13 | - Secure password prompt 14 | - Custom prompt support 15 | - Fallback prompt for unsupported terminals 16 | - ANSI conversion for Windows 17 | 18 | ## Todo 19 | - Multi-line prompt as a Terminal option 20 | - Make refresh less jittery on Windows([possible reason](https://github.com/Bowery/prompt/blob/master/output_windows.go#L108)) 21 | - Multi-byte character support on Windows 22 | - `AnsiWriter` should execute the equivalent ANSI escape code functionality on Windows 23 | - Support for more ANSI escape codes on Windows. 24 | - More keyboard shortcuts from Readlines shortcut list 25 | 26 | ## Contributing 27 | 28 | Make sure Go is setup and running the latest release version, and make sure your `GOPATH` is setup properly. 29 | 30 | Follow the guidelines [here](https://guides.github.com/activities/contributing-to-open-source/#contributing). 31 | 32 | Please be sure to `gofmt` any code before doing commits. You can simply run `gofmt -w .` to format all the code in the directory. 33 | 34 | Lastly don't forget to add your name to [`CONTRIBUTORS.md`](https://github.com/Bowery/prompt/blob/master/CONTRIBUTORS.md) 35 | 36 | ## License 37 | 38 | Prompt is MIT licensed, details can be found [here](https://raw.githubusercontent.com/Bowery/prompt/master/LICENSE). 39 | -------------------------------------------------------------------------------- /vendor/github.com/Bowery/prompt/ansi_unix.go: -------------------------------------------------------------------------------- 1 | // +build linux darwin freebsd openbsd netbsd dragonfly solaris 2 | 3 | // Copyright 2013-2015 Bowery, Inc. 4 | 5 | package prompt 6 | 7 | import ( 8 | "os" 9 | ) 10 | 11 | // AnsiReader is an io.Reader that wraps an *os.File. 12 | type AnsiReader struct { 13 | file *os.File 14 | } 15 | 16 | // NewAnsiReader creates a AnsiReader from the given input file. 17 | func NewAnsiReader(in *os.File) *AnsiReader { 18 | return &AnsiReader{file: in} 19 | } 20 | 21 | // Read reads data from the input file into b. 22 | func (ar *AnsiReader) Read(b []byte) (int, error) { 23 | return ar.file.Read(b) 24 | } 25 | 26 | // AnsiWriter is an io.Writer that wraps an *os.File. 27 | type AnsiWriter struct { 28 | file *os.File 29 | } 30 | 31 | // NewAnsiWriter creates a AnsiWriter from the given output file. 32 | func NewAnsiWriter(out *os.File) *AnsiWriter { 33 | return &AnsiWriter{file: out} 34 | } 35 | 36 | // Write writes data from b into the input file. 37 | func (aw *AnsiWriter) Write(b []byte) (int, error) { 38 | return aw.file.Write(b) 39 | } 40 | -------------------------------------------------------------------------------- /vendor/github.com/Bowery/prompt/buffer_unix.go: -------------------------------------------------------------------------------- 1 | // +build linux darwin freebsd openbsd netbsd dragonfly solaris 2 | 3 | // Copyright 2013-2015 Bowery, Inc. 4 | 5 | package prompt 6 | 7 | import ( 8 | "fmt" 9 | ) 10 | 11 | // Refresh rewrites the prompt and buffer. 12 | func (buf *Buffer) Refresh() error { 13 | // If we're not echoing just write prompt. 14 | if !buf.Echo { 15 | _, err := buf.Out.Write(mvLeftEdge) 16 | if err != nil { 17 | return err 18 | } 19 | 20 | _, err = buf.Out.Write([]byte(buf.Prompt)) 21 | if err != nil { 22 | return err 23 | } 24 | 25 | _, err = buf.Out.Write(delRight) 26 | return err 27 | } 28 | 29 | prLen := len(buf.Prompt) 30 | start := 0 31 | size := buf.size 32 | pos := buf.pos 33 | 34 | // Get slice range that should be visible. 35 | for prLen+pos >= buf.Cols { 36 | start++ 37 | size-- 38 | pos-- 39 | } 40 | for prLen+size > buf.Cols { 41 | size-- 42 | } 43 | 44 | _, err := buf.Out.Write(mvLeftEdge) 45 | if err != nil { 46 | return err 47 | } 48 | 49 | _, err = buf.Out.Write([]byte(buf.Prompt)) 50 | if err != nil { 51 | return err 52 | } 53 | 54 | _, err = buf.Out.Write(toBytes(buf.data[start : size+start])) 55 | if err != nil { 56 | return err 57 | } 58 | 59 | _, err = buf.Out.Write(delRight) 60 | if err != nil { 61 | return err 62 | } 63 | 64 | _, err = buf.Out.Write([]byte(fmt.Sprintf(mvToCol, pos+prLen))) 65 | return err 66 | } 67 | 68 | // ClsScreen clears the screen and refreshes. 69 | func (buf *Buffer) ClsScreen() error { 70 | _, err := buf.Out.Write(clsScreen) 71 | if err != nil { 72 | return err 73 | } 74 | 75 | return buf.Refresh() 76 | } 77 | -------------------------------------------------------------------------------- /vendor/github.com/Bowery/prompt/ioctl_bsd.go: -------------------------------------------------------------------------------- 1 | // +build darwin freebsd openbsd netbsd dragonfly 2 | 3 | // Copyright 2013-2015 Bowery, Inc. 4 | 5 | package prompt 6 | 7 | import ( 8 | "golang.org/x/sys/unix" 9 | ) 10 | 11 | const ( 12 | tcgets = unix.TIOCGETA 13 | tcsets = unix.TIOCSETA 14 | tcsetsf = unix.TIOCSETAF 15 | ) 16 | -------------------------------------------------------------------------------- /vendor/github.com/Bowery/prompt/ioctl_linux.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013-2015 Bowery, Inc. 2 | 3 | package prompt 4 | 5 | import ( 6 | "golang.org/x/sys/unix" 7 | ) 8 | 9 | const ( 10 | tcgets = unix.TCGETS 11 | tcsets = unix.TCSETS 12 | tcsetsf = unix.TCSETSF 13 | ) 14 | -------------------------------------------------------------------------------- /vendor/github.com/Bowery/prompt/ioctl_solaris.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013-2015 Bowery, Inc. 2 | 3 | package prompt 4 | 5 | import ( 6 | "os" 7 | 8 | "golang.org/x/sys/unix" 9 | ) 10 | 11 | const ( 12 | tcgets = unix.TCGETS 13 | tcsetsf = unix.TCSETSF 14 | tcsets = unix.TCSETS 15 | ) 16 | 17 | // terminalSize retrieves the cols/rows for the terminal connected to out. 18 | func terminalSize(out *os.File) (int, int, error) { 19 | ws, err := unix.IoctlGetWinsize(int(out.Fd()), unix.TIOCGWINSZ) 20 | if err != nil { 21 | return 0, 0, err 22 | } 23 | 24 | return int(ws.Col), int(ws.Row), nil 25 | } 26 | 27 | // getTermios retrieves the termios settings for the terminal descriptor. 28 | func getTermios(fd uintptr) (*unix.Termios, error) { 29 | return unix.IoctlGetTermios(int(fd), tcgets) 30 | } 31 | 32 | // setTermios sets the termios settings for the terminal descriptor, 33 | // optionally flushing the buffer before setting. 34 | func setTermios(fd uintptr, flush bool, mode *unix.Termios) error { 35 | req := tcsets 36 | if flush { 37 | req = tcsetsf 38 | } 39 | 40 | return unix.IoctlSetTermios(int(fd), req, mode) 41 | } 42 | -------------------------------------------------------------------------------- /vendor/github.com/Bowery/prompt/ioctl_unix.go: -------------------------------------------------------------------------------- 1 | // +build linux darwin freebsd openbsd netbsd dragonfly 2 | 3 | // Copyright 2013-2015 Bowery, Inc. 4 | 5 | package prompt 6 | 7 | import ( 8 | "os" 9 | "unsafe" 10 | 11 | "golang.org/x/sys/unix" 12 | ) 13 | 14 | // winsize contains the size for the terminal. 15 | type winsize struct { 16 | rows uint16 17 | cols uint16 18 | _ uint32 19 | } 20 | 21 | // terminalSize retrieves the cols/rows for the terminal connected to out. 22 | func terminalSize(out *os.File) (int, int, error) { 23 | ws := new(winsize) 24 | 25 | _, _, err := unix.Syscall(unix.SYS_IOCTL, out.Fd(), 26 | uintptr(unix.TIOCGWINSZ), uintptr(unsafe.Pointer(ws))) 27 | if err != 0 { 28 | return 0, 0, err 29 | } 30 | 31 | return int(ws.cols), int(ws.rows), nil 32 | } 33 | 34 | // getTermios retrieves the termios settings for the terminal descriptor. 35 | func getTermios(fd uintptr) (*unix.Termios, error) { 36 | termios := new(unix.Termios) 37 | 38 | _, _, err := unix.Syscall(unix.SYS_IOCTL, fd, tcgets, 39 | uintptr(unsafe.Pointer(termios))) 40 | if err != 0 { 41 | return nil, err 42 | } 43 | 44 | return termios, nil 45 | } 46 | 47 | // setTermios sets the termios settings for the terminal descriptor, 48 | // optionally flushing the buffer before setting. 49 | func setTermios(fd uintptr, flush bool, mode *unix.Termios) error { 50 | req := int64(tcsets) 51 | if flush { 52 | req = int64(tcsetsf) 53 | } 54 | 55 | _, _, err := unix.Syscall(unix.SYS_IOCTL, fd, uintptr(req), 56 | uintptr(unsafe.Pointer(mode))) 57 | if err != 0 { 58 | return err 59 | } 60 | 61 | return nil 62 | } 63 | -------------------------------------------------------------------------------- /vendor/github.com/Bowery/prompt/keys.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013-2015 Bowery, Inc. 2 | 3 | package prompt 4 | 5 | // Line ending in raw mode. 6 | var crlf = []byte("\r\n") 7 | 8 | const ( 9 | backKey = '\u007f' 10 | escKey = '\u001B' 11 | spaceKey = '\u0020' 12 | ) 13 | 14 | const ( 15 | ctrlA = iota + 1 16 | ctrlB 17 | ctrlC 18 | ctrlD 19 | ctrlE 20 | ctrlF 21 | ctrlG 22 | ctrlH 23 | tabKey 24 | ctrlJ 25 | ctrlK 26 | ctrlL 27 | returnKey 28 | ctrlN 29 | ctrlO 30 | ctrlP 31 | ctrlQ 32 | ctrlR 33 | ctrlS 34 | ctrlT 35 | ctrlU 36 | ctrlV 37 | ctrlW 38 | ctrlX 39 | ctrlY 40 | ctrlZ 41 | ) 42 | -------------------------------------------------------------------------------- /vendor/github.com/Bowery/prompt/keys_unix.go: -------------------------------------------------------------------------------- 1 | // +build linux darwin freebsd openbsd netbsd dragonfly solaris 2 | 3 | // Copyright 2013-2015 Bowery, Inc. 4 | 5 | package prompt 6 | 7 | const mvToCol = "\u001b[0G\u001b[%dC" 8 | 9 | var ( 10 | mvLeftEdge = []byte("\u001b[0G") 11 | clsScreen = []byte("\u001b[H\u001b[2J") 12 | delRight = []byte("\u001b[0K") 13 | ) 14 | -------------------------------------------------------------------------------- /vendor/github.com/Bowery/prompt/keys_windows.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013-2015 Bowery, Inc. 2 | 3 | package prompt 4 | 5 | const ( 6 | f1Key = 0x70 + iota 7 | f2Key 8 | f3Key 9 | f4Key 10 | f5Key 11 | f6Key 12 | f7Key 13 | f8Key 14 | f9Key 15 | f10Key 16 | f11Key 17 | f12Key 18 | 19 | homeKey = 0x24 20 | endKey = 0x23 21 | upKey = 0x26 22 | downKey = 0x28 23 | rightKey = 0x27 24 | leftKey = 0x25 25 | insertKey = 0x2d 26 | pgupKey = 0x21 27 | pgdownKey = 0x22 28 | deleteKey = 0x2e 29 | leftAltKey = 0x2 30 | rightAltKey = 0x1 31 | leftCtrlKey = 0x8 32 | rightCtrlKey = 0x4 33 | shiftKey = 0x10 34 | ) 35 | -------------------------------------------------------------------------------- /vendor/github.com/Bowery/prompt/term_unix.go: -------------------------------------------------------------------------------- 1 | // +build linux darwin freebsd openbsd netbsd dragonfly solaris 2 | 3 | // Copyright 2013-2015 Bowery, Inc. 4 | 5 | package prompt 6 | 7 | import ( 8 | "os" 9 | 10 | "golang.org/x/sys/unix" 11 | ) 12 | 13 | // List of unsupported $TERM values. 14 | var unsupported = []string{"", "dumb", "cons25"} 15 | 16 | // supportsEditing checks if the terminal supports ansi escapes. 17 | func supportsEditing() bool { 18 | term := os.Getenv("TERM") 19 | 20 | for _, t := range unsupported { 21 | if t == term { 22 | return false 23 | } 24 | } 25 | 26 | return true 27 | } 28 | 29 | // isNotTerminal checks if an error is related to the input not being a terminal. 30 | func isNotTerminal(err error) bool { 31 | return err == unix.ENOTTY 32 | } 33 | 34 | // terminal contains the private fields for a Unix terminal. 35 | type terminal struct { 36 | supportsEditing bool 37 | fd uintptr 38 | origMode unix.Termios 39 | } 40 | 41 | // newTerminal creates a terminal and sets it to raw input mode. 42 | func newTerminal(in *os.File) (*terminal, error) { 43 | term := &terminal{fd: in.Fd()} 44 | 45 | if !supportsEditing() { 46 | return term, nil 47 | } 48 | 49 | t, err := getTermios(term.fd) 50 | if err != nil { 51 | if IsNotTerminal(err) { 52 | return term, nil 53 | } 54 | 55 | return nil, err 56 | } 57 | term.origMode = *t 58 | mode := term.origMode 59 | term.supportsEditing = true 60 | 61 | // Set new mode flags, for reference see cfmakeraw(3). 62 | mode.Iflag &^= (unix.BRKINT | unix.IGNBRK | unix.ICRNL | 63 | unix.INLCR | unix.IGNCR | unix.ISTRIP | unix.IXON | 64 | unix.PARMRK) 65 | 66 | mode.Oflag &^= unix.OPOST 67 | 68 | mode.Lflag &^= (unix.ECHO | unix.ECHONL | unix.ICANON | 69 | unix.ISIG | unix.IEXTEN) 70 | 71 | mode.Cflag &^= (unix.CSIZE | unix.PARENB) 72 | mode.Cflag |= unix.CS8 73 | 74 | // Set controls; min num of bytes, and timeouts. 75 | mode.Cc[unix.VMIN] = 1 76 | mode.Cc[unix.VTIME] = 0 77 | 78 | err = setTermios(term.fd, true, &mode) 79 | if err != nil { 80 | return nil, err 81 | } 82 | 83 | return term, nil 84 | } 85 | 86 | // Close disables the terminals raw input. 87 | func (term *terminal) Close() error { 88 | if term.supportsEditing { 89 | err := setTermios(term.fd, false, &term.origMode) 90 | if err != nil { 91 | return err 92 | } 93 | } 94 | 95 | return nil 96 | } 97 | -------------------------------------------------------------------------------- /vendor/github.com/PuerkitoBio/purell/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2012, Martin Angers 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 5 | 6 | * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 7 | 8 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 9 | 10 | * Neither the name of the author nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. 11 | 12 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 13 | -------------------------------------------------------------------------------- /vendor/github.com/PuerkitoBio/urlesc/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2012 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/github.com/PuerkitoBio/urlesc/README.md: -------------------------------------------------------------------------------- 1 | urlesc [![Build Status](https://travis-ci.org/PuerkitoBio/urlesc.png?branch=master)](https://travis-ci.org/PuerkitoBio/urlesc) [![GoDoc](http://godoc.org/github.com/PuerkitoBio/urlesc?status.svg)](http://godoc.org/github.com/PuerkitoBio/urlesc) 2 | ====== 3 | 4 | Package urlesc implements query escaping as per RFC 3986. 5 | 6 | It contains some parts of the net/url package, modified so as to allow 7 | some reserved characters incorrectly escaped by net/url (see [issue 5684](https://github.com/golang/go/issues/5684)). 8 | 9 | ## Install 10 | 11 | go get github.com/PuerkitoBio/urlesc 12 | 13 | ## License 14 | 15 | Go license (BSD-3-Clause) 16 | 17 | -------------------------------------------------------------------------------- /vendor/github.com/dgrijalva/jwt-go/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2012 Dave Grijalva 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 4 | 5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 6 | 7 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 8 | 9 | -------------------------------------------------------------------------------- /vendor/github.com/dgrijalva/jwt-go/doc.go: -------------------------------------------------------------------------------- 1 | // Package jwt is a Go implementation of JSON Web Tokens: http://self-issued.info/docs/draft-jones-json-web-token.html 2 | // 3 | // See README.md for more info. 4 | package jwt 5 | -------------------------------------------------------------------------------- /vendor/github.com/dgrijalva/jwt-go/ecdsa_utils.go: -------------------------------------------------------------------------------- 1 | package jwt 2 | 3 | import ( 4 | "crypto/ecdsa" 5 | "crypto/x509" 6 | "encoding/pem" 7 | "errors" 8 | ) 9 | 10 | var ( 11 | ErrNotECPublicKey = errors.New("Key is not a valid ECDSA public key") 12 | ErrNotECPrivateKey = errors.New("Key is not a valid ECDSA private key") 13 | ) 14 | 15 | // Parse PEM encoded Elliptic Curve Private Key Structure 16 | func ParseECPrivateKeyFromPEM(key []byte) (*ecdsa.PrivateKey, error) { 17 | var err error 18 | 19 | // Parse PEM block 20 | var block *pem.Block 21 | if block, _ = pem.Decode(key); block == nil { 22 | return nil, ErrKeyMustBePEMEncoded 23 | } 24 | 25 | // Parse the key 26 | var parsedKey interface{} 27 | if parsedKey, err = x509.ParseECPrivateKey(block.Bytes); err != nil { 28 | return nil, err 29 | } 30 | 31 | var pkey *ecdsa.PrivateKey 32 | var ok bool 33 | if pkey, ok = parsedKey.(*ecdsa.PrivateKey); !ok { 34 | return nil, ErrNotECPrivateKey 35 | } 36 | 37 | return pkey, nil 38 | } 39 | 40 | // Parse PEM encoded PKCS1 or PKCS8 public key 41 | func ParseECPublicKeyFromPEM(key []byte) (*ecdsa.PublicKey, error) { 42 | var err error 43 | 44 | // Parse PEM block 45 | var block *pem.Block 46 | if block, _ = pem.Decode(key); block == nil { 47 | return nil, ErrKeyMustBePEMEncoded 48 | } 49 | 50 | // Parse the key 51 | var parsedKey interface{} 52 | if parsedKey, err = x509.ParsePKIXPublicKey(block.Bytes); err != nil { 53 | if cert, err := x509.ParseCertificate(block.Bytes); err == nil { 54 | parsedKey = cert.PublicKey 55 | } else { 56 | return nil, err 57 | } 58 | } 59 | 60 | var pkey *ecdsa.PublicKey 61 | var ok bool 62 | if pkey, ok = parsedKey.(*ecdsa.PublicKey); !ok { 63 | return nil, ErrNotECPublicKey 64 | } 65 | 66 | return pkey, nil 67 | } 68 | -------------------------------------------------------------------------------- /vendor/github.com/dgrijalva/jwt-go/errors.go: -------------------------------------------------------------------------------- 1 | package jwt 2 | 3 | import ( 4 | "errors" 5 | ) 6 | 7 | // Error constants 8 | var ( 9 | ErrInvalidKey = errors.New("key is invalid") 10 | ErrInvalidKeyType = errors.New("key is of invalid type") 11 | ErrHashUnavailable = errors.New("the requested hash function is unavailable") 12 | ) 13 | 14 | // The errors that might occur when parsing and validating a token 15 | const ( 16 | ValidationErrorMalformed uint32 = 1 << iota // Token is malformed 17 | ValidationErrorUnverifiable // Token could not be verified because of signing problems 18 | ValidationErrorSignatureInvalid // Signature validation failed 19 | 20 | // Standard Claim validation errors 21 | ValidationErrorAudience // AUD validation failed 22 | ValidationErrorExpired // EXP validation failed 23 | ValidationErrorIssuedAt // IAT validation failed 24 | ValidationErrorIssuer // ISS validation failed 25 | ValidationErrorNotValidYet // NBF validation failed 26 | ValidationErrorId // JTI validation failed 27 | ValidationErrorClaimsInvalid // Generic claims validation error 28 | ) 29 | 30 | // Helper for constructing a ValidationError with a string error message 31 | func NewValidationError(errorText string, errorFlags uint32) *ValidationError { 32 | return &ValidationError{ 33 | text: errorText, 34 | Errors: errorFlags, 35 | } 36 | } 37 | 38 | // The error from Parse if token is not valid 39 | type ValidationError struct { 40 | Inner error // stores the error returned by external dependencies, i.e.: KeyFunc 41 | Errors uint32 // bitfield. see ValidationError... constants 42 | text string // errors that do not have a valid error just have text 43 | } 44 | 45 | // Validation error is an error type 46 | func (e ValidationError) Error() string { 47 | if e.Inner != nil { 48 | return e.Inner.Error() 49 | } else if e.text != "" { 50 | return e.text 51 | } else { 52 | return "token is invalid" 53 | } 54 | } 55 | 56 | // No errors 57 | func (e *ValidationError) valid() bool { 58 | return e.Errors == 0 59 | } 60 | -------------------------------------------------------------------------------- /vendor/github.com/dgrijalva/jwt-go/none.go: -------------------------------------------------------------------------------- 1 | package jwt 2 | 3 | // Implements the none signing method. This is required by the spec 4 | // but you probably should never use it. 5 | var SigningMethodNone *signingMethodNone 6 | 7 | const UnsafeAllowNoneSignatureType unsafeNoneMagicConstant = "none signing method allowed" 8 | 9 | var NoneSignatureTypeDisallowedError error 10 | 11 | type signingMethodNone struct{} 12 | type unsafeNoneMagicConstant string 13 | 14 | func init() { 15 | SigningMethodNone = &signingMethodNone{} 16 | NoneSignatureTypeDisallowedError = NewValidationError("'none' signature type is not allowed", ValidationErrorSignatureInvalid) 17 | 18 | RegisterSigningMethod(SigningMethodNone.Alg(), func() SigningMethod { 19 | return SigningMethodNone 20 | }) 21 | } 22 | 23 | func (m *signingMethodNone) Alg() string { 24 | return "none" 25 | } 26 | 27 | // Only allow 'none' alg type if UnsafeAllowNoneSignatureType is specified as the key 28 | func (m *signingMethodNone) Verify(signingString, signature string, key interface{}) (err error) { 29 | // Key must be UnsafeAllowNoneSignatureType to prevent accidentally 30 | // accepting 'none' signing method 31 | if _, ok := key.(unsafeNoneMagicConstant); !ok { 32 | return NoneSignatureTypeDisallowedError 33 | } 34 | // If signing method is none, signature must be an empty string 35 | if signature != "" { 36 | return NewValidationError( 37 | "'none' signing method with non-empty signature", 38 | ValidationErrorSignatureInvalid, 39 | ) 40 | } 41 | 42 | // Accept 'none' signing method. 43 | return nil 44 | } 45 | 46 | // Only allow 'none' signing if UnsafeAllowNoneSignatureType is specified as the key 47 | func (m *signingMethodNone) Sign(signingString string, key interface{}) (string, error) { 48 | if _, ok := key.(unsafeNoneMagicConstant); ok { 49 | return "", nil 50 | } 51 | return "", NoneSignatureTypeDisallowedError 52 | } 53 | -------------------------------------------------------------------------------- /vendor/github.com/dgrijalva/jwt-go/rsa_utils.go: -------------------------------------------------------------------------------- 1 | package jwt 2 | 3 | import ( 4 | "crypto/rsa" 5 | "crypto/x509" 6 | "encoding/pem" 7 | "errors" 8 | ) 9 | 10 | var ( 11 | ErrKeyMustBePEMEncoded = errors.New("Invalid Key: Key must be PEM encoded PKCS1 or PKCS8 private key") 12 | ErrNotRSAPrivateKey = errors.New("Key is not a valid RSA private key") 13 | ErrNotRSAPublicKey = errors.New("Key is not a valid RSA public key") 14 | ) 15 | 16 | // Parse PEM encoded PKCS1 or PKCS8 private key 17 | func ParseRSAPrivateKeyFromPEM(key []byte) (*rsa.PrivateKey, error) { 18 | var err error 19 | 20 | // Parse PEM block 21 | var block *pem.Block 22 | if block, _ = pem.Decode(key); block == nil { 23 | return nil, ErrKeyMustBePEMEncoded 24 | } 25 | 26 | var parsedKey interface{} 27 | if parsedKey, err = x509.ParsePKCS1PrivateKey(block.Bytes); err != nil { 28 | if parsedKey, err = x509.ParsePKCS8PrivateKey(block.Bytes); err != nil { 29 | return nil, err 30 | } 31 | } 32 | 33 | var pkey *rsa.PrivateKey 34 | var ok bool 35 | if pkey, ok = parsedKey.(*rsa.PrivateKey); !ok { 36 | return nil, ErrNotRSAPrivateKey 37 | } 38 | 39 | return pkey, nil 40 | } 41 | 42 | // Parse PEM encoded PKCS1 or PKCS8 public key 43 | func ParseRSAPublicKeyFromPEM(key []byte) (*rsa.PublicKey, error) { 44 | var err error 45 | 46 | // Parse PEM block 47 | var block *pem.Block 48 | if block, _ = pem.Decode(key); block == nil { 49 | return nil, ErrKeyMustBePEMEncoded 50 | } 51 | 52 | // Parse the key 53 | var parsedKey interface{} 54 | if parsedKey, err = x509.ParsePKIXPublicKey(block.Bytes); err != nil { 55 | if cert, err := x509.ParseCertificate(block.Bytes); err == nil { 56 | parsedKey = cert.PublicKey 57 | } else { 58 | return nil, err 59 | } 60 | } 61 | 62 | var pkey *rsa.PublicKey 63 | var ok bool 64 | if pkey, ok = parsedKey.(*rsa.PublicKey); !ok { 65 | return nil, ErrNotRSAPublicKey 66 | } 67 | 68 | return pkey, nil 69 | } 70 | -------------------------------------------------------------------------------- /vendor/github.com/dgrijalva/jwt-go/signing_method.go: -------------------------------------------------------------------------------- 1 | package jwt 2 | 3 | import ( 4 | "sync" 5 | ) 6 | 7 | var signingMethods = map[string]func() SigningMethod{} 8 | var signingMethodLock = new(sync.RWMutex) 9 | 10 | // Implement SigningMethod to add new methods for signing or verifying tokens. 11 | type SigningMethod interface { 12 | Verify(signingString, signature string, key interface{}) error // Returns nil if signature is valid 13 | Sign(signingString string, key interface{}) (string, error) // Returns encoded signature or error 14 | Alg() string // returns the alg identifier for this method (example: 'HS256') 15 | } 16 | 17 | // Register the "alg" name and a factory function for signing method. 18 | // This is typically done during init() in the method's implementation 19 | func RegisterSigningMethod(alg string, f func() SigningMethod) { 20 | signingMethodLock.Lock() 21 | defer signingMethodLock.Unlock() 22 | 23 | signingMethods[alg] = f 24 | } 25 | 26 | // Get a signing method from an "alg" string 27 | func GetSigningMethod(alg string) (method SigningMethod) { 28 | signingMethodLock.RLock() 29 | defer signingMethodLock.RUnlock() 30 | 31 | if methodF, ok := signingMethods[alg]; ok { 32 | method = methodF() 33 | } 34 | return 35 | } 36 | -------------------------------------------------------------------------------- /vendor/github.com/go-openapi/jsonpointer/README.md: -------------------------------------------------------------------------------- 1 | # gojsonpointer [![Build Status](https://travis-ci.org/go-openapi/jsonpointer.svg?branch=master)](https://travis-ci.org/go-openapi/jsonpointer) [![codecov](https://codecov.io/gh/go-openapi/jsonpointer/branch/master/graph/badge.svg)](https://codecov.io/gh/go-openapi/jsonpointer) [![Slack Status](https://slackin.goswagger.io/badge.svg)](https://slackin.goswagger.io) 2 | 3 | [![license](http://img.shields.io/badge/license-Apache%20v2-orange.svg)](https://raw.githubusercontent.com/go-openapi/jsonpointer/master/LICENSE) [![GoDoc](https://godoc.org/github.com/go-openapi/jsonpointer?status.svg)](http://godoc.org/github.com/go-openapi/jsonpointer) 4 | An implementation of JSON Pointer - Go language 5 | 6 | ## Status 7 | Completed YES 8 | 9 | Tested YES 10 | 11 | ## References 12 | http://tools.ietf.org/html/draft-ietf-appsawg-json-pointer-07 13 | 14 | ### Note 15 | The 4.Evaluation part of the previous reference, starting with 'If the currently referenced value is a JSON array, the reference token MUST contain either...' is not implemented. 16 | -------------------------------------------------------------------------------- /vendor/github.com/go-openapi/jsonreference/README.md: -------------------------------------------------------------------------------- 1 | # gojsonreference [![Build Status](https://travis-ci.org/go-openapi/jsonreference.svg?branch=master)](https://travis-ci.org/go-openapi/jsonreference) [![codecov](https://codecov.io/gh/go-openapi/jsonreference/branch/master/graph/badge.svg)](https://codecov.io/gh/go-openapi/jsonreference) [![Slack Status](https://slackin.goswagger.io/badge.svg)](https://slackin.goswagger.io) 2 | 3 | [![license](http://img.shields.io/badge/license-Apache%20v2-orange.svg)](https://raw.githubusercontent.com/go-openapi/jsonreference/master/LICENSE) [![GoDoc](https://godoc.org/github.com/go-openapi/jsonreference?status.svg)](http://godoc.org/github.com/go-openapi/jsonreference) 4 | An implementation of JSON Reference - Go language 5 | 6 | ## Status 7 | Work in progress ( 90% done ) 8 | 9 | ## Dependencies 10 | https://github.com/go-openapi/jsonpointer 11 | 12 | ## References 13 | http://tools.ietf.org/html/draft-ietf-appsawg-json-pointer-07 14 | 15 | http://tools.ietf.org/html/draft-pbryan-zyp-json-ref-03 16 | -------------------------------------------------------------------------------- /vendor/github.com/go-openapi/spec/README.md: -------------------------------------------------------------------------------- 1 | # OAI object model [![Build Status](https://travis-ci.org/go-openapi/spec.svg?branch=master)](https://travis-ci.org/go-openapi/spec) [![codecov](https://codecov.io/gh/go-openapi/spec/branch/master/graph/badge.svg)](https://codecov.io/gh/go-openapi/spec) [![Slack Status](https://slackin.goswagger.io/badge.svg)](https://slackin.goswagger.io) 2 | 3 | [![license](http://img.shields.io/badge/license-Apache%20v2-orange.svg)](https://raw.githubusercontent.com/go-openapi/spec/master/LICENSE) [![GoDoc](https://godoc.org/github.com/go-openapi/spec?status.svg)](http://godoc.org/github.com/go-openapi/spec) 4 | 5 | The object model for OpenAPI specification documents 6 | -------------------------------------------------------------------------------- /vendor/github.com/go-openapi/spec/contact_info.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 go-swagger maintainers 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package spec 16 | 17 | // ContactInfo contact information for the exposed API. 18 | // 19 | // For more information: http://goo.gl/8us55a#contactObject 20 | type ContactInfo struct { 21 | Name string `json:"name,omitempty"` 22 | URL string `json:"url,omitempty"` 23 | Email string `json:"email,omitempty"` 24 | } 25 | -------------------------------------------------------------------------------- /vendor/github.com/go-openapi/spec/external_docs.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 go-swagger maintainers 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package spec 16 | 17 | // ExternalDocumentation allows referencing an external resource for 18 | // extended documentation. 19 | // 20 | // For more information: http://goo.gl/8us55a#externalDocumentationObject 21 | type ExternalDocumentation struct { 22 | Description string `json:"description,omitempty"` 23 | URL string `json:"url,omitempty"` 24 | } 25 | -------------------------------------------------------------------------------- /vendor/github.com/go-openapi/spec/license.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 go-swagger maintainers 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package spec 16 | 17 | // License information for the exposed API. 18 | // 19 | // For more information: http://goo.gl/8us55a#licenseObject 20 | type License struct { 21 | Name string `json:"name,omitempty"` 22 | URL string `json:"url,omitempty"` 23 | } 24 | -------------------------------------------------------------------------------- /vendor/github.com/go-openapi/spec/tag.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 go-swagger maintainers 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package spec 16 | 17 | import ( 18 | "encoding/json" 19 | 20 | "github.com/go-openapi/jsonpointer" 21 | "github.com/go-openapi/swag" 22 | ) 23 | 24 | type TagProps struct { 25 | Description string `json:"description,omitempty"` 26 | Name string `json:"name,omitempty"` 27 | ExternalDocs *ExternalDocumentation `json:"externalDocs,omitempty"` 28 | } 29 | 30 | // NewTag creates a new tag 31 | func NewTag(name, description string, externalDocs *ExternalDocumentation) Tag { 32 | return Tag{TagProps: TagProps{description, name, externalDocs}} 33 | } 34 | 35 | // Tag allows adding meta data to a single tag that is used by the [Operation Object](http://goo.gl/8us55a#operationObject). 36 | // It is not mandatory to have a Tag Object per tag used there. 37 | // 38 | // For more information: http://goo.gl/8us55a#tagObject 39 | type Tag struct { 40 | VendorExtensible 41 | TagProps 42 | } 43 | 44 | // JSONLookup implements an interface to customize json pointer lookup 45 | func (t Tag) JSONLookup(token string) (interface{}, error) { 46 | if ex, ok := t.Extensions[token]; ok { 47 | return &ex, nil 48 | } 49 | 50 | r, _, err := jsonpointer.GetForToken(t.TagProps, token) 51 | return r, err 52 | } 53 | 54 | // MarshalJSON marshal this to JSON 55 | func (t Tag) MarshalJSON() ([]byte, error) { 56 | b1, err := json.Marshal(t.TagProps) 57 | if err != nil { 58 | return nil, err 59 | } 60 | b2, err := json.Marshal(t.VendorExtensible) 61 | if err != nil { 62 | return nil, err 63 | } 64 | return swag.ConcatJSON(b1, b2), nil 65 | } 66 | 67 | // UnmarshalJSON marshal this from JSON 68 | func (t *Tag) UnmarshalJSON(data []byte) error { 69 | if err := json.Unmarshal(data, &t.TagProps); err != nil { 70 | return err 71 | } 72 | return json.Unmarshal(data, &t.VendorExtensible) 73 | } 74 | -------------------------------------------------------------------------------- /vendor/github.com/go-openapi/spec/xml_object.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 go-swagger maintainers 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package spec 16 | 17 | // XMLObject a metadata object that allows for more fine-tuned XML model definitions. 18 | // 19 | // For more information: http://goo.gl/8us55a#xmlObject 20 | type XMLObject struct { 21 | Name string `json:"name,omitempty"` 22 | Namespace string `json:"namespace,omitempty"` 23 | Prefix string `json:"prefix,omitempty"` 24 | Attribute bool `json:"attribute,omitempty"` 25 | Wrapped bool `json:"wrapped,omitempty"` 26 | } 27 | 28 | // WithName sets the xml name for the object 29 | func (x *XMLObject) WithName(name string) *XMLObject { 30 | x.Name = name 31 | return x 32 | } 33 | 34 | // WithNamespace sets the xml namespace for the object 35 | func (x *XMLObject) WithNamespace(namespace string) *XMLObject { 36 | x.Namespace = namespace 37 | return x 38 | } 39 | 40 | // WithPrefix sets the xml prefix for the object 41 | func (x *XMLObject) WithPrefix(prefix string) *XMLObject { 42 | x.Prefix = prefix 43 | return x 44 | } 45 | 46 | // AsAttribute flags this object as xml attribute 47 | func (x *XMLObject) AsAttribute() *XMLObject { 48 | x.Attribute = true 49 | return x 50 | } 51 | 52 | // AsElement flags this object as an xml node 53 | func (x *XMLObject) AsElement() *XMLObject { 54 | x.Attribute = false 55 | return x 56 | } 57 | 58 | // AsWrapped flags this object as wrapped, this is mostly useful for array types 59 | func (x *XMLObject) AsWrapped() *XMLObject { 60 | x.Wrapped = true 61 | return x 62 | } 63 | 64 | // AsUnwrapped flags this object as an xml node 65 | func (x *XMLObject) AsUnwrapped() *XMLObject { 66 | x.Wrapped = false 67 | return x 68 | } 69 | -------------------------------------------------------------------------------- /vendor/github.com/go-openapi/swag/README.md: -------------------------------------------------------------------------------- 1 | # Swag [![Build Status](https://travis-ci.org/go-openapi/swag.svg?branch=master)](https://travis-ci.org/go-openapi/swag) [![codecov](https://codecov.io/gh/go-openapi/swag/branch/master/graph/badge.svg)](https://codecov.io/gh/go-openapi/swag) [![Slack Status](https://slackin.goswagger.io/badge.svg)](https://slackin.goswagger.io) 2 | 3 | [![license](http://img.shields.io/badge/license-Apache%20v2-orange.svg)](https://raw.githubusercontent.com/go-openapi/swag/master/LICENSE) [![GoDoc](https://godoc.org/github.com/go-openapi/swag?status.svg)](http://godoc.org/github.com/go-openapi/swag) 4 | 5 | Contains a bunch of helper functions: 6 | 7 | * convert between value and pointers for builtins 8 | * convert from string to builtin 9 | * fast json concatenation 10 | * search in path 11 | * load from file or http 12 | * name manglin -------------------------------------------------------------------------------- /vendor/github.com/go-openapi/swag/net.go: -------------------------------------------------------------------------------- 1 | package swag 2 | 3 | import ( 4 | "net" 5 | "strconv" 6 | ) 7 | 8 | // SplitHostPort splits a network address into a host and a port. 9 | // The port is -1 when there is no port to be found 10 | func SplitHostPort(addr string) (host string, port int, err error) { 11 | h, p, err := net.SplitHostPort(addr) 12 | if err != nil { 13 | return "", -1, err 14 | } 15 | if p == "" { 16 | return "", -1, &net.AddrError{Err: "missing port in address", Addr: addr} 17 | } 18 | 19 | pi, err := strconv.Atoi(p) 20 | if err != nil { 21 | return "", -1, err 22 | } 23 | return h, pi, nil 24 | } 25 | -------------------------------------------------------------------------------- /vendor/github.com/go-openapi/swag/path.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 go-swagger maintainers 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package swag 16 | 17 | import ( 18 | "os" 19 | "path/filepath" 20 | "runtime" 21 | "strings" 22 | ) 23 | 24 | const ( 25 | // GOPATHKey represents the env key for gopath 26 | GOPATHKey = "GOPATH" 27 | ) 28 | 29 | // FindInSearchPath finds a package in a provided lists of paths 30 | func FindInSearchPath(searchPath, pkg string) string { 31 | pathsList := filepath.SplitList(searchPath) 32 | for _, path := range pathsList { 33 | if evaluatedPath, err := filepath.EvalSymlinks(filepath.Join(path, "src", pkg)); err == nil { 34 | if _, err := os.Stat(evaluatedPath); err == nil { 35 | return evaluatedPath 36 | } 37 | } 38 | } 39 | return "" 40 | } 41 | 42 | // FindInGoSearchPath finds a package in the $GOPATH:$GOROOT 43 | func FindInGoSearchPath(pkg string) string { 44 | return FindInSearchPath(FullGoSearchPath(), pkg) 45 | } 46 | 47 | // FullGoSearchPath gets the search paths for finding packages 48 | func FullGoSearchPath() string { 49 | allPaths := os.Getenv(GOPATHKey) 50 | if allPaths == "" { 51 | allPaths = filepath.Join(os.Getenv("HOME"), "go") 52 | } 53 | if allPaths != "" { 54 | allPaths = strings.Join([]string{allPaths, runtime.GOROOT()}, ":") 55 | } else { 56 | allPaths = runtime.GOROOT() 57 | } 58 | return allPaths 59 | } 60 | -------------------------------------------------------------------------------- /vendor/github.com/go-sql-driver/mysql/AUTHORS: -------------------------------------------------------------------------------- 1 | # This is the official list of Go-MySQL-Driver authors for copyright purposes. 2 | 3 | # If you are submitting a patch, please add your name or the name of the 4 | # organization which holds the copyright to this list in alphabetical order. 5 | 6 | # Names should be added to this file as 7 | # Name 8 | # The email address is not required for organizations. 9 | # Please keep the list sorted. 10 | 11 | 12 | # Individual Persons 13 | 14 | Aaron Hopkins 15 | Arne Hormann 16 | Asta Xie 17 | Carlos Nieto 18 | Chris Moos 19 | Daniel Nichter 20 | Daniël van Eeden 21 | DisposaBoy 22 | Egor Smolyakov 23 | Frederick Mayle 24 | Gustavo Kristic 25 | Hanno Braun 26 | Henri Yandell 27 | Hirotaka Yamamoto 28 | INADA Naoki 29 | Jacek Szwec 30 | James Harr 31 | Jian Zhen 32 | Joshua Prunier 33 | Julien Lefevre 34 | Julien Schmidt 35 | Kamil Dziedzic 36 | Kevin Malachowski 37 | Lennart Rudolph 38 | Leonardo YongUk Kim 39 | Lion Yang 40 | Luca Looz 41 | Lucas Liu 42 | Luke Scott 43 | Michael Woolnough 44 | Nicola Peduzzi 45 | Olivier Mengué 46 | Paul Bonser 47 | Peter Schultz 48 | Runrioter Wung 49 | Soroush Pour 50 | Stan Putrya 51 | Stanley Gunawan 52 | Xiangyu Hu 53 | Xiaobing Jiang 54 | Xiuming Chen 55 | Zhenye Xie 56 | 57 | # Organizations 58 | 59 | Barracuda Networks, Inc. 60 | Google Inc. 61 | Stripe Inc. 62 | -------------------------------------------------------------------------------- /vendor/github.com/go-sql-driver/mysql/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing Guidelines 2 | 3 | ## Reporting Issues 4 | 5 | Before creating a new Issue, please check first if a similar Issue [already exists](https://github.com/go-sql-driver/mysql/issues?state=open) or was [recently closed](https://github.com/go-sql-driver/mysql/issues?direction=desc&page=1&sort=updated&state=closed). 6 | 7 | ## Contributing Code 8 | 9 | By contributing to this project, you share your code under the Mozilla Public License 2, as specified in the LICENSE file. 10 | Don't forget to add yourself to the AUTHORS file. 11 | 12 | ### Code Review 13 | 14 | Everyone is invited to review and comment on pull requests. 15 | If it looks fine to you, comment with "LGTM" (Looks good to me). 16 | 17 | If changes are required, notice the reviewers with "PTAL" (Please take another look) after committing the fixes. 18 | 19 | Before merging the Pull Request, at least one [team member](https://github.com/go-sql-driver?tab=members) must have commented with "LGTM". 20 | 21 | ## Development Ideas 22 | 23 | If you are looking for ideas for code contributions, please check our [Development Ideas](https://github.com/go-sql-driver/mysql/wiki/Development-Ideas) Wiki page. 24 | -------------------------------------------------------------------------------- /vendor/github.com/go-sql-driver/mysql/appengine.go: -------------------------------------------------------------------------------- 1 | // Go MySQL Driver - A MySQL-Driver for Go's database/sql package 2 | // 3 | // Copyright 2013 The Go-MySQL-Driver Authors. All rights reserved. 4 | // 5 | // This Source Code Form is subject to the terms of the Mozilla Public 6 | // License, v. 2.0. If a copy of the MPL was not distributed with this file, 7 | // You can obtain one at http://mozilla.org/MPL/2.0/. 8 | 9 | // +build appengine 10 | 11 | package mysql 12 | 13 | import ( 14 | "appengine/cloudsql" 15 | ) 16 | 17 | func init() { 18 | RegisterDial("cloudsql", cloudsql.Dial) 19 | } 20 | -------------------------------------------------------------------------------- /vendor/github.com/go-sql-driver/mysql/result.go: -------------------------------------------------------------------------------- 1 | // Go MySQL Driver - A MySQL-Driver for Go's database/sql package 2 | // 3 | // Copyright 2012 The Go-MySQL-Driver Authors. All rights reserved. 4 | // 5 | // This Source Code Form is subject to the terms of the Mozilla Public 6 | // License, v. 2.0. If a copy of the MPL was not distributed with this file, 7 | // You can obtain one at http://mozilla.org/MPL/2.0/. 8 | 9 | package mysql 10 | 11 | type mysqlResult struct { 12 | affectedRows int64 13 | insertId int64 14 | } 15 | 16 | func (res *mysqlResult) LastInsertId() (int64, error) { 17 | return res.insertId, nil 18 | } 19 | 20 | func (res *mysqlResult) RowsAffected() (int64, error) { 21 | return res.affectedRows, nil 22 | } 23 | -------------------------------------------------------------------------------- /vendor/github.com/go-sql-driver/mysql/transaction.go: -------------------------------------------------------------------------------- 1 | // Go MySQL Driver - A MySQL-Driver for Go's database/sql package 2 | // 3 | // Copyright 2012 The Go-MySQL-Driver Authors. All rights reserved. 4 | // 5 | // This Source Code Form is subject to the terms of the Mozilla Public 6 | // License, v. 2.0. If a copy of the MPL was not distributed with this file, 7 | // You can obtain one at http://mozilla.org/MPL/2.0/. 8 | 9 | package mysql 10 | 11 | type mysqlTx struct { 12 | mc *mysqlConn 13 | } 14 | 15 | func (tx *mysqlTx) Commit() (err error) { 16 | if tx.mc == nil || tx.mc.netConn == nil { 17 | return ErrInvalidConn 18 | } 19 | err = tx.mc.exec("COMMIT") 20 | tx.mc = nil 21 | return 22 | } 23 | 24 | func (tx *mysqlTx) Rollback() (err error) { 25 | if tx.mc == nil || tx.mc.netConn == nil { 26 | return ErrInvalidConn 27 | } 28 | err = tx.mc.exec("ROLLBACK") 29 | tx.mc = nil 30 | return 31 | } 32 | -------------------------------------------------------------------------------- /vendor/github.com/labstack/echo/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/davecgh/go-spew" 6 | packages = ["spew"] 7 | revision = "346938d642f2ec3594ed81d874461961cd0faa76" 8 | version = "v1.1.0" 9 | 10 | [[projects]] 11 | name = "github.com/dgrijalva/jwt-go" 12 | packages = ["."] 13 | revision = "d2709f9f1f31ebcda9651b03077758c1f3a0018c" 14 | version = "v3.0.0" 15 | 16 | [[projects]] 17 | name = "github.com/labstack/gommon" 18 | packages = ["bytes","color","log","random"] 19 | revision = "1121fd3e243c202482226a7afe4dcd07ffc4139a" 20 | version = "v0.2.1" 21 | 22 | [[projects]] 23 | name = "github.com/mattn/go-colorable" 24 | packages = ["."] 25 | revision = "d228849504861217f796da67fae4f6e347643f15" 26 | version = "v0.0.7" 27 | 28 | [[projects]] 29 | name = "github.com/mattn/go-isatty" 30 | packages = ["."] 31 | revision = "fc9e8d8ef48496124e79ae0df75490096eccf6fe" 32 | version = "v0.0.2" 33 | 34 | [[projects]] 35 | name = "github.com/pmezard/go-difflib" 36 | packages = ["difflib"] 37 | revision = "792786c7400a136282c1664665ae0a8db921c6c2" 38 | version = "v1.0.0" 39 | 40 | [[projects]] 41 | name = "github.com/stretchr/testify" 42 | packages = ["assert"] 43 | revision = "69483b4bd14f5845b5a1e55bca19e954e827f1d0" 44 | version = "v1.1.4" 45 | 46 | [[projects]] 47 | branch = "master" 48 | name = "github.com/valyala/bytebufferpool" 49 | packages = ["."] 50 | revision = "e746df99fe4a3986f4d4f79e13c1e0117ce9c2f7" 51 | 52 | [[projects]] 53 | branch = "master" 54 | name = "github.com/valyala/fasttemplate" 55 | packages = ["."] 56 | revision = "dcecefd839c4193db0d35b88ec65b4c12d360ab0" 57 | 58 | [[projects]] 59 | branch = "master" 60 | name = "golang.org/x/crypto" 61 | packages = ["acme","acme/autocert"] 62 | revision = "e1a4589e7d3ea14a3352255d04b6f1a418845e5e" 63 | 64 | [[projects]] 65 | branch = "master" 66 | name = "golang.org/x/sys" 67 | packages = ["unix"] 68 | revision = "b90f89a1e7a9c1f6b918820b3daa7f08488c8594" 69 | 70 | [solve-meta] 71 | analyzer-name = "dep" 72 | analyzer-version = 1 73 | inputs-digest = "5f74a2a2ba5b07475ad0faa1b4c021b973ad40b2ae749e3d94e15fe839bb440e" 74 | solver-name = "gps-cdcl" 75 | solver-version = 1 76 | -------------------------------------------------------------------------------- /vendor/github.com/labstack/echo/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2017 LabStack 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /vendor/github.com/labstack/echo/Makefile: -------------------------------------------------------------------------------- 1 | dependency: 2 | go get -u github.com/golang/dep/cmd/dep 3 | dep ensure -update 4 | 5 | test: 6 | echo "" > coverage.txt 7 | for d in $(shell go list ./... | grep -v vendor); do \ 8 | go test -race -coverprofile=profile.out -covermode=atomic $$d || exit 1; \ 9 | [ -f profile.out ] && cat profile.out >> coverage.txt && rm profile.out; \ 10 | done 11 | -------------------------------------------------------------------------------- /vendor/github.com/labstack/echo/echo_go1.8.go: -------------------------------------------------------------------------------- 1 | // +build go1.8 2 | 3 | package echo 4 | 5 | import ( 6 | stdContext "context" 7 | ) 8 | 9 | // Close immediately stops the server. 10 | // It internally calls `http.Server#Close()`. 11 | func (e *Echo) Close() error { 12 | if err := e.TLSServer.Close(); err != nil { 13 | return err 14 | } 15 | return e.Server.Close() 16 | } 17 | 18 | // Shutdown stops server the gracefully. 19 | // It internally calls `http.Server#Shutdown()`. 20 | func (e *Echo) Shutdown(ctx stdContext.Context) error { 21 | if err := e.TLSServer.Shutdown(ctx); err != nil { 22 | return err 23 | } 24 | return e.Server.Shutdown(ctx) 25 | } 26 | -------------------------------------------------------------------------------- /vendor/github.com/labstack/echo/log.go: -------------------------------------------------------------------------------- 1 | package echo 2 | 3 | import ( 4 | "io" 5 | 6 | "github.com/labstack/gommon/log" 7 | ) 8 | 9 | type ( 10 | // Logger defines the logging interface. 11 | Logger interface { 12 | Output() io.Writer 13 | SetOutput(w io.Writer) 14 | Prefix() string 15 | SetPrefix(p string) 16 | Level() log.Lvl 17 | SetLevel(v log.Lvl) 18 | Print(i ...interface{}) 19 | Printf(format string, args ...interface{}) 20 | Printj(j log.JSON) 21 | Debug(i ...interface{}) 22 | Debugf(format string, args ...interface{}) 23 | Debugj(j log.JSON) 24 | Info(i ...interface{}) 25 | Infof(format string, args ...interface{}) 26 | Infoj(j log.JSON) 27 | Warn(i ...interface{}) 28 | Warnf(format string, args ...interface{}) 29 | Warnj(j log.JSON) 30 | Error(i ...interface{}) 31 | Errorf(format string, args ...interface{}) 32 | Errorj(j log.JSON) 33 | Fatal(i ...interface{}) 34 | Fatalj(j log.JSON) 35 | Fatalf(format string, args ...interface{}) 36 | Panic(i ...interface{}) 37 | Panicj(j log.JSON) 38 | Panicf(format string, args ...interface{}) 39 | } 40 | ) 41 | -------------------------------------------------------------------------------- /vendor/github.com/labstack/echo/middleware/middleware.go: -------------------------------------------------------------------------------- 1 | package middleware 2 | 3 | import "github.com/labstack/echo" 4 | 5 | type ( 6 | // Skipper defines a function to skip middleware. Returning true skips processing 7 | // the middleware. 8 | Skipper func(c echo.Context) bool 9 | ) 10 | 11 | // DefaultSkipper returns false which processes the middleware. 12 | func DefaultSkipper(echo.Context) bool { 13 | return false 14 | } 15 | -------------------------------------------------------------------------------- /vendor/github.com/labstack/echo/middleware/recover.go: -------------------------------------------------------------------------------- 1 | package middleware 2 | 3 | import ( 4 | "fmt" 5 | "runtime" 6 | 7 | "github.com/labstack/echo" 8 | "github.com/labstack/gommon/color" 9 | ) 10 | 11 | type ( 12 | // RecoverConfig defines the config for Recover middleware. 13 | RecoverConfig struct { 14 | // Skipper defines a function to skip middleware. 15 | Skipper Skipper 16 | 17 | // Size of the stack to be printed. 18 | // Optional. Default value 4KB. 19 | StackSize int `json:"stack_size"` 20 | 21 | // DisableStackAll disables formatting stack traces of all other goroutines 22 | // into buffer after the trace for the current goroutine. 23 | // Optional. Default value false. 24 | DisableStackAll bool `json:"disable_stack_all"` 25 | 26 | // DisablePrintStack disables printing stack trace. 27 | // Optional. Default value as false. 28 | DisablePrintStack bool `json:"disable_print_stack"` 29 | } 30 | ) 31 | 32 | var ( 33 | // DefaultRecoverConfig is the default Recover middleware config. 34 | DefaultRecoverConfig = RecoverConfig{ 35 | Skipper: DefaultSkipper, 36 | StackSize: 4 << 10, // 4 KB 37 | DisableStackAll: false, 38 | DisablePrintStack: false, 39 | } 40 | ) 41 | 42 | // Recover returns a middleware which recovers from panics anywhere in the chain 43 | // and handles the control to the centralized HTTPErrorHandler. 44 | func Recover() echo.MiddlewareFunc { 45 | return RecoverWithConfig(DefaultRecoverConfig) 46 | } 47 | 48 | // RecoverWithConfig returns a Recover middleware with config. 49 | // See: `Recover()`. 50 | func RecoverWithConfig(config RecoverConfig) echo.MiddlewareFunc { 51 | // Defaults 52 | if config.Skipper == nil { 53 | config.Skipper = DefaultRecoverConfig.Skipper 54 | } 55 | if config.StackSize == 0 { 56 | config.StackSize = DefaultRecoverConfig.StackSize 57 | } 58 | 59 | return func(next echo.HandlerFunc) echo.HandlerFunc { 60 | return func(c echo.Context) error { 61 | if config.Skipper(c) { 62 | return next(c) 63 | } 64 | 65 | defer func() { 66 | if r := recover(); r != nil { 67 | var err error 68 | switch r := r.(type) { 69 | case error: 70 | err = r 71 | default: 72 | err = fmt.Errorf("%v", r) 73 | } 74 | stack := make([]byte, config.StackSize) 75 | length := runtime.Stack(stack, !config.DisableStackAll) 76 | if !config.DisablePrintStack { 77 | c.Logger().Printf("[%s] %s %s\n", color.Red("PANIC RECOVER"), err, stack[:length]) 78 | } 79 | c.Error(err) 80 | } 81 | }() 82 | return next(c) 83 | } 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /vendor/github.com/labstack/echo/middleware/request_id.go: -------------------------------------------------------------------------------- 1 | package middleware 2 | 3 | import ( 4 | "github.com/labstack/echo" 5 | "github.com/labstack/gommon/random" 6 | ) 7 | 8 | type ( 9 | // RequestIDConfig defines the config for RequestID middleware. 10 | RequestIDConfig struct { 11 | // Skipper defines a function to skip middleware. 12 | Skipper Skipper 13 | 14 | // Generator defines a function to generate an ID. 15 | // Optional. Default value random.String(32). 16 | Generator func() string 17 | } 18 | ) 19 | 20 | var ( 21 | // DefaultRequestIDConfig is the default RequestID middleware config. 22 | DefaultRequestIDConfig = RequestIDConfig{ 23 | Skipper: DefaultSkipper, 24 | Generator: generator, 25 | } 26 | ) 27 | 28 | // RequestID returns a X-Request-ID middleware. 29 | func RequestID() echo.MiddlewareFunc { 30 | return RequestIDWithConfig(DefaultRequestIDConfig) 31 | } 32 | 33 | // RequestIDWithConfig returns a X-Request-ID middleware with config. 34 | func RequestIDWithConfig(config RequestIDConfig) echo.MiddlewareFunc { 35 | // Defaults 36 | if config.Skipper == nil { 37 | config.Skipper = DefaultRequestIDConfig.Skipper 38 | } 39 | if config.Generator == nil { 40 | config.Generator = generator 41 | } 42 | 43 | return func(next echo.HandlerFunc) echo.HandlerFunc { 44 | return func(c echo.Context) error { 45 | if config.Skipper(c) { 46 | return next(c) 47 | } 48 | 49 | req := c.Request() 50 | res := c.Response() 51 | rid := req.Header.Get(echo.HeaderXRequestID) 52 | if rid == "" { 53 | rid = config.Generator() 54 | } 55 | res.Header().Set(echo.HeaderXRequestID, rid) 56 | 57 | return next(c) 58 | } 59 | } 60 | } 61 | 62 | func generator() string { 63 | return random.String(32) 64 | } 65 | -------------------------------------------------------------------------------- /vendor/github.com/labstack/echo/util_go17.go: -------------------------------------------------------------------------------- 1 | // +build go1.7,!go1.8 2 | 3 | package echo 4 | 5 | import ( 6 | "net/url" 7 | ) 8 | 9 | // PathUnescape is wraps `url.QueryUnescape` 10 | func PathUnescape(s string) (string, error) { 11 | return url.QueryUnescape(s) 12 | } 13 | -------------------------------------------------------------------------------- /vendor/github.com/labstack/echo/util_go18.go: -------------------------------------------------------------------------------- 1 | // +build go1.8 2 | 3 | package echo 4 | 5 | import "net/url" 6 | 7 | // PathUnescape is wraps `url.PathUnescape` 8 | func PathUnescape(s string) (string, error) { 9 | return url.PathUnescape(s) 10 | } 11 | -------------------------------------------------------------------------------- /vendor/github.com/labstack/gommon/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 labstack 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/labstack/gommon/bytes/README.md: -------------------------------------------------------------------------------- 1 | # Bytes 2 | 3 | - Format bytes integer to human readable bytes string. 4 | - Parse human readable bytes string to bytes integer. 5 | 6 | ## Installation 7 | 8 | ```go 9 | go get github.com/labstack/gommon/bytes 10 | ``` 11 | 12 | ## [Usage](https://github.com/labstack/gommon/blob/master/bytes/bytes_test.go) 13 | 14 | ### Format 15 | 16 | ```go 17 | println(bytes.Format(13231323)) 18 | ``` 19 | 20 | `12.62MB` 21 | 22 | ### Parse 23 | 24 | ```go 25 | b, _ = Parse("2M") 26 | println(b) 27 | ``` 28 | 29 | `2097152` 30 | -------------------------------------------------------------------------------- /vendor/github.com/labstack/gommon/bytes/bytes.go: -------------------------------------------------------------------------------- 1 | package bytes 2 | 3 | import ( 4 | "fmt" 5 | "regexp" 6 | "strconv" 7 | ) 8 | 9 | type ( 10 | Bytes struct { 11 | } 12 | ) 13 | 14 | const ( 15 | B = 1 << (10 * iota) 16 | KB 17 | MB 18 | GB 19 | TB 20 | PB 21 | EB 22 | ) 23 | 24 | var ( 25 | pattern = regexp.MustCompile(`(?i)^(-?\d+)([KMGTP]B?|B)$`) 26 | global = New() 27 | ) 28 | 29 | // New creates a Bytes instance. 30 | func New() *Bytes { 31 | return &Bytes{} 32 | } 33 | 34 | // Format formats bytes integer to human readable string. 35 | // For example, 31323 bytes will return 30.59KB. 36 | func (*Bytes) Format(b int64) string { 37 | multiple := "" 38 | value := float64(b) 39 | 40 | switch { 41 | case b < KB: 42 | return strconv.FormatInt(b, 10) + "B" 43 | case b < MB: 44 | value /= KB 45 | multiple = "KB" 46 | case b < MB: 47 | value /= KB 48 | multiple = "KB" 49 | case b < GB: 50 | value /= MB 51 | multiple = "MB" 52 | case b < TB: 53 | value /= GB 54 | multiple = "GB" 55 | case b < PB: 56 | value /= TB 57 | multiple = "TB" 58 | case b < EB: 59 | value /= PB 60 | multiple = "PB" 61 | } 62 | 63 | return fmt.Sprintf("%.02f%s", value, multiple) 64 | } 65 | 66 | // Parse parses human readable bytes string to bytes integer. 67 | // For example, 6GB (6G is also valid) will return 6442450944. 68 | func (*Bytes) Parse(value string) (i int64, err error) { 69 | parts := pattern.FindStringSubmatch(value) 70 | if len(parts) < 3 { 71 | return 0, fmt.Errorf("error parsing value=%s", value) 72 | } 73 | bytesString := parts[1] 74 | multiple := parts[2] 75 | bytes, err := strconv.ParseInt(bytesString, 10, 64) 76 | if err != nil { 77 | return 78 | } 79 | 80 | switch multiple { 81 | case "B": 82 | return bytes * B, nil 83 | case "K", "KB": 84 | return bytes * KB, nil 85 | case "M", "MB": 86 | return bytes * MB, nil 87 | case "G", "GB": 88 | return bytes * GB, nil 89 | case "T", "TB": 90 | return bytes * TB, nil 91 | case "P", "PB": 92 | return bytes * PB, nil 93 | } 94 | 95 | return 96 | } 97 | 98 | // Format wraps global Bytes's Format function. 99 | func Format(b int64) string { 100 | return global.Format(b) 101 | } 102 | 103 | // Parse wraps global Bytes's Parse function. 104 | func Parse(val string) (int64, error) { 105 | return global.Parse(val) 106 | } 107 | -------------------------------------------------------------------------------- /vendor/github.com/labstack/gommon/color/README.md: -------------------------------------------------------------------------------- 1 | # Color 2 | 3 | Style terminal text. 4 | 5 | ## Installation 6 | 7 | ```sh 8 | go get github.com/labstack/gommon/color 9 | ``` 10 | 11 | ## Windows? 12 | 13 | Try [cmder](http://bliker.github.io/cmder) or https://github.com/mattn/go-colorable 14 | 15 | ## [Usage](https://github.com/labstack/gommon/blob/master/color/color_test.go) 16 | 17 | ```sh 18 | import github.com/labstack/gommon/color 19 | ``` 20 | 21 | ### Colored text 22 | 23 | ```go 24 | color.Println(color.Black("black")) 25 | color.Println(color.Red("red")) 26 | color.Println(color.Green("green")) 27 | color.Println(color.Yellow("yellow")) 28 | color.Println(color.Blue("blue")) 29 | color.Println(color.Magenta("magenta")) 30 | color.Println(color.Cyan("cyan")) 31 | color.Println(color.White("white")) 32 | color.Println(color.Grey("grey")) 33 | ``` 34 | ![Colored Text](http://i.imgur.com/8RtY1QR.png) 35 | 36 | ### Colored background 37 | 38 | ```go 39 | color.Println(color.BlackBg("black background", color.Wht)) 40 | color.Println(color.RedBg("red background")) 41 | color.Println(color.GreenBg("green background")) 42 | color.Println(color.YellowBg("yellow background")) 43 | color.Println(color.BlueBg("blue background")) 44 | color.Println(color.MagentaBg("magenta background")) 45 | color.Println(color.CyanBg("cyan background")) 46 | color.Println(color.WhiteBg("white background")) 47 | ``` 48 | ![Colored Background](http://i.imgur.com/SrrS6lw.png) 49 | 50 | ### Emphasis 51 | 52 | ```go 53 | color.Println(color.Bold("bold")) 54 | color.Println(color.Dim("dim")) 55 | color.Println(color.Italic("italic")) 56 | color.Println(color.Underline("underline")) 57 | color.Println(color.Inverse("inverse")) 58 | color.Println(color.Hidden("hidden")) 59 | color.Println(color.Strikeout("strikeout")) 60 | ``` 61 | ![Emphasis](http://i.imgur.com/3RSJBbc.png) 62 | 63 | ### Mix and match 64 | 65 | ```go 66 | color.Println(color.Green("bold green with white background", color.B, color.WhtBg)) 67 | color.Println(color.Red("underline red", color.U)) 68 | color.Println(color.Yellow("dim yellow", color.D)) 69 | color.Println(color.Cyan("inverse cyan", color.In)) 70 | color.Println(color.Blue("bold underline dim blue", color.B, color.U, color.D)) 71 | ``` 72 | ![Mix and match](http://i.imgur.com/jWGq9Ca.png) 73 | 74 | ### Enable/Disable the package 75 | 76 | ```go 77 | color.Disable() 78 | color.Enable() 79 | ``` 80 | 81 | ### New instance 82 | 83 | ```go 84 | c := New() 85 | c.Green("green") 86 | ``` 87 | -------------------------------------------------------------------------------- /vendor/github.com/labstack/gommon/log/README.md: -------------------------------------------------------------------------------- 1 | ## WORK IN PROGRESS 2 | 3 | ### Usage 4 | 5 | [log_test.go](log_test.go) 6 | -------------------------------------------------------------------------------- /vendor/github.com/labstack/gommon/log/color.go: -------------------------------------------------------------------------------- 1 | // +build !appengine 2 | 3 | package log 4 | 5 | import ( 6 | "io" 7 | 8 | "github.com/mattn/go-colorable" 9 | ) 10 | 11 | func output() io.Writer { 12 | return colorable.NewColorableStdout() 13 | } 14 | -------------------------------------------------------------------------------- /vendor/github.com/labstack/gommon/log/white.go: -------------------------------------------------------------------------------- 1 | // +build appengine 2 | 3 | package log 4 | 5 | import ( 6 | "io" 7 | "os" 8 | ) 9 | 10 | func output() io.Writer { 11 | return os.Stdout 12 | } 13 | -------------------------------------------------------------------------------- /vendor/github.com/labstack/gommon/random/random.go: -------------------------------------------------------------------------------- 1 | package random 2 | 3 | import ( 4 | "math/rand" 5 | "strings" 6 | "time" 7 | ) 8 | 9 | type ( 10 | Random struct { 11 | } 12 | ) 13 | 14 | // Charsets 15 | const ( 16 | Uppercase string = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" 17 | Lowercase = "abcdefghijklmnopqrstuvwxyz" 18 | Alphabetic = Uppercase + Lowercase 19 | Numeric = "0123456789" 20 | Alphanumeric = Alphabetic + Numeric 21 | Symbols = "`" + `~!@#$%^&*()-_+={}[]|\;:"<>,./?` 22 | Hex = Numeric + "abcdef" 23 | ) 24 | 25 | var ( 26 | global = New() 27 | ) 28 | 29 | func New() *Random { 30 | rand.Seed(time.Now().UnixNano()) 31 | return new(Random) 32 | } 33 | 34 | func (r *Random) String(length uint8, charsets ...string) string { 35 | charset := strings.Join(charsets, "") 36 | if charset == "" { 37 | charset = Alphanumeric 38 | } 39 | b := make([]byte, length) 40 | for i := range b { 41 | b[i] = charset[rand.Int63()%int64(len(charset))] 42 | } 43 | return string(b) 44 | } 45 | 46 | func String(length uint8, charsets ...string) string { 47 | return global.String(length, charsets...) 48 | } 49 | -------------------------------------------------------------------------------- /vendor/github.com/mailru/easyjson/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2016 Mail.Ru Group 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 4 | 5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 6 | 7 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 8 | -------------------------------------------------------------------------------- /vendor/github.com/mailru/easyjson/jlexer/bytestostr.go: -------------------------------------------------------------------------------- 1 | // This file will only be included to the build if neither 2 | // easyjson_nounsafe nor appengine build tag is set. See README notes 3 | // for more details. 4 | 5 | //+build !easyjson_nounsafe 6 | //+build !appengine 7 | 8 | package jlexer 9 | 10 | import ( 11 | "reflect" 12 | "unsafe" 13 | ) 14 | 15 | // bytesToStr creates a string pointing at the slice to avoid copying. 16 | // 17 | // Warning: the string returned by the function should be used with care, as the whole input data 18 | // chunk may be either blocked from being freed by GC because of a single string or the buffer.Data 19 | // may be garbage-collected even when the string exists. 20 | func bytesToStr(data []byte) string { 21 | h := (*reflect.SliceHeader)(unsafe.Pointer(&data)) 22 | shdr := reflect.StringHeader{Data: h.Data, Len: h.Len} 23 | return *(*string)(unsafe.Pointer(&shdr)) 24 | } 25 | -------------------------------------------------------------------------------- /vendor/github.com/mailru/easyjson/jlexer/bytestostr_nounsafe.go: -------------------------------------------------------------------------------- 1 | // This file is included to the build if any of the buildtags below 2 | // are defined. Refer to README notes for more details. 3 | 4 | //+build easyjson_nounsafe appengine 5 | 6 | package jlexer 7 | 8 | // bytesToStr creates a string normally from []byte 9 | // 10 | // Note that this method is roughly 1.5x slower than using the 'unsafe' method. 11 | func bytesToStr(data []byte) string { 12 | return string(data) 13 | } 14 | -------------------------------------------------------------------------------- /vendor/github.com/mailru/easyjson/jlexer/error.go: -------------------------------------------------------------------------------- 1 | package jlexer 2 | 3 | import "fmt" 4 | 5 | // LexerError implements the error interface and represents all possible errors that can be 6 | // generated during parsing the JSON data. 7 | type LexerError struct { 8 | Reason string 9 | Offset int 10 | Data string 11 | } 12 | 13 | func (l *LexerError) Error() string { 14 | return fmt.Sprintf("parse error: %s near offset %d of '%s'", l.Reason, l.Offset, l.Data) 15 | } 16 | -------------------------------------------------------------------------------- /vendor/github.com/mattn/go-colorable/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 Yasuhiro Matsumoto 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /vendor/github.com/mattn/go-colorable/README.md: -------------------------------------------------------------------------------- 1 | # go-colorable 2 | 3 | [![Godoc Reference](https://godoc.org/github.com/mattn/go-colorable?status.svg)](http://godoc.org/github.com/mattn/go-colorable) 4 | [![Build Status](https://travis-ci.org/mattn/go-colorable.svg?branch=master)](https://travis-ci.org/mattn/go-colorable) 5 | [![Coverage Status](https://coveralls.io/repos/github/mattn/go-colorable/badge.svg?branch=master)](https://coveralls.io/github/mattn/go-colorable?branch=master) 6 | [![Go Report Card](https://goreportcard.com/badge/mattn/go-colorable)](https://goreportcard.com/report/mattn/go-colorable) 7 | 8 | Colorable writer for windows. 9 | 10 | For example, most of logger packages doesn't show colors on windows. (I know we can do it with ansicon. But I don't want.) 11 | This package is possible to handle escape sequence for ansi color on windows. 12 | 13 | ## Too Bad! 14 | 15 | ![](https://raw.githubusercontent.com/mattn/go-colorable/gh-pages/bad.png) 16 | 17 | 18 | ## So Good! 19 | 20 | ![](https://raw.githubusercontent.com/mattn/go-colorable/gh-pages/good.png) 21 | 22 | ## Usage 23 | 24 | ```go 25 | logrus.SetFormatter(&logrus.TextFormatter{ForceColors: true}) 26 | logrus.SetOutput(colorable.NewColorableStdout()) 27 | 28 | logrus.Info("succeeded") 29 | logrus.Warn("not correct") 30 | logrus.Error("something error") 31 | logrus.Fatal("panic") 32 | ``` 33 | 34 | You can compile above code on non-windows OSs. 35 | 36 | ## Installation 37 | 38 | ``` 39 | $ go get github.com/mattn/go-colorable 40 | ``` 41 | 42 | # License 43 | 44 | MIT 45 | 46 | # Author 47 | 48 | Yasuhiro Matsumoto (a.k.a mattn) 49 | -------------------------------------------------------------------------------- /vendor/github.com/mattn/go-colorable/colorable_appengine.go: -------------------------------------------------------------------------------- 1 | // +build appengine 2 | 3 | package colorable 4 | 5 | import ( 6 | "io" 7 | "os" 8 | 9 | _ "github.com/mattn/go-isatty" 10 | ) 11 | 12 | // NewColorable return new instance of Writer which handle escape sequence. 13 | func NewColorable(file *os.File) io.Writer { 14 | if file == nil { 15 | panic("nil passed instead of *os.File to NewColorable()") 16 | } 17 | 18 | return file 19 | } 20 | 21 | // NewColorableStdout return new instance of Writer which handle escape sequence for stdout. 22 | func NewColorableStdout() io.Writer { 23 | return os.Stdout 24 | } 25 | 26 | // NewColorableStderr return new instance of Writer which handle escape sequence for stderr. 27 | func NewColorableStderr() io.Writer { 28 | return os.Stderr 29 | } 30 | -------------------------------------------------------------------------------- /vendor/github.com/mattn/go-colorable/colorable_others.go: -------------------------------------------------------------------------------- 1 | // +build !windows 2 | // +build !appengine 3 | 4 | package colorable 5 | 6 | import ( 7 | "io" 8 | "os" 9 | 10 | _ "github.com/mattn/go-isatty" 11 | ) 12 | 13 | // NewColorable return new instance of Writer which handle escape sequence. 14 | func NewColorable(file *os.File) io.Writer { 15 | if file == nil { 16 | panic("nil passed instead of *os.File to NewColorable()") 17 | } 18 | 19 | return file 20 | } 21 | 22 | // NewColorableStdout return new instance of Writer which handle escape sequence for stdout. 23 | func NewColorableStdout() io.Writer { 24 | return os.Stdout 25 | } 26 | 27 | // NewColorableStderr return new instance of Writer which handle escape sequence for stderr. 28 | func NewColorableStderr() io.Writer { 29 | return os.Stderr 30 | } 31 | -------------------------------------------------------------------------------- /vendor/github.com/mattn/go-colorable/noncolorable.go: -------------------------------------------------------------------------------- 1 | package colorable 2 | 3 | import ( 4 | "bytes" 5 | "io" 6 | ) 7 | 8 | // NonColorable hold writer but remove escape sequence. 9 | type NonColorable struct { 10 | out io.Writer 11 | } 12 | 13 | // NewNonColorable return new instance of Writer which remove escape sequence from Writer. 14 | func NewNonColorable(w io.Writer) io.Writer { 15 | return &NonColorable{out: w} 16 | } 17 | 18 | // Write write data on console 19 | func (w *NonColorable) Write(data []byte) (n int, err error) { 20 | er := bytes.NewReader(data) 21 | var bw [1]byte 22 | loop: 23 | for { 24 | c1, err := er.ReadByte() 25 | if err != nil { 26 | break loop 27 | } 28 | if c1 != 0x1b { 29 | bw[0] = c1 30 | w.out.Write(bw[:]) 31 | continue 32 | } 33 | c2, err := er.ReadByte() 34 | if err != nil { 35 | break loop 36 | } 37 | if c2 != 0x5b { 38 | continue 39 | } 40 | 41 | var buf bytes.Buffer 42 | for { 43 | c, err := er.ReadByte() 44 | if err != nil { 45 | break loop 46 | } 47 | if ('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z') || c == '@' { 48 | break 49 | } 50 | buf.Write([]byte(string(c))) 51 | } 52 | } 53 | 54 | return len(data), nil 55 | } 56 | -------------------------------------------------------------------------------- /vendor/github.com/mattn/go-isatty/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) Yasuhiro MATSUMOTO 2 | 3 | MIT License (Expat) 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 6 | 7 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 10 | -------------------------------------------------------------------------------- /vendor/github.com/mattn/go-isatty/README.md: -------------------------------------------------------------------------------- 1 | # go-isatty 2 | 3 | [![Godoc Reference](https://godoc.org/github.com/mattn/go-isatty?status.svg)](http://godoc.org/github.com/mattn/go-isatty) 4 | [![Build Status](https://travis-ci.org/mattn/go-isatty.svg?branch=master)](https://travis-ci.org/mattn/go-isatty) 5 | [![Coverage Status](https://coveralls.io/repos/github/mattn/go-isatty/badge.svg?branch=master)](https://coveralls.io/github/mattn/go-isatty?branch=master) 6 | [![Go Report Card](https://goreportcard.com/badge/mattn/go-isatty)](https://goreportcard.com/report/mattn/go-isatty) 7 | 8 | isatty for golang 9 | 10 | ## Usage 11 | 12 | ```go 13 | package main 14 | 15 | import ( 16 | "fmt" 17 | "github.com/mattn/go-isatty" 18 | "os" 19 | ) 20 | 21 | func main() { 22 | if isatty.IsTerminal(os.Stdout.Fd()) { 23 | fmt.Println("Is Terminal") 24 | } else if isatty.IsCygwinTerminal(os.Stdout.Fd()) { 25 | fmt.Println("Is Cygwin/MSYS2 Terminal") 26 | } else { 27 | fmt.Println("Is Not Terminal") 28 | } 29 | } 30 | ``` 31 | 32 | ## Installation 33 | 34 | ``` 35 | $ go get github.com/mattn/go-isatty 36 | ``` 37 | 38 | ## License 39 | 40 | MIT 41 | 42 | ## Author 43 | 44 | Yasuhiro Matsumoto (a.k.a mattn) 45 | 46 | ## Thanks 47 | 48 | * k-takata: base idea for IsCygwinTerminal 49 | 50 | https://github.com/k-takata/go-iscygpty 51 | -------------------------------------------------------------------------------- /vendor/github.com/mattn/go-isatty/doc.go: -------------------------------------------------------------------------------- 1 | // Package isatty implements interface to isatty 2 | package isatty 3 | -------------------------------------------------------------------------------- /vendor/github.com/mattn/go-isatty/isatty_appengine.go: -------------------------------------------------------------------------------- 1 | // +build appengine 2 | 3 | package isatty 4 | 5 | // IsTerminal returns true if the file descriptor is terminal which 6 | // is always false on on appengine classic which is a sandboxed PaaS. 7 | func IsTerminal(fd uintptr) bool { 8 | return false 9 | } 10 | 11 | // IsCygwinTerminal() return true if the file descriptor is a cygwin or msys2 12 | // terminal. This is also always false on this environment. 13 | func IsCygwinTerminal(fd uintptr) bool { 14 | return false 15 | } 16 | -------------------------------------------------------------------------------- /vendor/github.com/mattn/go-isatty/isatty_bsd.go: -------------------------------------------------------------------------------- 1 | // +build darwin freebsd openbsd netbsd dragonfly 2 | // +build !appengine 3 | 4 | package isatty 5 | 6 | import ( 7 | "syscall" 8 | "unsafe" 9 | ) 10 | 11 | const ioctlReadTermios = syscall.TIOCGETA 12 | 13 | // IsTerminal return true if the file descriptor is terminal. 14 | func IsTerminal(fd uintptr) bool { 15 | var termios syscall.Termios 16 | _, _, err := syscall.Syscall6(syscall.SYS_IOCTL, fd, ioctlReadTermios, uintptr(unsafe.Pointer(&termios)), 0, 0, 0) 17 | return err == 0 18 | } 19 | -------------------------------------------------------------------------------- /vendor/github.com/mattn/go-isatty/isatty_linux.go: -------------------------------------------------------------------------------- 1 | // +build linux 2 | // +build !appengine 3 | 4 | package isatty 5 | 6 | import ( 7 | "syscall" 8 | "unsafe" 9 | ) 10 | 11 | const ioctlReadTermios = syscall.TCGETS 12 | 13 | // IsTerminal return true if the file descriptor is terminal. 14 | func IsTerminal(fd uintptr) bool { 15 | var termios syscall.Termios 16 | _, _, err := syscall.Syscall6(syscall.SYS_IOCTL, fd, ioctlReadTermios, uintptr(unsafe.Pointer(&termios)), 0, 0, 0) 17 | return err == 0 18 | } 19 | -------------------------------------------------------------------------------- /vendor/github.com/mattn/go-isatty/isatty_others.go: -------------------------------------------------------------------------------- 1 | // +build !windows 2 | // +build !appengine 3 | 4 | package isatty 5 | 6 | // IsCygwinTerminal() return true if the file descriptor is a cygwin or msys2 7 | // terminal. This is also always false on this environment. 8 | func IsCygwinTerminal(fd uintptr) bool { 9 | return false 10 | } 11 | -------------------------------------------------------------------------------- /vendor/github.com/mattn/go-isatty/isatty_solaris.go: -------------------------------------------------------------------------------- 1 | // +build solaris 2 | // +build !appengine 3 | 4 | package isatty 5 | 6 | import ( 7 | "golang.org/x/sys/unix" 8 | ) 9 | 10 | // IsTerminal returns true if the given file descriptor is a terminal. 11 | // see: http://src.illumos.org/source/xref/illumos-gate/usr/src/lib/libbc/libc/gen/common/isatty.c 12 | func IsTerminal(fd uintptr) bool { 13 | var termio unix.Termio 14 | err := unix.IoctlSetTermio(int(fd), unix.TCGETA, &termio) 15 | return err == nil 16 | } 17 | -------------------------------------------------------------------------------- /vendor/github.com/mattn/go-isatty/isatty_windows.go: -------------------------------------------------------------------------------- 1 | // +build windows 2 | // +build !appengine 3 | 4 | package isatty 5 | 6 | import ( 7 | "strings" 8 | "syscall" 9 | "unicode/utf16" 10 | "unsafe" 11 | ) 12 | 13 | const ( 14 | fileNameInfo uintptr = 2 15 | fileTypePipe = 3 16 | ) 17 | 18 | var ( 19 | kernel32 = syscall.NewLazyDLL("kernel32.dll") 20 | procGetConsoleMode = kernel32.NewProc("GetConsoleMode") 21 | procGetFileInformationByHandleEx = kernel32.NewProc("GetFileInformationByHandleEx") 22 | procGetFileType = kernel32.NewProc("GetFileType") 23 | ) 24 | 25 | func init() { 26 | // Check if GetFileInformationByHandleEx is available. 27 | if procGetFileInformationByHandleEx.Find() != nil { 28 | procGetFileInformationByHandleEx = nil 29 | } 30 | } 31 | 32 | // IsTerminal return true if the file descriptor is terminal. 33 | func IsTerminal(fd uintptr) bool { 34 | var st uint32 35 | r, _, e := syscall.Syscall(procGetConsoleMode.Addr(), 2, fd, uintptr(unsafe.Pointer(&st)), 0) 36 | return r != 0 && e == 0 37 | } 38 | 39 | // Check pipe name is used for cygwin/msys2 pty. 40 | // Cygwin/MSYS2 PTY has a name like: 41 | // \{cygwin,msys}-XXXXXXXXXXXXXXXX-ptyN-{from,to}-master 42 | func isCygwinPipeName(name string) bool { 43 | token := strings.Split(name, "-") 44 | if len(token) < 5 { 45 | return false 46 | } 47 | 48 | if token[0] != `\msys` && token[0] != `\cygwin` { 49 | return false 50 | } 51 | 52 | if token[1] == "" { 53 | return false 54 | } 55 | 56 | if !strings.HasPrefix(token[2], "pty") { 57 | return false 58 | } 59 | 60 | if token[3] != `from` && token[3] != `to` { 61 | return false 62 | } 63 | 64 | if token[4] != "master" { 65 | return false 66 | } 67 | 68 | return true 69 | } 70 | 71 | // IsCygwinTerminal() return true if the file descriptor is a cygwin or msys2 72 | // terminal. 73 | func IsCygwinTerminal(fd uintptr) bool { 74 | if procGetFileInformationByHandleEx == nil { 75 | return false 76 | } 77 | 78 | // Cygwin/msys's pty is a pipe. 79 | ft, _, e := syscall.Syscall(procGetFileType.Addr(), 1, fd, 0, 0) 80 | if ft != fileTypePipe || e != 0 { 81 | return false 82 | } 83 | 84 | var buf [2 + syscall.MAX_PATH]uint16 85 | r, _, e := syscall.Syscall6(procGetFileInformationByHandleEx.Addr(), 86 | 4, fd, fileNameInfo, uintptr(unsafe.Pointer(&buf)), 87 | uintptr(len(buf)*2), 0, 0) 88 | if r == 0 || e != 0 { 89 | return false 90 | } 91 | 92 | l := *(*uint32)(unsafe.Pointer(&buf)) 93 | return isCygwinPipeName(string(utf16.Decode(buf[2 : 2+l/2]))) 94 | } 95 | -------------------------------------------------------------------------------- /vendor/github.com/mediocregopher/gojson/LICENSE: -------------------------------------------------------------------------------- 1 | DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE 2 | Version 2, December 2004 3 | 4 | Copyright (C) 2004 Sam Hocevar 5 | 6 | Everyone is permitted to copy and distribute verbatim or modified 7 | copies of this license document, and changing it is allowed as long 8 | as the name is changed. 9 | 10 | DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE 11 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 12 | 13 | 0. You just DO WHAT THE FUCK YOU WANT TO. 14 | 15 | -------------------------------------------------------------------------------- /vendor/github.com/mediocregopher/gojson/README.md: -------------------------------------------------------------------------------- 1 | # gojson 2 | 3 | A copy of go's `encoding/json` library which doesn't base64 encode/decode your 4 | byte slices. 5 | 6 | You can find the docs [here][docs]. You'll notice they're basically verbatum the 7 | `encoding/json` docs. 8 | 9 | # Installation 10 | 11 | `go get github.com/mediocregopher/gojson` 12 | 13 | or if you're using [goat][goat]: 14 | 15 | ```yaml 16 | - loc: https://github.com/mediocregopher/gojson.git 17 | type: git 18 | ref: v0.0.0 19 | path: github.com/mediocregopher/gojson 20 | ``` 21 | 22 | # What is it? 23 | 24 | This is the exact same as the standard encoding/json package (as of Dec 14, 25 | 2013, go 1.2), except that it doesn't have the baffling behavior of 26 | automatically treating []byte fields as base64 strings. So now you can have the 27 | following code work the way you would expect it to: 28 | 29 | ```go 30 | package main 31 | 32 | import ( 33 | "github.com/mediocregopher/gojson" 34 | "log" 35 | ) 36 | 37 | type Wat struct { 38 | A, B []byte 39 | } 40 | 41 | func main() { 42 | b := []byte(`{"A":"foo","B":"bar"}`) 43 | w := &Wat{} 44 | 45 | err := gojson.Unmarshal(b,w) 46 | log.Println(string(w.A), string(w.B), err) 47 | } 48 | ``` 49 | 50 | Whereas before the `A` and `B` fields would have been base64 decoded before 51 | being put in the byte slices (which makes no sense and isn't the common case, so 52 | why is it the behavior in the main package? beats me....). 53 | 54 | [docs]: http://godoc.org/github.com/mediocregopher/gojson 55 | [goat]: https://github.com/mediocregopher/goat 56 | -------------------------------------------------------------------------------- /vendor/github.com/mediocregopher/gojson/tags.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 gojson 6 | 7 | import ( 8 | "strings" 9 | ) 10 | 11 | // tagOptions is the string following a comma in a struct field's "json" 12 | // tag, or the empty string. It does not include the leading comma. 13 | type tagOptions string 14 | 15 | // parseTag splits a struct field's json tag into its name and 16 | // comma-separated options. 17 | func parseTag(tag string) (string, tagOptions) { 18 | if idx := strings.Index(tag, ","); idx != -1 { 19 | return tag[:idx], tagOptions(tag[idx+1:]) 20 | } 21 | return tag, tagOptions("") 22 | } 23 | 24 | // Contains reports whether a comma-separated list of options 25 | // contains a particular substr flag. substr must be surrounded by a 26 | // string boundary or commas. 27 | func (o tagOptions) Contains(optionName string) bool { 28 | if len(o) == 0 { 29 | return false 30 | } 31 | s := string(o) 32 | for s != "" { 33 | var next string 34 | i := strings.Index(s, ",") 35 | if i >= 0 { 36 | s, next = s[:i], s[i+1:] 37 | } 38 | if s == optionName { 39 | return true 40 | } 41 | s = next 42 | } 43 | return false 44 | } 45 | -------------------------------------------------------------------------------- /vendor/github.com/mkideal/cli/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | CHANGELOG 2 | ========= 3 | 4 | # unreleased 5 | 6 | * Del: Remove extra package `now`. 7 | * Add: Adds `UsageFn` for customizing usage. 8 | * Mod: Replaces `NeedArgs` with `NumArg`. 9 | 10 | # v0.0.1 (2016-05-21) 11 | 12 | Initializes the repository, and implements many important features. 13 | 14 | * Add: Prases flags base on golang tag. 15 | * Add: Supports almost all basic types, slice and map as a flag. 16 | * Add: Fuzzy matching for suggestion. 17 | * Add: Supports command tree. 18 | * Add: Pretty output for usage of command. 19 | * Add: Supports any type which implement `cli.Decoder` as a flag. 20 | * Add: Parser for flag. 21 | * Add: Supports editor like `git commit`. 22 | * Add: Rich examples to help other quick start. 23 | -------------------------------------------------------------------------------- /vendor/github.com/mkideal/cli/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (C) 2016 mkideal(i@mkideal.com) 2 | 3 |   Permission is hereby granted, free of charge, to any person obtaining a copy of this 4 | software and associated documentation files (the "Software"), to deal in the Software 5 | without restriction, including without limitation the rights to use, copy, modify, 6 | merge, publish, distribute, sublicense, and/or sell copies of the Software, and to 7 | permit persons to whom the Software is furnished to do so, subject to the following 8 | conditions: 9 |    10 |   The above copyright notice and this permission notice shall be included in all 11 | copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 14 | INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR 15 | PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 16 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT 17 | OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 18 | OTHER DEALINGS IN THE SOFTWARE. 19 | -------------------------------------------------------------------------------- /vendor/github.com/mkideal/cli/builtin.go: -------------------------------------------------------------------------------- 1 | package cli 2 | 3 | import ( 4 | "fmt" 5 | ) 6 | 7 | // Helper is builtin Help flag 8 | type Helper struct { 9 | Help bool `cli:"!h,help" usage:"display help information" json:"-"` 10 | } 11 | 12 | // AutoHelp implements AutoHelper interface 13 | func (h Helper) AutoHelp() bool { 14 | return h.Help 15 | } 16 | 17 | // Deprecated: Addr is builtin host,port flag 18 | type Addr struct { 19 | Host string `cli:"host" usage:"specify host" dft:"0.0.0.0"` 20 | Port uint16 `cli:"port" usage:"specify port" dft:"8080"` 21 | } 22 | 23 | // Deprecated: AddrWithShort is builtin host,port flag contains short flag 24 | type AddrWithShort struct { 25 | Host string `cli:"H,host" usage:"specify host" dft:"0.0.0.0"` 26 | Port uint16 `cli:"p,port" usage:"specify port" dft:"8080"` 27 | } 28 | 29 | // Deprecated: ToString ... 30 | func (addr Addr) ToString() string { 31 | return fmt.Sprintf("%s:%d", addr.Host, addr.Port) 32 | } 33 | 34 | // Deprecated: ToString ... 35 | func (addr AddrWithShort) ToString() string { 36 | return fmt.Sprintf("%s:%d", addr.Host, addr.Port) 37 | } 38 | -------------------------------------------------------------------------------- /vendor/github.com/mkideal/cli/coder.go: -------------------------------------------------------------------------------- 1 | package cli 2 | 3 | type Decoder interface { 4 | Decode(s string) error 5 | } 6 | 7 | type SliceDecoder interface { 8 | Decoder 9 | DecodeSlice() 10 | } 11 | 12 | type Encoder interface { 13 | Encode() string 14 | } 15 | 16 | type CounterDecoder interface { 17 | Decoder 18 | IsCounter() 19 | } 20 | 21 | type Counter struct { 22 | value int 23 | } 24 | 25 | func (c Counter) Value() int { return c.value } 26 | 27 | func (c *Counter) Decode(s string) error { 28 | c.value++ 29 | return nil 30 | } 31 | 32 | func (c Counter) IsCounter() {} 33 | -------------------------------------------------------------------------------- /vendor/github.com/mkideal/cli/editor.go: -------------------------------------------------------------------------------- 1 | package cli 2 | 3 | import ( 4 | "crypto/rand" 5 | "fmt" 6 | "io/ioutil" 7 | "os" 8 | "os/exec" 9 | ) 10 | 11 | const DefaultEditor = "vim" 12 | 13 | // GetEditor sets callback to get editor program 14 | var GetEditor func() (string, error) 15 | 16 | func getEditor() (string, error) { 17 | if GetEditor != nil { 18 | return GetEditor() 19 | } 20 | return exec.LookPath(DefaultEditor) 21 | } 22 | 23 | func randomFilename() string { 24 | buf := make([]byte, 16) 25 | if _, err := rand.Read(buf); err != nil { 26 | return "CLI_EDIT_FILE" 27 | } 28 | return fmt.Sprintf(".%x", buf) 29 | } 30 | 31 | func LaunchEditor(editor string) (content []byte, err error) { 32 | return launchEditorWithFilename(editor, randomFilename()) 33 | } 34 | 35 | func launchEditorWithFilename(editor, filename string) (content []byte, err error) { 36 | cmd := exec.Command(editor, filename) 37 | cmd.Stdin = os.Stdin 38 | cmd.Stdout = os.Stdout 39 | cmd.Stderr = os.Stderr 40 | defer os.Remove(filename) 41 | err = cmd.Run() 42 | if err != nil { 43 | if _, isExitError := err.(*exec.ExitError); !isExitError { 44 | return 45 | } 46 | } 47 | content, err = ioutil.ReadFile(filename) 48 | if err != nil { 49 | return []byte{}, nil 50 | } 51 | return 52 | } 53 | -------------------------------------------------------------------------------- /vendor/github.com/mkideal/cli/fuzzy.go: -------------------------------------------------------------------------------- 1 | package cli 2 | 3 | func match(s, t string) (float32, bool) { 4 | return matchWithMinDifferRate(s, t, 0.3) 5 | } 6 | 7 | func matchWithMinDifferRate(s, t string, minDifferRate float32) (float32, bool) { 8 | dist := editDistance([]byte(s), []byte(t)) 9 | differRate := float32(dist) / float32(max(len(s), len(t))+4) 10 | return differRate, differRate <= minDifferRate 11 | } 12 | 13 | func editDistance(s, t []byte) float32 { 14 | var ( 15 | m = len(s) 16 | n = len(t) 17 | d = make([][]float32, m+1) 18 | ) 19 | for i := 0; i < m+1; i++ { 20 | d[i] = make([]float32, n+1) 21 | d[i][0] = float32(i) 22 | } 23 | for j := 0; j < n+1; j++ { 24 | d[0][j] = float32(j) 25 | } 26 | 27 | for j := 1; j < n+1; j++ { 28 | for i := 1; i < m+1; i++ { 29 | if s[i-1] == t[j-1] { 30 | d[i][j] = d[i-1][j-1] 31 | } else { 32 | d[i][j] = min(d[i-1][j]+1, min(d[i][j-1]+1, d[i-1][j-1]+1)) 33 | } 34 | } 35 | } 36 | 37 | return d[m][n] 38 | } 39 | 40 | func min(x, y float32) float32 { 41 | if x < y { 42 | return x 43 | } 44 | return y 45 | } 46 | 47 | func max(x, y int) int { 48 | if x > y { 49 | return x 50 | } 51 | return y 52 | } 53 | 54 | type editDistanceRank struct { 55 | s string 56 | d float32 57 | } 58 | 59 | type editDistanceRankSlice []editDistanceRank 60 | 61 | func (dists editDistanceRankSlice) Len() int { 62 | return len(dists) 63 | } 64 | 65 | func (dists editDistanceRankSlice) Less(i, j int) bool { 66 | return dists[i].d < dists[j].d 67 | } 68 | 69 | func (dists editDistanceRankSlice) Swap(i, j int) { 70 | dists[i], dists[j] = dists[j], dists[i] 71 | } 72 | -------------------------------------------------------------------------------- /vendor/github.com/mkideal/cli/parser.go: -------------------------------------------------------------------------------- 1 | package cli 2 | 3 | import ( 4 | "encoding/json" 5 | ) 6 | 7 | // FlagParser represents a parser for parsing flag 8 | type FlagParser interface { 9 | Parse(s string) error 10 | } 11 | 12 | // FlagParserCreator represents factory function of FlagParser 13 | type FlagParserCreator func(ptr interface{}) FlagParser 14 | 15 | var parserCreators = map[string]FlagParserCreator{} 16 | 17 | // RegisterFlagParser registers FlagParserCreator by name 18 | func RegisterFlagParser(name string, creator FlagParserCreator) { 19 | if _, ok := parserCreators[name]; ok { 20 | panic("RegisterFlagParser has registered: " + name) 21 | } 22 | parserCreators[name] = creator 23 | } 24 | 25 | func init() { 26 | RegisterFlagParser("json", newJSONParser) 27 | RegisterFlagParser("jsonfile", newJSONFileParser) 28 | } 29 | 30 | // JSON parser 31 | type JSONParser struct { 32 | ptr interface{} 33 | } 34 | 35 | func newJSONParser(ptr interface{}) FlagParser { 36 | return &JSONParser{ptr} 37 | } 38 | 39 | func (p JSONParser) Parse(s string) error { 40 | return json.Unmarshal([]byte(s), p.ptr) 41 | } 42 | 43 | // JSON file parser 44 | type JSONFileParser struct { 45 | ptr interface{} 46 | } 47 | 48 | func newJSONFileParser(ptr interface{}) FlagParser { 49 | return &JSONFileParser{ptr} 50 | } 51 | 52 | func (p JSONFileParser) Parse(s string) error { 53 | return ReadJSONFromFile(s, p.ptr) 54 | } 55 | -------------------------------------------------------------------------------- /vendor/github.com/mkideal/cli/run-examples.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | CWD=`pwd` 6 | EXAMPLE_DIR="./_examples" 7 | EXAMPLES=`ls $EXAMPLE_DIR` 8 | 9 | for APP in $EXAMPLES 10 | do 11 | cd $EXAMPLE_DIR/$APP 12 | SCRIPT="./run.sh" 13 | if [ -f "$SCRIPT" ]; then 14 | echo ">>>> exmaple: $APP" 15 | chmod +x $SCRIPT 16 | $SCRIPT 17 | fi 18 | cd $CWD 19 | done 20 | -------------------------------------------------------------------------------- /vendor/github.com/mkideal/pkg/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (C) 2016 mkideal(i@mkideal.com) 2 | 3 |   Permission is hereby granted, free of charge, to any person obtaining a copy of this 4 | software and associated documentation files (the "Software"), to deal in the Software 5 | without restriction, including without limitation the rights to use, copy, modify, 6 | merge, publish, distribute, sublicense, and/or sell copies of the Software, and to 7 | permit persons to whom the Software is furnished to do so, subject to the following 8 | conditions: 9 |    10 |   The above copyright notice and this permission notice shall be included in all 11 | copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 14 | INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR 15 | PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 16 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT 17 | OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 18 | OTHER DEALINGS IN THE SOFTWARE. 19 | -------------------------------------------------------------------------------- /vendor/github.com/mkideal/pkg/expr/README.md: -------------------------------------------------------------------------------- 1 | expr [![License](http://img.shields.io/badge/license-mit-blue.svg?style=flat-square)](https://raw.githubusercontent.com/mkideal/pkg/master/LICENSE) 2 | =================================================================================================================================================== 3 | 4 | License 5 | ------- 6 | 7 | [The MIT License (MIT)](https://raw.githubusercontent.com/mkideal/pkg/master/LICENSE) 8 | 9 | Install 10 | ------- 11 | 12 | ```shell 13 | go get github.com/mkideal/pkg/expr 14 | ``` 15 | 16 | Expr 17 | ---- 18 | 19 | `Expr` is top-level object of `expr` package. 20 | 21 | `New` function new an Expr from string `s` and `pool`(using default if nil) or get from pool. 22 | 23 | ```go 24 | func New(s string, pool *Pool) (*Expr, error) 25 | ```` 26 | 27 | `Eval` method evaluate expression by VarGetter 28 | 29 | ```go 30 | func (e *Expr) Eval(getter VarGetter) (float64, error) 31 | ``` 32 | 33 | example: 34 | 35 | ```go 36 | e, _ := expr.New("x+1", nil) 37 | getter := expr.VarGetter(map[string]float64{"x": 1}) 38 | result, _ := e.Eval(getter) // result: 2 39 | ``` 40 | 41 | VarGetter 42 | --------- 43 | 44 | `VarGetter` define an interface for getting variable by name. 45 | 46 | `Getter` implements VarGetter using `map[string]float64`. 47 | 48 | ```go 49 | type VarGetter interface { 50 | GetVar(string) (float64, error) 51 | } 52 | 53 | // default VarGetter implement 54 | type Getter map[string]float64 55 | ``` 56 | 57 | Func 58 | ---- 59 | 60 | `Func` define function type used in expression. 61 | 62 | ```go 63 | type Func func(...float64) (float64, error) 64 | ``` 65 | 66 | builtin functions: 67 | 68 | - min(arg1[, arg2, ...]) 69 | - max(arg1[, arg2, ...]) 70 | - rand([arg1[, arg2]]) 71 | - iff(ok, x, y) <==> ok ? x : y 72 | 73 | Pool 74 | ---- 75 | 76 | `Pool` used for cache expression objects. 77 | 78 | ```go 79 | func NewPool(factories ...map[string]Func) (*Pool, error) 80 | ``` 81 | 82 | External 83 | -------- 84 | 85 | - [exp](https://github.com/mkideal/tools/tree/master/exp) - `a command line app for evaluate expression` 86 | -------------------------------------------------------------------------------- /vendor/github.com/robfig/cron/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (C) 2012 Rob Figueiredo 2 | All Rights Reserved. 3 | 4 | MIT LICENSE 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy of 7 | this software and associated documentation files (the "Software"), to deal in 8 | the Software without restriction, including without limitation the rights to 9 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 10 | the Software, and to permit persons to whom the Software is furnished to do so, 11 | subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in all 14 | copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 18 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 19 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 20 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /vendor/github.com/robfig/cron/README.md: -------------------------------------------------------------------------------- 1 | [![GoDoc](http://godoc.org/github.com/robfig/cron?status.png)](http://godoc.org/github.com/robfig/cron) 2 | [![Build Status](https://travis-ci.org/robfig/cron.svg?branch=master)](https://travis-ci.org/robfig/cron) 3 | -------------------------------------------------------------------------------- /vendor/github.com/robfig/cron/constantdelay.go: -------------------------------------------------------------------------------- 1 | package cron 2 | 3 | import "time" 4 | 5 | // ConstantDelaySchedule represents a simple recurring duty cycle, e.g. "Every 5 minutes". 6 | // It does not support jobs more frequent than once a second. 7 | type ConstantDelaySchedule struct { 8 | Delay time.Duration 9 | } 10 | 11 | // Every returns a crontab Schedule that activates once every duration. 12 | // Delays of less than a second are not supported (will round up to 1 second). 13 | // Any fields less than a Second are truncated. 14 | func Every(duration time.Duration) ConstantDelaySchedule { 15 | if duration < time.Second { 16 | duration = time.Second 17 | } 18 | return ConstantDelaySchedule{ 19 | Delay: duration - time.Duration(duration.Nanoseconds())%time.Second, 20 | } 21 | } 22 | 23 | // Next returns the next time this should be run. 24 | // This rounds so that the next activation time will be on the second. 25 | func (schedule ConstantDelaySchedule) Next(t time.Time) time.Time { 26 | return t.Add(schedule.Delay - time.Duration(t.Nanosecond())*time.Nanosecond) 27 | } 28 | -------------------------------------------------------------------------------- /vendor/github.com/valyala/bytebufferpool/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 Aliaksandr Valialkin, VertaMedia 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/valyala/bytebufferpool/README.md: -------------------------------------------------------------------------------- 1 | [![Build Status](https://travis-ci.org/valyala/bytebufferpool.svg)](https://travis-ci.org/valyala/bytebufferpool) 2 | [![GoDoc](https://godoc.org/github.com/valyala/bytebufferpool?status.svg)](http://godoc.org/github.com/valyala/bytebufferpool) 3 | [![Go Report](http://goreportcard.com/badge/valyala/bytebufferpool)](http://goreportcard.com/report/valyala/bytebufferpool) 4 | 5 | # bytebufferpool 6 | 7 | An implementation of a pool of byte buffers with anti-memory-waste protection. 8 | 9 | The pool may waste limited amount of memory due to fragmentation. 10 | This amount equals to the maximum total size of the byte buffers 11 | in concurrent use. 12 | 13 | # Benchmark results 14 | Currently bytebufferpool is fastest and most effective buffer pool written in Go. 15 | 16 | You can find results [here](https://omgnull.github.io/go-benchmark/buffer/). 17 | 18 | # bytebufferpool users 19 | 20 | * [fasthttp](https://github.com/valyala/fasthttp) 21 | * [quicktemplate](https://github.com/valyala/quicktemplate) 22 | -------------------------------------------------------------------------------- /vendor/github.com/valyala/bytebufferpool/doc.go: -------------------------------------------------------------------------------- 1 | // Package bytebufferpool implements a pool of byte buffers 2 | // with anti-fragmentation protection. 3 | // 4 | // The pool may waste limited amount of memory due to fragmentation. 5 | // This amount equals to the maximum total size of the byte buffers 6 | // in concurrent use. 7 | package bytebufferpool 8 | -------------------------------------------------------------------------------- /vendor/github.com/valyala/fasttemplate/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Aliaksandr Valialkin 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/valyala/fasttemplate/unsafe.go: -------------------------------------------------------------------------------- 1 | // +build !appengine 2 | 3 | package fasttemplate 4 | 5 | import ( 6 | "reflect" 7 | "unsafe" 8 | ) 9 | 10 | func unsafeBytes2String(b []byte) string { 11 | return *(*string)(unsafe.Pointer(&b)) 12 | } 13 | 14 | func unsafeString2Bytes(s string) []byte { 15 | sh := (*reflect.StringHeader)(unsafe.Pointer(&s)) 16 | bh := reflect.SliceHeader{ 17 | Data: sh.Data, 18 | Len: sh.Len, 19 | Cap: sh.Len, 20 | } 21 | return *(*[]byte)(unsafe.Pointer(&bh)) 22 | } 23 | -------------------------------------------------------------------------------- /vendor/github.com/valyala/fasttemplate/unsafe_gae.go: -------------------------------------------------------------------------------- 1 | // +build appengine 2 | 3 | package fasttemplate 4 | 5 | func unsafeBytes2String(b []byte) string { 6 | return string(b) 7 | } 8 | 9 | func unsafeString2Bytes(s string) []byte { 10 | return []byte(s) 11 | } 12 | -------------------------------------------------------------------------------- /vendor/golang.org/x/crypto/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2009 The Go Authors. All rights reserved. 2 | 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions are 5 | met: 6 | 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above 10 | copyright notice, this list of conditions and the following disclaimer 11 | in the documentation and/or other materials provided with the 12 | distribution. 13 | * Neither the name of Google Inc. nor the names of its 14 | contributors may be used to endorse or promote products derived from 15 | this software without specific prior written permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | -------------------------------------------------------------------------------- /vendor/golang.org/x/crypto/PATENTS: -------------------------------------------------------------------------------- 1 | Additional IP Rights Grant (Patents) 2 | 3 | "This implementation" means the copyrightable works distributed by 4 | Google as part of the Go project. 5 | 6 | Google hereby grants to You a perpetual, worldwide, non-exclusive, 7 | no-charge, royalty-free, irrevocable (except as stated in this section) 8 | patent license to make, have made, use, offer to sell, sell, import, 9 | transfer and otherwise run, modify and propagate the contents of this 10 | implementation of Go, where such license applies only to those patent 11 | claims, both currently owned or controlled by Google and acquired in 12 | the future, licensable by Google that are necessarily infringed by this 13 | implementation of Go. This grant does not include claims that would be 14 | infringed only as a consequence of further modification of this 15 | implementation. If you or your agent or exclusive licensee institute or 16 | order or agree to the institution of patent litigation against any 17 | entity (including a cross-claim or counterclaim in a lawsuit) alleging 18 | that this implementation of Go or any code incorporated within this 19 | implementation of Go constitutes direct or contributory patent 20 | infringement, or inducement of patent infringement, then any patent 21 | rights granted to you under this License for this implementation of Go 22 | shall terminate as of the date such litigation is filed. 23 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2009 The Go Authors. All rights reserved. 2 | 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions are 5 | met: 6 | 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above 10 | copyright notice, this list of conditions and the following disclaimer 11 | in the documentation and/or other materials provided with the 12 | distribution. 13 | * Neither the name of Google Inc. nor the names of its 14 | contributors may be used to endorse or promote products derived from 15 | this software without specific prior written permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/PATENTS: -------------------------------------------------------------------------------- 1 | Additional IP Rights Grant (Patents) 2 | 3 | "This implementation" means the copyrightable works distributed by 4 | Google as part of the Go project. 5 | 6 | Google hereby grants to You a perpetual, worldwide, non-exclusive, 7 | no-charge, royalty-free, irrevocable (except as stated in this section) 8 | patent license to make, have made, use, offer to sell, sell, import, 9 | transfer and otherwise run, modify and propagate the contents of this 10 | implementation of Go, where such license applies only to those patent 11 | claims, both currently owned or controlled by Google and acquired in 12 | the future, licensable by Google that are necessarily infringed by this 13 | implementation of Go. This grant does not include claims that would be 14 | infringed only as a consequence of further modification of this 15 | implementation. If you or your agent or exclusive licensee institute or 16 | order or agree to the institution of patent litigation against any 17 | entity (including a cross-claim or counterclaim in a lawsuit) alleging 18 | that this implementation of Go or any code incorporated within this 19 | implementation of Go constitutes direct or contributory patent 20 | infringement, or inducement of patent infringement, then any patent 21 | rights granted to you under this License for this implementation of Go 22 | shall terminate as of the date such litigation is filed. 23 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/idna/idna.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 idna implements IDNA2008 (Internationalized Domain Names for 6 | // Applications), defined in RFC 5890, RFC 5891, RFC 5892, RFC 5893 and 7 | // RFC 5894. 8 | package idna // import "golang.org/x/net/idna" 9 | 10 | import ( 11 | "strings" 12 | "unicode/utf8" 13 | ) 14 | 15 | // TODO(nigeltao): specify when errors occur. For example, is ToASCII(".") or 16 | // ToASCII("foo\x00") an error? See also http://www.unicode.org/faq/idn.html#11 17 | 18 | // acePrefix is the ASCII Compatible Encoding prefix. 19 | const acePrefix = "xn--" 20 | 21 | // ToASCII converts a domain or domain label to its ASCII form. For example, 22 | // ToASCII("bücher.example.com") is "xn--bcher-kva.example.com", and 23 | // ToASCII("golang") is "golang". 24 | func ToASCII(s string) (string, error) { 25 | if ascii(s) { 26 | return s, nil 27 | } 28 | labels := strings.Split(s, ".") 29 | for i, label := range labels { 30 | if !ascii(label) { 31 | a, err := encode(acePrefix, label) 32 | if err != nil { 33 | return "", err 34 | } 35 | labels[i] = a 36 | } 37 | } 38 | return strings.Join(labels, "."), nil 39 | } 40 | 41 | // ToUnicode converts a domain or domain label to its Unicode form. For example, 42 | // ToUnicode("xn--bcher-kva.example.com") is "bücher.example.com", and 43 | // ToUnicode("golang") is "golang". 44 | func ToUnicode(s string) (string, error) { 45 | if !strings.Contains(s, acePrefix) { 46 | return s, nil 47 | } 48 | labels := strings.Split(s, ".") 49 | for i, label := range labels { 50 | if strings.HasPrefix(label, acePrefix) { 51 | u, err := decode(label[len(acePrefix):]) 52 | if err != nil { 53 | return "", err 54 | } 55 | labels[i] = u 56 | } 57 | } 58 | return strings.Join(labels, "."), nil 59 | } 60 | 61 | func ascii(s string) bool { 62 | for i := 0; i < len(s); i++ { 63 | if s[i] >= utf8.RuneSelf { 64 | return false 65 | } 66 | } 67 | return true 68 | } 69 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2009 The Go Authors. All rights reserved. 2 | 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions are 5 | met: 6 | 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above 10 | copyright notice, this list of conditions and the following disclaimer 11 | in the documentation and/or other materials provided with the 12 | distribution. 13 | * Neither the name of Google Inc. nor the names of its 14 | contributors may be used to endorse or promote products derived from 15 | this software without specific prior written permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/PATENTS: -------------------------------------------------------------------------------- 1 | Additional IP Rights Grant (Patents) 2 | 3 | "This implementation" means the copyrightable works distributed by 4 | Google as part of the Go project. 5 | 6 | Google hereby grants to You a perpetual, worldwide, non-exclusive, 7 | no-charge, royalty-free, irrevocable (except as stated in this section) 8 | patent license to make, have made, use, offer to sell, sell, import, 9 | transfer and otherwise run, modify and propagate the contents of this 10 | implementation of Go, where such license applies only to those patent 11 | claims, both currently owned or controlled by Google and acquired in 12 | the future, licensable by Google that are necessarily infringed by this 13 | implementation of Go. This grant does not include claims that would be 14 | infringed only as a consequence of further modification of this 15 | implementation. If you or your agent or exclusive licensee institute or 16 | order or agree to the institution of patent litigation against any 17 | entity (including a cross-claim or counterclaim in a lawsuit) alleging 18 | that this implementation of Go or any code incorporated within this 19 | implementation of Go constitutes direct or contributory patent 20 | infringement, or inducement of patent infringement, then any patent 21 | rights granted to you under this License for this implementation of Go 22 | shall terminate as of the date such litigation is filed. 23 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_darwin_386.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for 386, Darwin 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-28 17 | JMP syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-40 20 | JMP syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-52 23 | JMP syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28 26 | JMP syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 29 | JMP syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_darwin_amd64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for AMD64, Darwin 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-56 17 | JMP syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 20 | JMP syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-104 23 | JMP syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 26 | JMP syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 29 | JMP syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_darwin_arm.s: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | // +build arm,darwin 7 | 8 | #include "textflag.h" 9 | 10 | // 11 | // System call support for ARM, Darwin 12 | // 13 | 14 | // Just jump to package syscall's implementation for all these functions. 15 | // The runtime may know about them. 16 | 17 | TEXT ·Syscall(SB),NOSPLIT,$0-28 18 | B syscall·Syscall(SB) 19 | 20 | TEXT ·Syscall6(SB),NOSPLIT,$0-40 21 | B syscall·Syscall6(SB) 22 | 23 | TEXT ·Syscall9(SB),NOSPLIT,$0-52 24 | B syscall·Syscall9(SB) 25 | 26 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28 27 | B syscall·RawSyscall(SB) 28 | 29 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 30 | B syscall·RawSyscall6(SB) 31 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_darwin_arm64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | // +build arm64,darwin 7 | 8 | #include "textflag.h" 9 | 10 | // 11 | // System call support for AMD64, Darwin 12 | // 13 | 14 | // Just jump to package syscall's implementation for all these functions. 15 | // The runtime may know about them. 16 | 17 | TEXT ·Syscall(SB),NOSPLIT,$0-56 18 | B syscall·Syscall(SB) 19 | 20 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 21 | B syscall·Syscall6(SB) 22 | 23 | TEXT ·Syscall9(SB),NOSPLIT,$0-104 24 | B syscall·Syscall9(SB) 25 | 26 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 27 | B syscall·RawSyscall(SB) 28 | 29 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 30 | B syscall·RawSyscall6(SB) 31 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_dragonfly_amd64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for AMD64, DragonFly 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-64 17 | JMP syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-88 20 | JMP syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-112 23 | JMP syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-64 26 | JMP syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-88 29 | JMP syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_freebsd_386.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for 386, FreeBSD 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-28 17 | JMP syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-40 20 | JMP syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-52 23 | JMP syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28 26 | JMP syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 29 | JMP syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_freebsd_amd64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for AMD64, FreeBSD 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-56 17 | JMP syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 20 | JMP syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-104 23 | JMP syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 26 | JMP syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 29 | JMP syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_freebsd_arm.s: -------------------------------------------------------------------------------- 1 | // Copyright 2012 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for ARM, FreeBSD 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-28 17 | B syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-40 20 | B syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-52 23 | B syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28 26 | B syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 29 | B syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_linux_386.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System calls for 386, Linux 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-28 17 | JMP syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-40 20 | JMP syscall·Syscall6(SB) 21 | 22 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28 23 | JMP syscall·RawSyscall(SB) 24 | 25 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 26 | JMP syscall·RawSyscall6(SB) 27 | 28 | TEXT ·socketcall(SB),NOSPLIT,$0-36 29 | JMP syscall·socketcall(SB) 30 | 31 | TEXT ·rawsocketcall(SB),NOSPLIT,$0-36 32 | JMP syscall·rawsocketcall(SB) 33 | 34 | TEXT ·seek(SB),NOSPLIT,$0-28 35 | JMP syscall·seek(SB) 36 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_linux_amd64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System calls for AMD64, Linux 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-56 17 | JMP syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 20 | JMP syscall·Syscall6(SB) 21 | 22 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 23 | JMP syscall·RawSyscall(SB) 24 | 25 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 26 | JMP syscall·RawSyscall6(SB) 27 | 28 | TEXT ·gettimeofday(SB),NOSPLIT,$0-16 29 | JMP syscall·gettimeofday(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_linux_arm.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System calls for arm, Linux 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-28 17 | B syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-40 20 | B syscall·Syscall6(SB) 21 | 22 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28 23 | B syscall·RawSyscall(SB) 24 | 25 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 26 | B syscall·RawSyscall6(SB) 27 | 28 | TEXT ·seek(SB),NOSPLIT,$0-32 29 | B syscall·seek(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_linux_arm64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build linux 6 | // +build arm64 7 | // +build !gccgo 8 | 9 | #include "textflag.h" 10 | 11 | // Just jump to package syscall's implementation for all these functions. 12 | // The runtime may know about them. 13 | 14 | TEXT ·Syscall(SB),NOSPLIT,$0-56 15 | B syscall·Syscall(SB) 16 | 17 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 18 | B syscall·Syscall6(SB) 19 | 20 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 21 | B syscall·RawSyscall(SB) 22 | 23 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 24 | B syscall·RawSyscall6(SB) 25 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_linux_mips64x.s: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build linux 6 | // +build mips64 mips64le 7 | // +build !gccgo 8 | 9 | #include "textflag.h" 10 | 11 | // 12 | // System calls for mips64, Linux 13 | // 14 | 15 | // Just jump to package syscall's implementation for all these functions. 16 | // The runtime may know about them. 17 | 18 | TEXT ·Syscall(SB),NOSPLIT,$0-56 19 | JMP syscall·Syscall(SB) 20 | 21 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 22 | JMP syscall·Syscall6(SB) 23 | 24 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 25 | JMP syscall·RawSyscall(SB) 26 | 27 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 28 | JMP syscall·RawSyscall6(SB) 29 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_linux_mipsx.s: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build linux 6 | // +build mips mipsle 7 | // +build !gccgo 8 | 9 | #include "textflag.h" 10 | 11 | // 12 | // System calls for mips, Linux 13 | // 14 | 15 | // Just jump to package syscall's implementation for all these functions. 16 | // The runtime may know about them. 17 | 18 | TEXT ·Syscall(SB),NOSPLIT,$0-28 19 | JMP syscall·Syscall(SB) 20 | 21 | TEXT ·Syscall6(SB),NOSPLIT,$0-40 22 | JMP syscall·Syscall6(SB) 23 | 24 | TEXT ·Syscall9(SB),NOSPLIT,$0-52 25 | JMP syscall·Syscall9(SB) 26 | 27 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28 28 | JMP syscall·RawSyscall(SB) 29 | 30 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 31 | JMP syscall·RawSyscall6(SB) 32 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_linux_ppc64x.s: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build linux 6 | // +build ppc64 ppc64le 7 | // +build !gccgo 8 | 9 | #include "textflag.h" 10 | 11 | // 12 | // System calls for ppc64, Linux 13 | // 14 | 15 | // Just jump to package syscall's implementation for all these functions. 16 | // The runtime may know about them. 17 | 18 | TEXT ·Syscall(SB),NOSPLIT,$0-56 19 | BR syscall·Syscall(SB) 20 | 21 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 22 | BR syscall·Syscall6(SB) 23 | 24 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 25 | BR syscall·RawSyscall(SB) 26 | 27 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 28 | BR syscall·RawSyscall6(SB) 29 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_linux_s390x.s: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build s390x 6 | // +build linux 7 | // +build !gccgo 8 | 9 | #include "textflag.h" 10 | 11 | // 12 | // System calls for s390x, Linux 13 | // 14 | 15 | // Just jump to package syscall's implementation for all these functions. 16 | // The runtime may know about them. 17 | 18 | TEXT ·Syscall(SB),NOSPLIT,$0-56 19 | BR syscall·Syscall(SB) 20 | 21 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 22 | BR syscall·Syscall6(SB) 23 | 24 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 25 | BR syscall·RawSyscall(SB) 26 | 27 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 28 | BR syscall·RawSyscall6(SB) 29 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_netbsd_386.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for 386, NetBSD 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-28 17 | JMP syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-40 20 | JMP syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-52 23 | JMP syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28 26 | JMP syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 29 | JMP syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_netbsd_amd64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for AMD64, NetBSD 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-56 17 | JMP syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 20 | JMP syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-104 23 | JMP syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 26 | JMP syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 29 | JMP syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_netbsd_arm.s: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for ARM, NetBSD 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-28 17 | B syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-40 20 | B syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-52 23 | B syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28 26 | B syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 29 | B syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_openbsd_386.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for 386, OpenBSD 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-28 17 | JMP syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-40 20 | JMP syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-52 23 | JMP syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28 26 | JMP syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 29 | JMP syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_openbsd_amd64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for AMD64, OpenBSD 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-56 17 | JMP syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 20 | JMP syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-104 23 | JMP syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 26 | JMP syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 29 | JMP syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_solaris_amd64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System calls for amd64, Solaris are implemented in runtime/syscall_solaris.go 11 | // 12 | 13 | TEXT ·sysvicall6(SB),NOSPLIT,$0-88 14 | JMP syscall·sysvicall6(SB) 15 | 16 | TEXT ·rawSysvicall6(SB),NOSPLIT,$0-88 17 | JMP syscall·rawSysvicall6(SB) 18 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/bluetooth_linux.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // Bluetooth sockets and messages 6 | 7 | package unix 8 | 9 | // Bluetooth Protocols 10 | const ( 11 | BTPROTO_L2CAP = 0 12 | BTPROTO_HCI = 1 13 | BTPROTO_SCO = 2 14 | BTPROTO_RFCOMM = 3 15 | BTPROTO_BNEP = 4 16 | BTPROTO_CMTP = 5 17 | BTPROTO_HIDP = 6 18 | BTPROTO_AVDTP = 7 19 | ) 20 | 21 | const ( 22 | HCI_CHANNEL_RAW = 0 23 | HCI_CHANNEL_USER = 1 24 | HCI_CHANNEL_MONITOR = 2 25 | HCI_CHANNEL_CONTROL = 3 26 | ) 27 | 28 | // Socketoption Level 29 | const ( 30 | SOL_BLUETOOTH = 0x112 31 | SOL_HCI = 0x0 32 | SOL_L2CAP = 0x6 33 | SOL_RFCOMM = 0x12 34 | SOL_SCO = 0x11 35 | ) 36 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/constants.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build darwin dragonfly freebsd linux netbsd openbsd solaris 6 | 7 | package unix 8 | 9 | const ( 10 | R_OK = 0x4 11 | W_OK = 0x2 12 | X_OK = 0x1 13 | ) 14 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/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/flock.go: -------------------------------------------------------------------------------- 1 | // +build linux darwin freebsd openbsd netbsd dragonfly 2 | 3 | // Copyright 2014 The Go Authors. All rights reserved. 4 | // Use of this source code is governed by a BSD-style 5 | // license that can be found in the LICENSE file. 6 | 7 | // +build darwin dragonfly freebsd linux netbsd openbsd 8 | 9 | package unix 10 | 11 | import "unsafe" 12 | 13 | // fcntl64Syscall is usually SYS_FCNTL, but is overridden on 32-bit Linux 14 | // systems by flock_linux_32bit.go to be SYS_FCNTL64. 15 | var fcntl64Syscall uintptr = SYS_FCNTL 16 | 17 | // FcntlFlock performs a fcntl syscall for the F_GETLK, F_SETLK or F_SETLKW command. 18 | func FcntlFlock(fd uintptr, cmd int, lk *Flock_t) error { 19 | _, _, errno := Syscall(fcntl64Syscall, fd, uintptr(cmd), uintptr(unsafe.Pointer(lk))) 20 | if errno == 0 { 21 | return nil 22 | } 23 | return errno 24 | } 25 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/flock_linux_32bit.go: -------------------------------------------------------------------------------- 1 | // +build linux,386 linux,arm linux,mips linux,mipsle 2 | 3 | // Copyright 2014 The Go Authors. All rights reserved. 4 | // Use of this source code is governed by a BSD-style 5 | // license that can be found in the LICENSE file. 6 | 7 | package unix 8 | 9 | func init() { 10 | // On 32-bit Linux systems, the fcntl syscall that matches Go's 11 | // Flock_t type is SYS_FCNTL64, not SYS_FCNTL. 12 | fcntl64Syscall = SYS_FCNTL64 13 | } 14 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/gccgo.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build gccgo 6 | 7 | package unix 8 | 9 | import "syscall" 10 | 11 | // We can't use the gc-syntax .s files for gccgo. On the plus side 12 | // much of the functionality can be written directly in Go. 13 | 14 | //extern gccgoRealSyscall 15 | func realSyscall(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r, errno uintptr) 16 | 17 | func Syscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.Errno) { 18 | syscall.Entersyscall() 19 | r, errno := realSyscall(trap, a1, a2, a3, 0, 0, 0, 0, 0, 0) 20 | syscall.Exitsyscall() 21 | return r, 0, syscall.Errno(errno) 22 | } 23 | 24 | func Syscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err syscall.Errno) { 25 | syscall.Entersyscall() 26 | r, errno := realSyscall(trap, a1, a2, a3, a4, a5, a6, 0, 0, 0) 27 | syscall.Exitsyscall() 28 | return r, 0, syscall.Errno(errno) 29 | } 30 | 31 | func Syscall9(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) { 32 | syscall.Entersyscall() 33 | r, errno := realSyscall(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9) 34 | syscall.Exitsyscall() 35 | return r, 0, syscall.Errno(errno) 36 | } 37 | 38 | func RawSyscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.Errno) { 39 | r, errno := realSyscall(trap, a1, a2, a3, 0, 0, 0, 0, 0, 0) 40 | return r, 0, syscall.Errno(errno) 41 | } 42 | 43 | func RawSyscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err syscall.Errno) { 44 | r, errno := realSyscall(trap, a1, a2, a3, a4, a5, a6, 0, 0, 0) 45 | return r, 0, syscall.Errno(errno) 46 | } 47 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/gccgo_c.c: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build gccgo 6 | 7 | #include 8 | #include 9 | #include 10 | 11 | #define _STRINGIFY2_(x) #x 12 | #define _STRINGIFY_(x) _STRINGIFY2_(x) 13 | #define GOSYM_PREFIX _STRINGIFY_(__USER_LABEL_PREFIX__) 14 | 15 | // Call syscall from C code because the gccgo support for calling from 16 | // Go to C does not support varargs functions. 17 | 18 | struct ret { 19 | uintptr_t r; 20 | uintptr_t err; 21 | }; 22 | 23 | struct ret 24 | gccgoRealSyscall(uintptr_t trap, uintptr_t a1, uintptr_t a2, uintptr_t a3, uintptr_t a4, uintptr_t a5, uintptr_t a6, uintptr_t a7, uintptr_t a8, uintptr_t a9) 25 | { 26 | struct ret r; 27 | 28 | errno = 0; 29 | r.r = syscall(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9); 30 | r.err = errno; 31 | return r; 32 | } 33 | 34 | // Define the use function in C so that it is not inlined. 35 | 36 | extern void use(void *) __asm__ (GOSYM_PREFIX GOPKGPATH ".use") __attribute__((noinline)); 37 | 38 | void 39 | use(void *p __attribute__ ((unused))) 40 | { 41 | } 42 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/gccgo_linux_amd64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build gccgo,linux,amd64 6 | 7 | package unix 8 | 9 | import "syscall" 10 | 11 | //extern gettimeofday 12 | func realGettimeofday(*Timeval, *byte) int32 13 | 14 | func gettimeofday(tv *Timeval) (err syscall.Errno) { 15 | r := realGettimeofday(tv, nil) 16 | if r < 0 { 17 | return syscall.GetErrno() 18 | } 19 | return 0 20 | } 21 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/gccgo_linux_sparc64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build gccgo,linux,sparc64 6 | 7 | package unix 8 | 9 | import "syscall" 10 | 11 | //extern sysconf 12 | func realSysconf(name int) int64 13 | 14 | func sysconf(name int) (n int64, err syscall.Errno) { 15 | r := realSysconf(name) 16 | if r < 0 { 17 | return 0, syscall.GetErrno() 18 | } 19 | return r, 0 20 | } 21 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/mksysnum_darwin.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | # Copyright 2009 The Go Authors. All rights reserved. 3 | # Use of this source code is governed by a BSD-style 4 | # license that can be found in the LICENSE file. 5 | # 6 | # Generate system call table for Darwin from sys/syscall.h 7 | 8 | use strict; 9 | 10 | if($ENV{'GOARCH'} eq "" || $ENV{'GOOS'} eq "") { 11 | print STDERR "GOARCH or GOOS not defined in environment\n"; 12 | exit 1; 13 | } 14 | 15 | my $command = "mksysnum_darwin.pl " . join(' ', @ARGV); 16 | 17 | print <){ 29 | if(/^#define\s+SYS_(\w+)\s+([0-9]+)/){ 30 | my $name = $1; 31 | my $num = $2; 32 | $name =~ y/a-z/A-Z/; 33 | print " SYS_$name = $num;" 34 | } 35 | } 36 | 37 | print <){ 30 | if(/^([0-9]+)\s+STD\s+({ \S+\s+(\w+).*)$/){ 31 | my $num = $1; 32 | my $proto = $2; 33 | my $name = "SYS_$3"; 34 | $name =~ y/a-z/A-Z/; 35 | 36 | # There are multiple entries for enosys and nosys, so comment them out. 37 | if($name =~ /^SYS_E?NOSYS$/){ 38 | $name = "// $name"; 39 | } 40 | if($name eq 'SYS_SYS_EXIT'){ 41 | $name = 'SYS_EXIT'; 42 | } 43 | 44 | print " $name = $num; // $proto\n"; 45 | } 46 | } 47 | 48 | print <){ 30 | if(/^([0-9]+)\s+\S+\s+STD\s+({ \S+\s+(\w+).*)$/){ 31 | my $num = $1; 32 | my $proto = $2; 33 | my $name = "SYS_$3"; 34 | $name =~ y/a-z/A-Z/; 35 | 36 | # There are multiple entries for enosys and nosys, so comment them out. 37 | if($name =~ /^SYS_E?NOSYS$/){ 38 | $name = "// $name"; 39 | } 40 | if($name eq 'SYS_SYS_EXIT'){ 41 | $name = 'SYS_EXIT'; 42 | } 43 | if($name =~ /^SYS_CAP_+/ || $name =~ /^SYS___CAP_+/){ 44 | next 45 | } 46 | 47 | print " $name = $num; // $proto\n"; 48 | 49 | # We keep Capsicum syscall numbers for FreeBSD 50 | # 9-STABLE here because we are not sure whether they 51 | # are mature and stable. 52 | if($num == 513){ 53 | print " SYS_CAP_NEW = 514 // { int cap_new(int fd, uint64_t rights); }\n"; 54 | print " SYS_CAP_GETRIGHTS = 515 // { int cap_getrights(int fd, \\\n"; 55 | print " SYS_CAP_ENTER = 516 // { int cap_enter(void); }\n"; 56 | print " SYS_CAP_GETMODE = 517 // { int cap_getmode(u_int *modep); }\n"; 57 | } 58 | } 59 | } 60 | 61 | print <){ 31 | if($line =~ /^(.*)\\$/) { 32 | # Handle continuation 33 | $line = $1; 34 | $_ =~ s/^\s+//; 35 | $line .= $_; 36 | } else { 37 | # New line 38 | $line = $_; 39 | } 40 | next if $line =~ /\\$/; 41 | if($line =~ /^([0-9]+)\s+((STD)|(NOERR))\s+(RUMP\s+)?({\s+\S+\s*\*?\s*\|(\S+)\|(\S*)\|(\w+).*\s+})(\s+(\S+))?$/) { 42 | my $num = $1; 43 | my $proto = $6; 44 | my $compat = $8; 45 | my $name = "$7_$9"; 46 | 47 | $name = "$7_$11" if $11 ne ''; 48 | $name =~ y/a-z/A-Z/; 49 | 50 | if($compat eq '' || $compat eq '30' || $compat eq '50') { 51 | print " $name = $num; // $proto\n"; 52 | } 53 | } 54 | } 55 | 56 | print <){ 30 | if(/^([0-9]+)\s+STD\s+(NOLOCK\s+)?({ \S+\s+\*?(\w+).*)$/){ 31 | my $num = $1; 32 | my $proto = $3; 33 | my $name = $4; 34 | $name =~ y/a-z/A-Z/; 35 | 36 | # There are multiple entries for enosys and nosys, so comment them out. 37 | if($name =~ /^SYS_E?NOSYS$/){ 38 | $name = "// $name"; 39 | } 40 | if($name eq 'SYS_SYS_EXIT'){ 41 | $name = 'SYS_EXIT'; 42 | } 43 | 44 | print " $name = $num; // $proto\n"; 45 | } 46 | } 47 | 48 | print <= 10 { 20 | buf[i] = byte(val%10 + '0') 21 | i-- 22 | val /= 10 23 | } 24 | buf[i] = byte(val + '0') 25 | return string(buf[i:]) 26 | } 27 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_darwin_386.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build 386,darwin 6 | 7 | package unix 8 | 9 | import ( 10 | "syscall" 11 | "unsafe" 12 | ) 13 | 14 | func Getpagesize() int { return 4096 } 15 | 16 | func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) } 17 | 18 | func NsecToTimespec(nsec int64) (ts Timespec) { 19 | ts.Sec = int32(nsec / 1e9) 20 | ts.Nsec = int32(nsec % 1e9) 21 | return 22 | } 23 | 24 | func NsecToTimeval(nsec int64) (tv Timeval) { 25 | nsec += 999 // round up to microsecond 26 | tv.Usec = int32(nsec % 1e9 / 1e3) 27 | tv.Sec = int32(nsec / 1e9) 28 | return 29 | } 30 | 31 | //sysnb gettimeofday(tp *Timeval) (sec int32, usec int32, err error) 32 | func Gettimeofday(tv *Timeval) (err error) { 33 | // The tv passed to gettimeofday must be non-nil 34 | // but is otherwise unused. The answers come back 35 | // in the two registers. 36 | sec, usec, err := gettimeofday(tv) 37 | tv.Sec = int32(sec) 38 | tv.Usec = int32(usec) 39 | return err 40 | } 41 | 42 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 43 | k.Ident = uint32(fd) 44 | k.Filter = int16(mode) 45 | k.Flags = uint16(flags) 46 | } 47 | 48 | func (iov *Iovec) SetLen(length int) { 49 | iov.Len = uint32(length) 50 | } 51 | 52 | func (msghdr *Msghdr) SetControllen(length int) { 53 | msghdr.Controllen = uint32(length) 54 | } 55 | 56 | func (cmsg *Cmsghdr) SetLen(length int) { 57 | cmsg.Len = uint32(length) 58 | } 59 | 60 | func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) { 61 | var length = uint64(count) 62 | 63 | _, _, e1 := Syscall9(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr(*offset>>32), uintptr(unsafe.Pointer(&length)), 0, 0, 0, 0) 64 | 65 | written = int(length) 66 | 67 | if e1 != 0 { 68 | err = e1 69 | } 70 | return 71 | } 72 | 73 | func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) 74 | 75 | // SYS___SYSCTL is used by syscall_bsd.go for all BSDs, but in modern versions 76 | // of darwin/386 the syscall is called sysctl instead of __sysctl. 77 | const SYS___SYSCTL = SYS_SYSCTL 78 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_darwin_amd64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build amd64,darwin 6 | 7 | package unix 8 | 9 | import ( 10 | "syscall" 11 | "unsafe" 12 | ) 13 | 14 | //sys Fchmodat(dirfd int, path string, mode uint32, flags int) (err error) 15 | 16 | func Getpagesize() int { return 4096 } 17 | 18 | func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) } 19 | 20 | func NsecToTimespec(nsec int64) (ts Timespec) { 21 | ts.Sec = nsec / 1e9 22 | ts.Nsec = nsec % 1e9 23 | return 24 | } 25 | 26 | func NsecToTimeval(nsec int64) (tv Timeval) { 27 | nsec += 999 // round up to microsecond 28 | tv.Usec = int32(nsec % 1e9 / 1e3) 29 | tv.Sec = int64(nsec / 1e9) 30 | return 31 | } 32 | 33 | //sysnb gettimeofday(tp *Timeval) (sec int64, usec int32, err error) 34 | func Gettimeofday(tv *Timeval) (err error) { 35 | // The tv passed to gettimeofday must be non-nil 36 | // but is otherwise unused. The answers come back 37 | // in the two registers. 38 | sec, usec, err := gettimeofday(tv) 39 | tv.Sec = sec 40 | tv.Usec = usec 41 | return err 42 | } 43 | 44 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 45 | k.Ident = uint64(fd) 46 | k.Filter = int16(mode) 47 | k.Flags = uint16(flags) 48 | } 49 | 50 | func (iov *Iovec) SetLen(length int) { 51 | iov.Len = uint64(length) 52 | } 53 | 54 | func (msghdr *Msghdr) SetControllen(length int) { 55 | msghdr.Controllen = uint32(length) 56 | } 57 | 58 | func (cmsg *Cmsghdr) SetLen(length int) { 59 | cmsg.Len = uint32(length) 60 | } 61 | 62 | func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) { 63 | var length = uint64(count) 64 | 65 | _, _, e1 := Syscall6(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr(unsafe.Pointer(&length)), 0, 0) 66 | 67 | written = int(length) 68 | 69 | if e1 != 0 { 70 | err = e1 71 | } 72 | return 73 | } 74 | 75 | func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) 76 | 77 | // SYS___SYSCTL is used by syscall_bsd.go for all BSDs, but in modern versions 78 | // of darwin/amd64 the syscall is called sysctl instead of __sysctl. 79 | const SYS___SYSCTL = SYS_SYSCTL 80 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_darwin_arm.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package unix 6 | 7 | import ( 8 | "syscall" 9 | "unsafe" 10 | ) 11 | 12 | func Getpagesize() int { return 4096 } 13 | 14 | func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) } 15 | 16 | func NsecToTimespec(nsec int64) (ts Timespec) { 17 | ts.Sec = int32(nsec / 1e9) 18 | ts.Nsec = int32(nsec % 1e9) 19 | return 20 | } 21 | 22 | func NsecToTimeval(nsec int64) (tv Timeval) { 23 | nsec += 999 // round up to microsecond 24 | tv.Usec = int32(nsec % 1e9 / 1e3) 25 | tv.Sec = int32(nsec / 1e9) 26 | return 27 | } 28 | 29 | //sysnb gettimeofday(tp *Timeval) (sec int32, usec int32, err error) 30 | func Gettimeofday(tv *Timeval) (err error) { 31 | // The tv passed to gettimeofday must be non-nil 32 | // but is otherwise unused. The answers come back 33 | // in the two registers. 34 | sec, usec, err := gettimeofday(tv) 35 | tv.Sec = int32(sec) 36 | tv.Usec = int32(usec) 37 | return err 38 | } 39 | 40 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 41 | k.Ident = uint32(fd) 42 | k.Filter = int16(mode) 43 | k.Flags = uint16(flags) 44 | } 45 | 46 | func (iov *Iovec) SetLen(length int) { 47 | iov.Len = uint32(length) 48 | } 49 | 50 | func (msghdr *Msghdr) SetControllen(length int) { 51 | msghdr.Controllen = uint32(length) 52 | } 53 | 54 | func (cmsg *Cmsghdr) SetLen(length int) { 55 | cmsg.Len = uint32(length) 56 | } 57 | 58 | func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) { 59 | var length = uint64(count) 60 | 61 | _, _, e1 := Syscall9(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr(*offset>>32), uintptr(unsafe.Pointer(&length)), 0, 0, 0, 0) 62 | 63 | written = int(length) 64 | 65 | if e1 != 0 { 66 | err = e1 67 | } 68 | return 69 | } 70 | 71 | func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) // sic 72 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_darwin_arm64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build arm64,darwin 6 | 7 | package unix 8 | 9 | import ( 10 | "syscall" 11 | "unsafe" 12 | ) 13 | 14 | func Getpagesize() int { return 16384 } 15 | 16 | func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) } 17 | 18 | func NsecToTimespec(nsec int64) (ts Timespec) { 19 | ts.Sec = nsec / 1e9 20 | ts.Nsec = nsec % 1e9 21 | return 22 | } 23 | 24 | func NsecToTimeval(nsec int64) (tv Timeval) { 25 | nsec += 999 // round up to microsecond 26 | tv.Usec = int32(nsec % 1e9 / 1e3) 27 | tv.Sec = int64(nsec / 1e9) 28 | return 29 | } 30 | 31 | //sysnb gettimeofday(tp *Timeval) (sec int64, usec int32, err error) 32 | func Gettimeofday(tv *Timeval) (err error) { 33 | // The tv passed to gettimeofday must be non-nil 34 | // but is otherwise unused. The answers come back 35 | // in the two registers. 36 | sec, usec, err := gettimeofday(tv) 37 | tv.Sec = sec 38 | tv.Usec = usec 39 | return err 40 | } 41 | 42 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 43 | k.Ident = uint64(fd) 44 | k.Filter = int16(mode) 45 | k.Flags = uint16(flags) 46 | } 47 | 48 | func (iov *Iovec) SetLen(length int) { 49 | iov.Len = uint64(length) 50 | } 51 | 52 | func (msghdr *Msghdr) SetControllen(length int) { 53 | msghdr.Controllen = uint32(length) 54 | } 55 | 56 | func (cmsg *Cmsghdr) SetLen(length int) { 57 | cmsg.Len = uint32(length) 58 | } 59 | 60 | func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) { 61 | var length = uint64(count) 62 | 63 | _, _, e1 := Syscall6(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr(unsafe.Pointer(&length)), 0, 0) 64 | 65 | written = int(length) 66 | 67 | if e1 != 0 { 68 | err = e1 69 | } 70 | return 71 | } 72 | 73 | func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) // sic 74 | 75 | // SYS___SYSCTL is used by syscall_bsd.go for all BSDs, but in modern versions 76 | // of darwin/arm64 the syscall is called sysctl instead of __sysctl. 77 | const SYS___SYSCTL = SYS_SYSCTL 78 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_dragonfly_amd64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build amd64,dragonfly 6 | 7 | package unix 8 | 9 | import ( 10 | "syscall" 11 | "unsafe" 12 | ) 13 | 14 | func Getpagesize() int { return 4096 } 15 | 16 | func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) } 17 | 18 | func NsecToTimespec(nsec int64) (ts Timespec) { 19 | ts.Sec = nsec / 1e9 20 | ts.Nsec = nsec % 1e9 21 | return 22 | } 23 | 24 | func NsecToTimeval(nsec int64) (tv Timeval) { 25 | nsec += 999 // round up to microsecond 26 | tv.Usec = nsec % 1e9 / 1e3 27 | tv.Sec = int64(nsec / 1e9) 28 | return 29 | } 30 | 31 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 32 | k.Ident = uint64(fd) 33 | k.Filter = int16(mode) 34 | k.Flags = uint16(flags) 35 | } 36 | 37 | func (iov *Iovec) SetLen(length int) { 38 | iov.Len = uint64(length) 39 | } 40 | 41 | func (msghdr *Msghdr) SetControllen(length int) { 42 | msghdr.Controllen = uint32(length) 43 | } 44 | 45 | func (cmsg *Cmsghdr) SetLen(length int) { 46 | cmsg.Len = uint32(length) 47 | } 48 | 49 | func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) { 50 | var writtenOut uint64 = 0 51 | _, _, e1 := Syscall9(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr(count), 0, uintptr(unsafe.Pointer(&writtenOut)), 0, 0, 0) 52 | 53 | written = int(writtenOut) 54 | 55 | if e1 != 0 { 56 | err = e1 57 | } 58 | return 59 | } 60 | 61 | func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) 62 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_freebsd_386.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build 386,freebsd 6 | 7 | package unix 8 | 9 | import ( 10 | "syscall" 11 | "unsafe" 12 | ) 13 | 14 | func Getpagesize() int { return 4096 } 15 | 16 | func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) } 17 | 18 | func NsecToTimespec(nsec int64) (ts Timespec) { 19 | ts.Sec = int32(nsec / 1e9) 20 | ts.Nsec = int32(nsec % 1e9) 21 | return 22 | } 23 | 24 | func NsecToTimeval(nsec int64) (tv Timeval) { 25 | nsec += 999 // round up to microsecond 26 | tv.Usec = int32(nsec % 1e9 / 1e3) 27 | tv.Sec = int32(nsec / 1e9) 28 | return 29 | } 30 | 31 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 32 | k.Ident = uint32(fd) 33 | k.Filter = int16(mode) 34 | k.Flags = uint16(flags) 35 | } 36 | 37 | func (iov *Iovec) SetLen(length int) { 38 | iov.Len = uint32(length) 39 | } 40 | 41 | func (msghdr *Msghdr) SetControllen(length int) { 42 | msghdr.Controllen = uint32(length) 43 | } 44 | 45 | func (cmsg *Cmsghdr) SetLen(length int) { 46 | cmsg.Len = uint32(length) 47 | } 48 | 49 | func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) { 50 | var writtenOut uint64 = 0 51 | _, _, e1 := Syscall9(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr((*offset)>>32), uintptr(count), 0, uintptr(unsafe.Pointer(&writtenOut)), 0, 0) 52 | 53 | written = int(writtenOut) 54 | 55 | if e1 != 0 { 56 | err = e1 57 | } 58 | return 59 | } 60 | 61 | func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) 62 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_freebsd_amd64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build amd64,freebsd 6 | 7 | package unix 8 | 9 | import ( 10 | "syscall" 11 | "unsafe" 12 | ) 13 | 14 | func Getpagesize() int { return 4096 } 15 | 16 | func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) } 17 | 18 | func NsecToTimespec(nsec int64) (ts Timespec) { 19 | ts.Sec = nsec / 1e9 20 | ts.Nsec = nsec % 1e9 21 | return 22 | } 23 | 24 | func NsecToTimeval(nsec int64) (tv Timeval) { 25 | nsec += 999 // round up to microsecond 26 | tv.Usec = nsec % 1e9 / 1e3 27 | tv.Sec = int64(nsec / 1e9) 28 | return 29 | } 30 | 31 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 32 | k.Ident = uint64(fd) 33 | k.Filter = int16(mode) 34 | k.Flags = uint16(flags) 35 | } 36 | 37 | func (iov *Iovec) SetLen(length int) { 38 | iov.Len = uint64(length) 39 | } 40 | 41 | func (msghdr *Msghdr) SetControllen(length int) { 42 | msghdr.Controllen = uint32(length) 43 | } 44 | 45 | func (cmsg *Cmsghdr) SetLen(length int) { 46 | cmsg.Len = uint32(length) 47 | } 48 | 49 | func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) { 50 | var writtenOut uint64 = 0 51 | _, _, e1 := Syscall9(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr(count), 0, uintptr(unsafe.Pointer(&writtenOut)), 0, 0, 0) 52 | 53 | written = int(writtenOut) 54 | 55 | if e1 != 0 { 56 | err = e1 57 | } 58 | return 59 | } 60 | 61 | func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) 62 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_freebsd_arm.go: -------------------------------------------------------------------------------- 1 | // Copyright 2012 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build arm,freebsd 6 | 7 | package unix 8 | 9 | import ( 10 | "syscall" 11 | "unsafe" 12 | ) 13 | 14 | func Getpagesize() int { return 4096 } 15 | 16 | func TimespecToNsec(ts Timespec) int64 { return ts.Sec*1e9 + int64(ts.Nsec) } 17 | 18 | func NsecToTimespec(nsec int64) (ts Timespec) { 19 | ts.Sec = nsec / 1e9 20 | ts.Nsec = int32(nsec % 1e9) 21 | return 22 | } 23 | 24 | func NsecToTimeval(nsec int64) (tv Timeval) { 25 | nsec += 999 // round up to microsecond 26 | tv.Usec = int32(nsec % 1e9 / 1e3) 27 | tv.Sec = nsec / 1e9 28 | return 29 | } 30 | 31 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 32 | k.Ident = uint32(fd) 33 | k.Filter = int16(mode) 34 | k.Flags = uint16(flags) 35 | } 36 | 37 | func (iov *Iovec) SetLen(length int) { 38 | iov.Len = uint32(length) 39 | } 40 | 41 | func (msghdr *Msghdr) SetControllen(length int) { 42 | msghdr.Controllen = uint32(length) 43 | } 44 | 45 | func (cmsg *Cmsghdr) SetLen(length int) { 46 | cmsg.Len = uint32(length) 47 | } 48 | 49 | func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) { 50 | var writtenOut uint64 = 0 51 | _, _, e1 := Syscall9(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr((*offset)>>32), uintptr(count), 0, uintptr(unsafe.Pointer(&writtenOut)), 0, 0) 52 | 53 | written = int(writtenOut) 54 | 55 | if e1 != 0 { 56 | err = e1 57 | } 58 | return 59 | } 60 | 61 | func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) 62 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_linux_amd64_gc.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build amd64,linux 6 | // +build !gccgo 7 | 8 | package unix 9 | 10 | import "syscall" 11 | 12 | //go:noescape 13 | func gettimeofday(tv *Timeval) (err syscall.Errno) 14 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_netbsd_386.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build 386,netbsd 6 | 7 | package unix 8 | 9 | func Getpagesize() int { return 4096 } 10 | 11 | func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) } 12 | 13 | func NsecToTimespec(nsec int64) (ts Timespec) { 14 | ts.Sec = int64(nsec / 1e9) 15 | ts.Nsec = int32(nsec % 1e9) 16 | return 17 | } 18 | 19 | func NsecToTimeval(nsec int64) (tv Timeval) { 20 | nsec += 999 // round up to microsecond 21 | tv.Usec = int32(nsec % 1e9 / 1e3) 22 | tv.Sec = int64(nsec / 1e9) 23 | return 24 | } 25 | 26 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 27 | k.Ident = uint32(fd) 28 | k.Filter = uint32(mode) 29 | k.Flags = uint32(flags) 30 | } 31 | 32 | func (iov *Iovec) SetLen(length int) { 33 | iov.Len = uint32(length) 34 | } 35 | 36 | func (msghdr *Msghdr) SetControllen(length int) { 37 | msghdr.Controllen = uint32(length) 38 | } 39 | 40 | func (cmsg *Cmsghdr) SetLen(length int) { 41 | cmsg.Len = uint32(length) 42 | } 43 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_netbsd_amd64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build amd64,netbsd 6 | 7 | package unix 8 | 9 | func Getpagesize() int { return 4096 } 10 | 11 | func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) } 12 | 13 | func NsecToTimespec(nsec int64) (ts Timespec) { 14 | ts.Sec = int64(nsec / 1e9) 15 | ts.Nsec = int64(nsec % 1e9) 16 | return 17 | } 18 | 19 | func NsecToTimeval(nsec int64) (tv Timeval) { 20 | nsec += 999 // round up to microsecond 21 | tv.Usec = int32(nsec % 1e9 / 1e3) 22 | tv.Sec = int64(nsec / 1e9) 23 | return 24 | } 25 | 26 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 27 | k.Ident = uint64(fd) 28 | k.Filter = uint32(mode) 29 | k.Flags = uint32(flags) 30 | } 31 | 32 | func (iov *Iovec) SetLen(length int) { 33 | iov.Len = uint64(length) 34 | } 35 | 36 | func (msghdr *Msghdr) SetControllen(length int) { 37 | msghdr.Controllen = uint32(length) 38 | } 39 | 40 | func (cmsg *Cmsghdr) SetLen(length int) { 41 | cmsg.Len = uint32(length) 42 | } 43 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_netbsd_arm.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build arm,netbsd 6 | 7 | package unix 8 | 9 | func Getpagesize() int { return 4096 } 10 | 11 | func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) } 12 | 13 | func NsecToTimespec(nsec int64) (ts Timespec) { 14 | ts.Sec = int64(nsec / 1e9) 15 | ts.Nsec = int32(nsec % 1e9) 16 | return 17 | } 18 | 19 | func NsecToTimeval(nsec int64) (tv Timeval) { 20 | nsec += 999 // round up to microsecond 21 | tv.Usec = int32(nsec % 1e9 / 1e3) 22 | tv.Sec = int64(nsec / 1e9) 23 | return 24 | } 25 | 26 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 27 | k.Ident = uint32(fd) 28 | k.Filter = uint32(mode) 29 | k.Flags = uint32(flags) 30 | } 31 | 32 | func (iov *Iovec) SetLen(length int) { 33 | iov.Len = uint32(length) 34 | } 35 | 36 | func (msghdr *Msghdr) SetControllen(length int) { 37 | msghdr.Controllen = uint32(length) 38 | } 39 | 40 | func (cmsg *Cmsghdr) SetLen(length int) { 41 | cmsg.Len = uint32(length) 42 | } 43 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_no_getwd.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build dragonfly freebsd netbsd openbsd 6 | 7 | package unix 8 | 9 | const ImplementsGetwd = false 10 | 11 | func Getwd() (string, error) { return "", ENOTSUP } 12 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_openbsd_386.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build 386,openbsd 6 | 7 | package unix 8 | 9 | func Getpagesize() int { return 4096 } 10 | 11 | func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) } 12 | 13 | func NsecToTimespec(nsec int64) (ts Timespec) { 14 | ts.Sec = int64(nsec / 1e9) 15 | ts.Nsec = int32(nsec % 1e9) 16 | return 17 | } 18 | 19 | func NsecToTimeval(nsec int64) (tv Timeval) { 20 | nsec += 999 // round up to microsecond 21 | tv.Usec = int32(nsec % 1e9 / 1e3) 22 | tv.Sec = int64(nsec / 1e9) 23 | return 24 | } 25 | 26 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 27 | k.Ident = uint32(fd) 28 | k.Filter = int16(mode) 29 | k.Flags = uint16(flags) 30 | } 31 | 32 | func (iov *Iovec) SetLen(length int) { 33 | iov.Len = uint32(length) 34 | } 35 | 36 | func (msghdr *Msghdr) SetControllen(length int) { 37 | msghdr.Controllen = uint32(length) 38 | } 39 | 40 | func (cmsg *Cmsghdr) SetLen(length int) { 41 | cmsg.Len = uint32(length) 42 | } 43 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_openbsd_amd64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build amd64,openbsd 6 | 7 | package unix 8 | 9 | func Getpagesize() int { return 4096 } 10 | 11 | func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) } 12 | 13 | func NsecToTimespec(nsec int64) (ts Timespec) { 14 | ts.Sec = nsec / 1e9 15 | ts.Nsec = nsec % 1e9 16 | return 17 | } 18 | 19 | func NsecToTimeval(nsec int64) (tv Timeval) { 20 | nsec += 999 // round up to microsecond 21 | tv.Usec = nsec % 1e9 / 1e3 22 | tv.Sec = nsec / 1e9 23 | return 24 | } 25 | 26 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 27 | k.Ident = uint64(fd) 28 | k.Filter = int16(mode) 29 | k.Flags = uint16(flags) 30 | } 31 | 32 | func (iov *Iovec) SetLen(length int) { 33 | iov.Len = uint64(length) 34 | } 35 | 36 | func (msghdr *Msghdr) SetControllen(length int) { 37 | msghdr.Controllen = uint32(length) 38 | } 39 | 40 | func (cmsg *Cmsghdr) SetLen(length int) { 41 | cmsg.Len = uint32(length) 42 | } 43 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_solaris_amd64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build amd64,solaris 6 | 7 | package unix 8 | 9 | func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) } 10 | 11 | func NsecToTimespec(nsec int64) (ts Timespec) { 12 | ts.Sec = nsec / 1e9 13 | ts.Nsec = nsec % 1e9 14 | return 15 | } 16 | 17 | func NsecToTimeval(nsec int64) (tv Timeval) { 18 | nsec += 999 // round up to microsecond 19 | tv.Usec = nsec % 1e9 / 1e3 20 | tv.Sec = int64(nsec / 1e9) 21 | return 22 | } 23 | 24 | func (iov *Iovec) SetLen(length int) { 25 | iov.Len = uint64(length) 26 | } 27 | 28 | func (cmsg *Cmsghdr) SetLen(length int) { 29 | cmsg.Len = uint32(length) 30 | } 31 | 32 | func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) { 33 | // TODO(aram): implement this, see issue 5847. 34 | panic("unimplemented") 35 | } 36 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_unix_gc.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build darwin dragonfly freebsd linux netbsd openbsd solaris 6 | // +build !gccgo 7 | 8 | package unix 9 | 10 | import "syscall" 11 | 12 | func Syscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.Errno) 13 | func Syscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err syscall.Errno) 14 | func RawSyscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.Errno) 15 | func RawSyscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err syscall.Errno) 16 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/zsysnum_solaris_amd64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build amd64,solaris 6 | 7 | package unix 8 | 9 | // TODO(aram): remove these before Go 1.3. 10 | const ( 11 | SYS_EXECVE = 59 12 | SYS_FCNTL = 62 13 | ) 14 | -------------------------------------------------------------------------------- /vendor/golang.org/x/text/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/text/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/text/unicode/norm/trie.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 norm 6 | 7 | type valueRange struct { 8 | value uint16 // header: value:stride 9 | lo, hi byte // header: lo:n 10 | } 11 | 12 | type sparseBlocks struct { 13 | values []valueRange 14 | offset []uint16 15 | } 16 | 17 | var nfcSparse = sparseBlocks{ 18 | values: nfcSparseValues[:], 19 | offset: nfcSparseOffset[:], 20 | } 21 | 22 | var nfkcSparse = sparseBlocks{ 23 | values: nfkcSparseValues[:], 24 | offset: nfkcSparseOffset[:], 25 | } 26 | 27 | var ( 28 | nfcData = newNfcTrie(0) 29 | nfkcData = newNfkcTrie(0) 30 | ) 31 | 32 | // lookupValue determines the type of block n and looks up the value for b. 33 | // For n < t.cutoff, the block is a simple lookup table. Otherwise, the block 34 | // is a list of ranges with an accompanying value. Given a matching range r, 35 | // the value for b is by r.value + (b - r.lo) * stride. 36 | func (t *sparseBlocks) lookup(n uint32, b byte) uint16 { 37 | offset := t.offset[n] 38 | header := t.values[offset] 39 | lo := offset + 1 40 | hi := lo + uint16(header.lo) 41 | for lo < hi { 42 | m := lo + (hi-lo)/2 43 | r := t.values[m] 44 | if r.lo <= b && b <= r.hi { 45 | return r.value + uint16(b-r.lo)*header.value 46 | } 47 | if b < r.lo { 48 | hi = m 49 | } else { 50 | lo = m + 1 51 | } 52 | } 53 | return 0 54 | } 55 | -------------------------------------------------------------------------------- /vendor/golang.org/x/text/width/kind_string.go: -------------------------------------------------------------------------------- 1 | // Code generated by "stringer -type=Kind"; DO NOT EDIT. 2 | 3 | package width 4 | 5 | import "fmt" 6 | 7 | const _Kind_name = "NeutralEastAsianAmbiguousEastAsianWideEastAsianNarrowEastAsianFullwidthEastAsianHalfwidth" 8 | 9 | var _Kind_index = [...]uint8{0, 7, 25, 38, 53, 71, 89} 10 | 11 | func (i Kind) String() string { 12 | if i < 0 || i >= Kind(len(_Kind_index)-1) { 13 | return fmt.Sprintf("Kind(%d)", i) 14 | } 15 | return _Kind_name[_Kind_index[i]:_Kind_index[i+1]] 16 | } 17 | -------------------------------------------------------------------------------- /vendor/golang.org/x/text/width/trieval.go: -------------------------------------------------------------------------------- 1 | // Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. 2 | 3 | package width 4 | 5 | // elem is an entry of the width trie. The high byte is used to encode the type 6 | // of the rune. The low byte is used to store the index to a mapping entry in 7 | // the inverseData array. 8 | type elem uint16 9 | 10 | const ( 11 | tagNeutral elem = iota << typeShift 12 | tagAmbiguous 13 | tagWide 14 | tagNarrow 15 | tagFullwidth 16 | tagHalfwidth 17 | ) 18 | 19 | const ( 20 | numTypeBits = 3 21 | typeShift = 16 - numTypeBits 22 | 23 | // tagNeedsFold is true for all fullwidth and halfwidth runes except for 24 | // the Won sign U+20A9. 25 | tagNeedsFold = 0x1000 26 | 27 | // The Korean Won sign is halfwidth, but SHOULD NOT be mapped to a wide 28 | // variant. 29 | wonSign rune = 0x20A9 30 | ) 31 | -------------------------------------------------------------------------------- /vendor/gopkg.in/doug-martin/goqu.v4/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | ## Contributions 2 | 3 | I am always welcoming contributions of any type. Please open an issue or create a PR if you find an issue with any of the following. 4 | 5 | * An issue with Documentation 6 | * You found the documentation lacking in some way 7 | 8 | If you have an issue with the package please include the following 9 | 10 | * The dialect you are using 11 | * A description of the problem 12 | * A short example of how to reproduce (if applicable) 13 | 14 | Without those basics it can be difficult to reproduce your issue locally. You may be asked for more information but that is a good starting point. 15 | 16 | ### New Features 17 | 18 | New features and/or enhancements are great and I encourage you to either submit a PR or create an issue. In both cases include the following as the need/requirement may not be readily apparent. 19 | 20 | 1. The use case 21 | 2. A short example 22 | 23 | If you are issuing a PR also also include the following 24 | 25 | 1. Tests - otherwise the PR will not be merged 26 | 2. Documentation - otherwise the PR will not be merged 27 | 3. Examples - [If applicable] see example_test.go for examples 28 | 29 | If you find an issue you want to work on please comment on it letting other people know you are looking at it and I will assign the issue to you. 30 | 31 | If want to work on an issue but dont know where to start just leave a comment and I'll be more than happy to point you in the right direction. 32 | -------------------------------------------------------------------------------- /vendor/gopkg.in/doug-martin/goqu.v4/docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: "2" 2 | 3 | services: 4 | postgres: 5 | image: postgres:9.6 6 | environment: 7 | - "POSTGRES_USER=postgres" 8 | - "POSTGRES_DB=goqupostgres" 9 | expose: 10 | - "5432" 11 | 12 | mysql: 13 | image: mysql:5 14 | environment: 15 | - "MYSQL_DATABASE=goqumysql" 16 | - "MYSQL_ALLOW_EMPTY_PASSWORD=yes" 17 | expose: 18 | - "3306" 19 | 20 | goqu: 21 | image: "golang:${GO_VERSION}" 22 | command: bash -c "sleep 30 && go test -v -race ./..." 23 | working_dir: /go/src/gopkg.in/doug-martin/goqu.v4 24 | volumes: 25 | - "./:/go/src/gopkg.in/doug-martin/goqu.v4" 26 | environment: 27 | MYSQL_URI: 'root@tcp(mysql:3306)/goqumysql?parseTime=true' 28 | PG_URI: 'postgres://postgres:@postgres:5432/goqupostgres?sslmode=disable' 29 | depends_on: 30 | - postgres 31 | - mysql 32 | goqu-coverage: 33 | image: "golang:${GO_VERSION}" 34 | command: bash -c "sleep 30 && ./go.test.sh" 35 | working_dir: /go/src/gopkg.in/doug-martin/goqu.v4 36 | volumes: 37 | - "./:/go/src/gopkg.in/doug-martin/goqu.v4" 38 | environment: 39 | MYSQL_URI: 'root@tcp(mysql:3306)/goqumysql?parseTime=true' 40 | PG_URI: 'postgres://postgres:@postgres:5432/goqupostgres?sslmode=disable' 41 | depends_on: 42 | - postgres 43 | - mysql -------------------------------------------------------------------------------- /vendor/gopkg.in/doug-martin/goqu.v4/errors.go: -------------------------------------------------------------------------------- 1 | package goqu 2 | 3 | import "fmt" 4 | 5 | func newEncodeError(message string, args ...interface{}) error { 6 | return EncodeError{err: "goqu: " + fmt.Sprintf(message, args...)} 7 | } 8 | 9 | func NewGoquError(message string, args ...interface{}) error { 10 | return GoquError{err: "goqu: " + fmt.Sprintf(message, args...)} 11 | } 12 | 13 | type EncodeError struct { 14 | error 15 | err string 16 | } 17 | 18 | func (me EncodeError) Error() string { 19 | return me.err 20 | } 21 | 22 | type GoquError struct { 23 | err string 24 | } 25 | 26 | func (me GoquError) Error() string { 27 | return me.err 28 | } 29 | -------------------------------------------------------------------------------- /vendor/gopkg.in/doug-martin/goqu.v4/go.test.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e 4 | echo "" > coverage.txt 5 | 6 | for d in $(go list ./... | grep -v vendor); do 7 | go test -race -coverprofile=profile.out -covermode=atomic $d 8 | if [ -f profile.out ]; then 9 | cat profile.out >> coverage.txt 10 | rm profile.out 11 | fi 12 | done 13 | -------------------------------------------------------------------------------- /vendor/gopkg.in/doug-martin/goqu.v4/goqu.go: -------------------------------------------------------------------------------- 1 | /* 2 | goqu an idiomatch SQL builder, and query package. 3 | 4 | __ _ ___ __ _ _ _ 5 | / _` |/ _ \ / _` | | | | 6 | | (_| | (_) | (_| | |_| | 7 | \__, |\___/ \__, |\__,_| 8 | |___/ |_| 9 | 10 | 11 | Please see https://github.com/doug-martin/goqu for an introduction to goqu. 12 | */ 13 | package goqu 14 | -------------------------------------------------------------------------------- /vendor/gopkg.in/doug-martin/goqu.v4/sql_builder.go: -------------------------------------------------------------------------------- 1 | package goqu 2 | 3 | import "bytes" 4 | 5 | //Builder that is composed of a bytes.Buffer. It is used internally and by adapters to build SQL statements 6 | type SqlBuilder struct { 7 | bytes.Buffer 8 | //True if the sql should not be interpolated 9 | IsPrepared bool 10 | //Current Number of arguments, used by adapters that need positional placeholders 11 | CurrentArgPosition int 12 | args []interface{} 13 | } 14 | 15 | func NewSqlBuilder(isPrepared bool) *SqlBuilder { 16 | return &SqlBuilder{IsPrepared: isPrepared, args: make([]interface{}, 0), CurrentArgPosition: 1} 17 | } 18 | 19 | //Adds an argument to the builder, used when IsPrepared is false 20 | func (me *SqlBuilder) WriteArg(i interface{}) { 21 | me.CurrentArgPosition++ 22 | me.args = append(me.args, i) 23 | } 24 | 25 | //Returns the sql string, and arguments. 26 | func (me *SqlBuilder) ToSql() (string, []interface{}) { 27 | return me.String(), me.args 28 | } 29 | -------------------------------------------------------------------------------- /vendor/gopkg.in/doug-martin/goqu.v4/tags.go: -------------------------------------------------------------------------------- 1 | package goqu 2 | 3 | import "strings" 4 | 5 | // tagOptions is the string following a comma in a struct field's "json" 6 | // tag, or the empty string. It does not include the leading comma. 7 | type tagOptions string 8 | 9 | // Contains reports whether a comma-separated list of options 10 | // contains a particular substr flag. substr must be surrounded by a 11 | // string boundary or commas. 12 | func (o tagOptions) Contains(optionName string) bool { 13 | if len(o) == 0 { 14 | return false 15 | } 16 | ret := false 17 | s := string(o) 18 | for s != "" { 19 | var next string 20 | i := strings.Index(s, ",") 21 | if i >= 0 { 22 | s, next = s[:i], s[i+1:] 23 | } 24 | if s == optionName { 25 | ret = true 26 | break 27 | } 28 | s = next 29 | } 30 | return ret 31 | } 32 | -------------------------------------------------------------------------------- /vendor/gopkg.in/yaml.v2/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2011-2016 Canonical Ltd. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | -------------------------------------------------------------------------------- /vendor/gopkg.in/yaml.v2/LICENSE.libyaml: -------------------------------------------------------------------------------- 1 | The following files were ported to Go from C files of libyaml, and thus 2 | are still covered by their original copyright and license: 3 | 4 | apic.go 5 | emitterc.go 6 | parserc.go 7 | readerc.go 8 | scannerc.go 9 | writerc.go 10 | yamlh.go 11 | yamlprivateh.go 12 | 13 | Copyright (c) 2006 Kirill Simonov 14 | 15 | Permission is hereby granted, free of charge, to any person obtaining a copy of 16 | this software and associated documentation files (the "Software"), to deal in 17 | the Software without restriction, including without limitation the rights to 18 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 19 | of the Software, and to permit persons to whom the Software is furnished to do 20 | so, subject to the following conditions: 21 | 22 | The above copyright notice and this permission notice shall be included in all 23 | copies or substantial portions of the Software. 24 | 25 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 26 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 27 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 28 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 29 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 30 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 31 | SOFTWARE. 32 | --------------------------------------------------------------------------------