├── .gitignore ├── pkg ├── config │ ├── testdata │ │ ├── invalid.yaml │ │ └── success.yaml │ └── config_test.go ├── mw │ ├── auth.go │ └── cors.go ├── context │ └── context.go ├── postgres │ └── postgres.go ├── zerolog │ └── zerolog.go └── hooks │ └── jwt.go ├── vendor ├── github.com │ ├── rs │ │ ├── xid │ │ │ ├── go.mod │ │ │ ├── .travis.yml │ │ │ ├── hostid_darwin.go │ │ │ ├── hostid_freebsd.go │ │ │ ├── hostid_fallback.go │ │ │ ├── hostid_linux.go │ │ │ ├── .appveyor.yml │ │ │ ├── LICENSE │ │ │ └── hostid_windows.go │ │ └── zerolog │ │ │ ├── go.mod │ │ │ ├── pretty.png │ │ │ ├── .travis.yml │ │ │ ├── .gitignore │ │ │ ├── encoder_json.go │ │ │ ├── encoder_cbor.go │ │ │ ├── LICENSE │ │ │ ├── ctx.go │ │ │ ├── internal │ │ │ ├── cbor │ │ │ │ └── base.go │ │ │ └── json │ │ │ │ └── base.go │ │ │ ├── hook.go │ │ │ └── syslog.go │ ├── dgrijalva │ │ └── jwt-go │ │ │ ├── .gitignore │ │ │ ├── doc.go │ │ │ ├── .travis.yml │ │ │ ├── LICENSE │ │ │ └── signing_method.go │ ├── nbutton23 │ │ └── zxcvbn-go │ │ │ ├── .gitignore │ │ │ ├── Gopkg.toml │ │ │ ├── zxcvbn.go │ │ │ ├── Gopkg.lock │ │ │ ├── match │ │ │ └── match.go │ │ │ ├── utils │ │ │ └── math │ │ │ │ └── mathutils.go │ │ │ ├── LICENSE.txt │ │ │ ├── frequency │ │ │ └── frequency.go │ │ │ └── matching │ │ │ └── dictionaryMatch.go │ ├── twitchtv │ │ └── twirp │ │ │ ├── NOTICE │ │ │ ├── logo.png │ │ │ ├── .gitignore │ │ │ ├── .travis.yml │ │ │ ├── requirements.txt │ │ │ ├── tools.json │ │ │ ├── Gopkg.toml │ │ │ └── internal │ │ │ └── contextkeys │ │ │ └── keys.go │ ├── go-pg │ │ └── pg │ │ │ ├── doc.go │ │ │ ├── Makefile │ │ │ ├── internal │ │ │ ├── safe.go │ │ │ ├── log.go │ │ │ ├── parser │ │ │ │ ├── util.go │ │ │ │ ├── hstore_parser.go │ │ │ │ └── array_parser.go │ │ │ ├── unsafe.go │ │ │ ├── internal.go │ │ │ ├── util.go │ │ │ ├── pool │ │ │ │ └── pool_single.go │ │ │ └── error.go │ │ │ ├── .travis.yml │ │ │ ├── orm │ │ │ ├── model_discard.go │ │ │ ├── inflection.go │ │ │ ├── result.go │ │ │ ├── relation.go │ │ │ ├── table_params.go │ │ │ ├── model_slice.go │ │ │ ├── drop_table.go │ │ │ └── orm.go │ │ │ ├── types │ │ │ ├── interface.go │ │ │ ├── append_jsonb.go │ │ │ ├── in_op.go │ │ │ ├── array.go │ │ │ ├── hstore.go │ │ │ ├── append_field.go │ │ │ ├── append_hstore.go │ │ │ └── scan_hstore.go │ │ │ ├── result.go │ │ │ ├── time.go │ │ │ └── LICENSE │ ├── ghodss │ │ └── yaml │ │ │ ├── .travis.yml │ │ │ └── .gitignore │ ├── grpc-ecosystem │ │ └── grpc-gateway │ │ │ ├── utilities │ │ │ ├── doc.go │ │ │ ├── BUILD.bazel │ │ │ └── pattern.go │ │ │ ├── protoc-gen-swagger │ │ │ ├── genswagger │ │ │ │ └── doc.go │ │ │ ├── BUILD.bazel │ │ │ └── options │ │ │ │ └── BUILD.bazel │ │ │ ├── protoc-gen-grpc-gateway │ │ │ ├── gengateway │ │ │ │ ├── doc.go │ │ │ │ └── BUILD.bazel │ │ │ ├── generator │ │ │ │ ├── BUILD.bazel │ │ │ │ └── generator.go │ │ │ └── httprule │ │ │ │ ├── BUILD.bazel │ │ │ │ └── types.go │ │ │ └── codegenerator │ │ │ ├── doc.go │ │ │ ├── parse_req.go │ │ │ └── BUILD.bazel │ ├── golang │ │ ├── protobuf │ │ │ ├── AUTHORS │ │ │ └── CONTRIBUTORS │ │ └── glog │ │ │ └── README │ ├── rakyll │ │ └── statik │ │ │ └── .travis.yml │ ├── stretchr │ │ └── testify │ │ │ ├── assert │ │ │ ├── assertion_format.go.tmpl │ │ │ ├── assertion_forward.go.tmpl │ │ │ ├── errors.go │ │ │ └── forward_assertions.go │ │ │ └── LICENSE │ ├── gogo │ │ └── protobuf │ │ │ ├── GOLANG_CONTRIBUTORS │ │ │ ├── AUTHORS │ │ │ ├── CONTRIBUTORS │ │ │ └── gogoproto │ │ │ └── gogo.pb.golden │ ├── justinas │ │ └── alice │ │ │ ├── .travis.yml │ │ │ └── LICENSE │ ├── gorilla │ │ ├── context │ │ │ ├── .travis.yml │ │ │ └── README.md │ │ └── mux │ │ │ ├── ISSUE_TEMPLATE.md │ │ │ ├── .travis.yml │ │ │ ├── context_native.go │ │ │ ├── context_gorilla.go │ │ │ └── test_helpers.go │ ├── mwitkow │ │ └── go-proto-validators │ │ │ ├── .travis.yml │ │ │ ├── install_protoc.sh │ │ │ ├── helper.go │ │ │ └── Makefile │ ├── jinzhu │ │ └── inflection │ │ │ ├── wercker.yml │ │ │ └── LICENSE │ ├── davecgh │ │ └── go-spew │ │ │ └── LICENSE │ └── pmezard │ │ └── go-difflib │ │ └── LICENSE ├── golang.org │ └── x │ │ ├── sys │ │ ├── unix │ │ │ ├── .gitignore │ │ │ ├── endian_big.go │ │ │ ├── endian_little.go │ │ │ ├── constants.go │ │ │ ├── syscall_linux_amd64_gc.go │ │ │ ├── aliases.go │ │ │ ├── pagesize_unix.go │ │ │ ├── fcntl_linux_32bit.go │ │ │ ├── asm_solaris_amd64.s │ │ │ ├── gccgo_linux_amd64.go │ │ │ ├── syscall_linux_gc.go │ │ │ ├── race0.go │ │ │ ├── syscall_solaris_amd64.go │ │ │ ├── syscall_linux_gc_386.go │ │ │ ├── syscall_unix_gc.go │ │ │ ├── dirent.go │ │ │ ├── syscall_linux_gccgo_arm.go │ │ │ ├── str.go │ │ │ ├── race.go │ │ │ ├── env_unix.go │ │ │ ├── asm_freebsd_arm.s │ │ │ ├── asm_netbsd_arm.s │ │ │ ├── asm_openbsd_arm.s │ │ │ ├── asm_darwin_386.s │ │ │ ├── asm_freebsd_386.s │ │ │ ├── asm_netbsd_386.s │ │ │ ├── asm_openbsd_386.s │ │ │ ├── asm_darwin_amd64.s │ │ │ ├── asm_freebsd_amd64.s │ │ │ ├── asm_netbsd_amd64.s │ │ │ ├── asm_openbsd_amd64.s │ │ │ ├── asm_dragonfly_amd64.s │ │ │ ├── asm_darwin_arm.s │ │ │ ├── bluetooth_linux.go │ │ │ ├── asm_darwin_arm64.s │ │ │ ├── dev_darwin.go │ │ │ ├── syscall_netbsd_amd64.go │ │ │ ├── syscall_netbsd_386.go │ │ │ ├── syscall_netbsd_arm.go │ │ │ ├── syscall_openbsd_386.go │ │ │ ├── syscall_openbsd_arm.go │ │ │ ├── mksysnum_darwin.pl │ │ │ ├── dev_netbsd.go │ │ │ ├── dev_openbsd.go │ │ │ ├── openbsd_pledge.go │ │ │ ├── ioctl.go │ │ │ ├── syscall_openbsd_amd64.go │ │ │ ├── fcntl.go │ │ │ ├── syscall_linux_gccgo_386.go │ │ │ ├── dev_freebsd.go │ │ │ ├── dev_dragonfly.go │ │ │ ├── gccgo_c.c │ │ │ ├── sockcmsg_linux.go │ │ │ ├── mksysnum_dragonfly.pl │ │ │ ├── mksysnum_freebsd.pl │ │ │ ├── mksysnum_openbsd.pl │ │ │ ├── asm_linux_arm64.s │ │ │ ├── asm_linux_arm.s │ │ │ ├── asm_linux_s390x.s │ │ │ ├── zptracearm_linux.go │ │ │ ├── asm_linux_mipsx.s │ │ │ ├── asm_linux_mips64x.s │ │ │ ├── asm_linux_ppc64x.s │ │ │ ├── syscall_dragonfly_amd64.go │ │ │ ├── syscall_freebsd_amd64.go │ │ │ ├── asm_linux_amd64.s │ │ │ ├── syscall_freebsd_arm.go │ │ │ ├── syscall_freebsd_386.go │ │ │ └── mksysnum_netbsd.pl │ │ ├── AUTHORS │ │ ├── CONTRIBUTORS │ │ ├── windows │ │ │ ├── mksyscall.go │ │ │ ├── aliases.go │ │ │ ├── asm_windows_386.s │ │ │ ├── asm_windows_amd64.s │ │ │ ├── race0.go │ │ │ ├── types_windows_386.go │ │ │ ├── types_windows_amd64.go │ │ │ ├── str.go │ │ │ ├── env_windows.go │ │ │ ├── race.go │ │ │ ├── memory_windows.go │ │ │ └── eventlog.go │ │ ├── PATENTS │ │ └── LICENSE │ │ └── crypto │ │ ├── AUTHORS │ │ ├── CONTRIBUTORS │ │ ├── bcrypt │ │ └── base64.go │ │ └── PATENTS └── gopkg.in │ └── yaml.v2 │ ├── go.mod │ ├── .travis.yml │ ├── NOTICE │ ├── writerc.go │ └── LICENSE.libyaml ├── openapi ├── favicon-16x16.png ├── favicon-32x32.png └── swagger-ui.css.map ├── Makefile ├── model ├── tenant.go ├── log.go └── role.go ├── mock ├── model.go ├── jwt.go ├── auth.go ├── secure.go └── rbac.go ├── .travis.yml ├── test.sh ├── twirp ├── tools.json ├── cmd └── api │ └── conf.local.yaml ├── internal ├── pkg │ ├── query │ │ └── query.go │ └── structs │ │ └── merge.go └── iam │ ├── secure │ └── secure.go │ ├── platform │ └── postgres │ │ └── user.go │ └── logging.go ├── LICENSE ├── Gopkg.toml └── rpc └── iam └── service.validator.pb.go /.gitignore: -------------------------------------------------------------------------------- 1 | profile.out 2 | coverage.txt 3 | _tools/ -------------------------------------------------------------------------------- /pkg/config/testdata/invalid.yaml: -------------------------------------------------------------------------------- 1 | invalid yaml format -------------------------------------------------------------------------------- /vendor/github.com/rs/xid/go.mod: -------------------------------------------------------------------------------- 1 | module github.com/rs/xid 2 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/.gitignore: -------------------------------------------------------------------------------- 1 | _obj/ 2 | unix.test 3 | -------------------------------------------------------------------------------- /vendor/github.com/rs/zerolog/go.mod: -------------------------------------------------------------------------------- 1 | module github.com/rs/zerolog 2 | -------------------------------------------------------------------------------- /vendor/github.com/dgrijalva/jwt-go/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | bin 3 | 4 | 5 | -------------------------------------------------------------------------------- /vendor/github.com/nbutton23/zxcvbn-go/.gitignore: -------------------------------------------------------------------------------- 1 | zxcvbn 2 | debug.test 3 | -------------------------------------------------------------------------------- /openapi/favicon-16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ribice/twisk/HEAD/openapi/favicon-16x16.png -------------------------------------------------------------------------------- /openapi/favicon-32x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ribice/twisk/HEAD/openapi/favicon-32x32.png -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | twirp: 2 | ./twirp 3 | rm -rf openapi/statik 4 | retool do statik -m -f -src openapi/ -dest openapi -------------------------------------------------------------------------------- /openapi/swagger-ui.css.map: -------------------------------------------------------------------------------- 1 | {"version":3,"sources":[],"names":[],"mappings":"","file":"swagger-ui.css","sourceRoot":""} -------------------------------------------------------------------------------- /vendor/github.com/twitchtv/twirp/NOTICE: -------------------------------------------------------------------------------- 1 | Twirp 2 | Copyright 2018 Twitch Interactive, Inc. All Rights Reserved. 3 | -------------------------------------------------------------------------------- /vendor/github.com/go-pg/pg/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Package github.com/go-pg/pg implements a PostgreSQL client. 3 | */ 4 | package pg 5 | -------------------------------------------------------------------------------- /vendor/github.com/rs/zerolog/pretty.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ribice/twisk/HEAD/vendor/github.com/rs/zerolog/pretty.png -------------------------------------------------------------------------------- /vendor/github.com/twitchtv/twirp/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ribice/twisk/HEAD/vendor/github.com/twitchtv/twirp/logo.png -------------------------------------------------------------------------------- /vendor/github.com/ghodss/yaml/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | go: 3 | - 1.3 4 | - 1.4 5 | script: 6 | - go test 7 | - go build 8 | -------------------------------------------------------------------------------- /vendor/gopkg.in/yaml.v2/go.mod: -------------------------------------------------------------------------------- 1 | module "gopkg.in/yaml.v2" 2 | 3 | require ( 4 | "gopkg.in/check.v1" v0.0.0-20161208181325-20d25e280405 5 | ) 6 | -------------------------------------------------------------------------------- /vendor/github.com/twitchtv/twirp/.gitignore: -------------------------------------------------------------------------------- 1 | *.test 2 | /bin 3 | 4 | clientcompat/pycompat/ENV 5 | *.pyc 6 | 7 | build 8 | 9 | npm-debug.log 10 | -------------------------------------------------------------------------------- /vendor/github.com/grpc-ecosystem/grpc-gateway/utilities/doc.go: -------------------------------------------------------------------------------- 1 | // Package utilities provides members for internal use in grpc-gateway. 2 | package utilities 3 | -------------------------------------------------------------------------------- /vendor/github.com/rs/xid/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | go: 3 | - "1.5" 4 | - "1.10" 5 | - "master" 6 | matrix: 7 | allow_failures: 8 | - go: "master" 9 | -------------------------------------------------------------------------------- /vendor/github.com/go-pg/pg/Makefile: -------------------------------------------------------------------------------- 1 | all: 2 | go test ./... 3 | go test ./... -short -race 4 | env GOOS=linux GOARCH=386 go test ./... 5 | go vet -shadow ./... 6 | -------------------------------------------------------------------------------- /vendor/github.com/twitchtv/twirp/.travis.yml: -------------------------------------------------------------------------------- 1 | sudo: false 2 | language: go 3 | go: 4 | - 1.9 5 | - tip 6 | script: 7 | - go install ./... 8 | - go test -race ./... 9 | -------------------------------------------------------------------------------- /vendor/github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger/genswagger/doc.go: -------------------------------------------------------------------------------- 1 | // Package genswagger provides a code generator for swagger. 2 | package genswagger 3 | -------------------------------------------------------------------------------- /vendor/github.com/twitchtv/twirp/requirements.txt: -------------------------------------------------------------------------------- 1 | certifi==2017.4.17 2 | chardet==3.0.4 3 | idna==2.5 4 | protobuf==3.5.1 5 | requests==2.17.3 6 | six==1.10.0 7 | urllib3==1.21.1 8 | -------------------------------------------------------------------------------- /model/tenant.go: -------------------------------------------------------------------------------- 1 | package twisk 2 | 3 | // Tenant table 4 | type Tenant struct { 5 | ID int `json:"id"` 6 | Name string `json:"name"` 7 | Active bool `json:"active"` 8 | } 9 | -------------------------------------------------------------------------------- /vendor/github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/gengateway/doc.go: -------------------------------------------------------------------------------- 1 | // Package gengateway provides a code generator for grpc gateway files. 2 | package gengateway 3 | -------------------------------------------------------------------------------- /vendor/github.com/grpc-ecosystem/grpc-gateway/codegenerator/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Package codegenerator contains reusable functions used by the code generators. 3 | */ 4 | package codegenerator 5 | -------------------------------------------------------------------------------- /mock/model.go: -------------------------------------------------------------------------------- 1 | package mock 2 | 3 | import ( 4 | "errors" 5 | ) 6 | 7 | var ( 8 | // ErrGeneric used for testing purposes 9 | ErrGeneric = errors.New("generic error used for testing purposes") 10 | ) 11 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/AUTHORS: -------------------------------------------------------------------------------- 1 | # This source code refers to The Go Authors for copyright purposes. 2 | # The master list of authors is in the main Go distribution, 3 | # visible at http://tip.golang.org/AUTHORS. 4 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/CONTRIBUTORS: -------------------------------------------------------------------------------- 1 | # This source code was written by the Go contributors. 2 | # The master list of contributors is in the main Go distribution, 3 | # visible at http://tip.golang.org/CONTRIBUTORS. 4 | -------------------------------------------------------------------------------- /vendor/gopkg.in/yaml.v2/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | 3 | go: 4 | - 1.4 5 | - 1.5 6 | - 1.6 7 | - 1.7 8 | - 1.8 9 | - 1.9 10 | - tip 11 | 12 | go_import_path: gopkg.in/yaml.v2 13 | -------------------------------------------------------------------------------- /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/golang.org/x/crypto/AUTHORS: -------------------------------------------------------------------------------- 1 | # This source code refers to The Go Authors for copyright purposes. 2 | # The master list of authors is in the main Go distribution, 3 | # visible at https://tip.golang.org/AUTHORS. 4 | -------------------------------------------------------------------------------- /vendor/golang.org/x/crypto/CONTRIBUTORS: -------------------------------------------------------------------------------- 1 | # This source code was written by the Go contributors. 2 | # The master list of contributors is in the main Go distribution, 3 | # visible at https://tip.golang.org/CONTRIBUTORS. 4 | -------------------------------------------------------------------------------- /vendor/github.com/golang/protobuf/AUTHORS: -------------------------------------------------------------------------------- 1 | # This source code refers to The Go Authors for copyright purposes. 2 | # The master list of authors is in the main Go distribution, 3 | # visible at http://tip.golang.org/AUTHORS. 4 | -------------------------------------------------------------------------------- /vendor/github.com/golang/protobuf/CONTRIBUTORS: -------------------------------------------------------------------------------- 1 | # This source code was written by the Go contributors. 2 | # The master list of contributors is in the main Go distribution, 3 | # visible at http://tip.golang.org/CONTRIBUTORS. 4 | -------------------------------------------------------------------------------- /vendor/github.com/dgrijalva/jwt-go/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | 3 | script: 4 | - go vet ./... 5 | - go test -v ./... 6 | 7 | go: 8 | - 1.3 9 | - 1.4 10 | - 1.5 11 | - 1.6 12 | - 1.7 13 | - tip 14 | -------------------------------------------------------------------------------- /vendor/github.com/rakyll/statik/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | 3 | go: 4 | - 1.7.x 5 | - 1.8.x 6 | - 1.9.x 7 | - tip 8 | 9 | install: 10 | - go build -v 11 | - ./statik -src=./example/public -dest=./example/ 12 | -------------------------------------------------------------------------------- /vendor/github.com/rs/xid/hostid_darwin.go: -------------------------------------------------------------------------------- 1 | // +build darwin 2 | 3 | package xid 4 | 5 | import "golang.org/x/sys/unix" 6 | 7 | func readPlatformMachineID() (string, error) { 8 | return unix.Sysctl("kern.uuid") 9 | } 10 | -------------------------------------------------------------------------------- /vendor/github.com/rs/xid/hostid_freebsd.go: -------------------------------------------------------------------------------- 1 | // +build freebsd 2 | 3 | package xid 4 | 5 | import "golang.org/x/sys/unix" 6 | 7 | func readPlatformMachineID() (string, error) { 8 | return unix.Sysctl("kern.hostuuid") 9 | } 10 | -------------------------------------------------------------------------------- /model/log.go: -------------------------------------------------------------------------------- 1 | package twisk 2 | 3 | import "context" 4 | 5 | // Logger represents logging interface 6 | type Logger interface { 7 | // source, msg, error, params 8 | Log(context.Context, string, string, error, map[string]interface{}) 9 | } 10 | -------------------------------------------------------------------------------- /vendor/github.com/go-pg/pg/internal/safe.go: -------------------------------------------------------------------------------- 1 | // +build appengine 2 | 3 | package internal 4 | 5 | func BytesToString(b []byte) string { 6 | return string(b) 7 | } 8 | 9 | func StringToBytes(s string) []byte { 10 | return []byte(s) 11 | } 12 | -------------------------------------------------------------------------------- /vendor/github.com/rs/xid/hostid_fallback.go: -------------------------------------------------------------------------------- 1 | // +build !darwin,!linux,!freebsd,!windows 2 | 3 | package xid 4 | 5 | import "errors" 6 | 7 | func readPlatformMachineID() (string, error) { 8 | return "", errors.New("not implemented") 9 | } 10 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | sudo: required 3 | services: 4 | - docker 5 | go: 6 | - tip 7 | before_install: 8 | - go get -t -v ./... 9 | 10 | script: 11 | - ./test.sh 12 | 13 | after_success: 14 | - bash <(curl -s https://codecov.io/bash) 15 | -------------------------------------------------------------------------------- /vendor/github.com/stretchr/testify/assert/assertion_format.go.tmpl: -------------------------------------------------------------------------------- 1 | {{.CommentFormat}} 2 | func {{.DocInfo.Name}}f(t TestingT, {{.ParamsFormat}}) bool { 3 | if h, ok := t.(tHelper); ok { h.Helper() } 4 | return {{.DocInfo.Name}}(t, {{.ForwardedParamsFormat}}) 5 | } 6 | -------------------------------------------------------------------------------- /vendor/github.com/stretchr/testify/assert/assertion_forward.go.tmpl: -------------------------------------------------------------------------------- 1 | {{.CommentWithoutT "a"}} 2 | func (a *Assertions) {{.DocInfo.Name}}({{.Params}}) bool { 3 | if h, ok := a.t.(tHelper); ok { h.Helper() } 4 | return {{.DocInfo.Name}}(a.t, {{.ForwardedParams}}) 5 | } 6 | -------------------------------------------------------------------------------- /vendor/github.com/rs/xid/hostid_linux.go: -------------------------------------------------------------------------------- 1 | // +build linux 2 | 3 | package xid 4 | 5 | import "io/ioutil" 6 | 7 | func readPlatformMachineID() (string, error) { 8 | b, err := ioutil.ReadFile("/sys/class/dmi/id/product_uuid") 9 | return string(b), err 10 | } 11 | -------------------------------------------------------------------------------- /vendor/github.com/gogo/protobuf/GOLANG_CONTRIBUTORS: -------------------------------------------------------------------------------- 1 | The contributors to the Go protobuf repository: 2 | 3 | # This source code was written by the Go contributors. 4 | # The master list of contributors is in the main Go distribution, 5 | # visible at http://tip.golang.org/CONTRIBUTORS. -------------------------------------------------------------------------------- /vendor/github.com/go-pg/pg/internal/log.go: -------------------------------------------------------------------------------- 1 | package internal 2 | 3 | import ( 4 | "fmt" 5 | "log" 6 | ) 7 | 8 | var Logger *log.Logger 9 | 10 | func Logf(s string, args ...interface{}) { 11 | if Logger == nil { 12 | return 13 | } 14 | Logger.Output(2, fmt.Sprintf(s, args...)) 15 | } 16 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /mock/jwt.go: -------------------------------------------------------------------------------- 1 | package mock 2 | 3 | import ( 4 | "github.com/ribice/twisk/model" 5 | ) 6 | 7 | // JWT mock 8 | type JWT struct { 9 | GenerateTokenFn func(*twisk.AuthUser) (string, error) 10 | } 11 | 12 | // GenerateToken mock 13 | func (j *JWT) GenerateToken(u *twisk.AuthUser) (string, error) { 14 | return j.GenerateTokenFn(u) 15 | } 16 | -------------------------------------------------------------------------------- /vendor/github.com/rs/zerolog/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | go: 3 | - "1.7" 4 | - "1.8" 5 | - "1.9" 6 | - "1.10" 7 | - "master" 8 | matrix: 9 | allow_failures: 10 | - go: "master" 11 | script: 12 | - go test -v -race -cpu=1,2,4 -bench . -benchmem ./... 13 | - go test -v -tags binary_log -race -cpu=1,2,4 -bench . -benchmem ./... 14 | -------------------------------------------------------------------------------- /mock/auth.go: -------------------------------------------------------------------------------- 1 | package mock 2 | 3 | import ( 4 | "context" 5 | 6 | "github.com/ribice/twisk/model" 7 | ) 8 | 9 | // Auth mock 10 | type Auth struct { 11 | GetUserFn func(context.Context) *twisk.AuthUser 12 | } 13 | 14 | // GetUser mock 15 | func (s *Auth) GetUser(c context.Context) *twisk.AuthUser { 16 | return s.GetUserFn(c) 17 | } 18 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /test.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e 4 | echo "" > coverage.txt 5 | 6 | for d in $(go list ./... | grep -v -e internal/mock -e cmd/api/server); 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 -------------------------------------------------------------------------------- /vendor/github.com/ghodss/yaml/.gitignore: -------------------------------------------------------------------------------- 1 | # OSX leaves these everywhere on SMB shares 2 | ._* 3 | 4 | # Eclipse files 5 | .classpath 6 | .project 7 | .settings/** 8 | 9 | # Emacs save files 10 | *~ 11 | 12 | # Vim-related files 13 | [._]*.s[a-w][a-z] 14 | [._]s[a-w][a-z] 15 | *.un~ 16 | Session.vim 17 | .netrwhist 18 | 19 | # Go test binaries 20 | *.test 21 | -------------------------------------------------------------------------------- /vendor/github.com/justinas/alice/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | 3 | matrix: 4 | include: 5 | - go: 1.0.x 6 | - go: 1.1.x 7 | - go: 1.2.x 8 | - go: 1.3.x 9 | - go: 1.4.x 10 | - go: 1.5.x 11 | - go: 1.6.x 12 | - go: 1.7.x 13 | - go: 1.8.x 14 | - go: 1.9.x 15 | - go: tip 16 | allow_failures: 17 | - go: tip 18 | -------------------------------------------------------------------------------- /vendor/github.com/go-pg/pg/internal/parser/util.go: -------------------------------------------------------------------------------- 1 | package parser 2 | 3 | var pgNull = []byte("NULL") 4 | 5 | func isNum(c byte) bool { 6 | return c >= '0' && c <= '9' 7 | } 8 | 9 | func isAlpha(c byte) bool { 10 | return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') 11 | } 12 | 13 | func isAlnum(c byte) bool { 14 | return isAlpha(c) || isNum(c) 15 | } 16 | -------------------------------------------------------------------------------- /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/windows/mksyscall.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package windows 6 | 7 | //go:generate go run $GOROOT/src/syscall/mksyscall_windows.go -output zsyscall_windows.go eventlog.go service.go syscall_windows.go security_windows.go 8 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/windows/aliases.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build windows 6 | // +build go1.9 7 | 8 | package windows 9 | 10 | import "syscall" 11 | 12 | type Errno = syscall.Errno 13 | type SysProcAttr = syscall.SysProcAttr 14 | -------------------------------------------------------------------------------- /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/github.com/rs/zerolog/.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Object files, Static and Dynamic libs (Shared Objects) 2 | *.o 3 | *.a 4 | *.so 5 | 6 | # Folders 7 | _obj 8 | _test 9 | 10 | # Architecture specific extensions/prefixes 11 | *.[568vq] 12 | [568vq].out 13 | 14 | *.cgo1.go 15 | *.cgo2.c 16 | _cgo_defun.c 17 | _cgo_gotypes.go 18 | _cgo_export.* 19 | 20 | _testmain.go 21 | 22 | *.exe 23 | *.test 24 | *.prof 25 | -------------------------------------------------------------------------------- /vendor/github.com/stretchr/testify/assert/errors.go: -------------------------------------------------------------------------------- 1 | package assert 2 | 3 | import ( 4 | "errors" 5 | ) 6 | 7 | // AnError is an error instance useful for testing. If the code does not care 8 | // about error specifics, and only needs to return the error for example, this 9 | // error should be used to make the test code more readable. 10 | var AnError = errors.New("assert.AnError general error for testing") 11 | -------------------------------------------------------------------------------- /vendor/github.com/gorilla/context/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | sudo: false 3 | 4 | matrix: 5 | include: 6 | - go: 1.3 7 | - go: 1.4 8 | - go: 1.5 9 | - go: 1.6 10 | - go: 1.7 11 | - go: tip 12 | allow_failures: 13 | - go: tip 14 | 15 | script: 16 | - go get -t -v ./... 17 | - diff -u <(echo -n) <(gofmt -d .) 18 | - go vet $(go list ./... | grep -v /vendor/) 19 | - go test -v -race ./... 20 | -------------------------------------------------------------------------------- /vendor/github.com/mwitkow/go-proto-validators/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | sudo: false 3 | 4 | go: 5 | - 1.5 6 | - 1.6 7 | 8 | before_install: 9 | - ./install_protoc.sh 10 | - export PATH=$PATH:$HOME/soft/protobuf 11 | 12 | install: 13 | - go get github.com/stretchr/testify 14 | - go get github.com/gogo/protobuf/protoc-gen-gogo 15 | - go get github.com/golang/protobuf/protoc-gen-go 16 | 17 | script: 18 | - make test 19 | -------------------------------------------------------------------------------- /twirp: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | echo "Running protoc..." 4 | for D in ./rpc/*; do 5 | retool do protoc \ 6 | -I vendor/github.com/grpc-ecosystem/grpc-gateway/ \ 7 | -I vendor/ \ 8 | --proto_path=. \ 9 | --twirp_out=. \ 10 | --go_out=. \ 11 | --govalidators_out=. \ 12 | --twirp_swagger_out=openapi/ \ 13 | ${D}/service.proto 14 | done 15 | echo "Done." -------------------------------------------------------------------------------- /vendor/github.com/gorilla/mux/ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | **What version of Go are you running?** (Paste the output of `go version`) 2 | 3 | 4 | **What version of gorilla/mux are you at?** (Paste the output of `git rev-parse HEAD` inside `$GOPATH/src/github.com/gorilla/mux`) 5 | 6 | 7 | **Describe your problem** (and what you have tried so far) 8 | 9 | 10 | **Paste a minimal, runnable, reproduction of your issue below** (use backticks to format it) 11 | 12 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/aliases.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build darwin dragonfly freebsd linux netbsd openbsd solaris 6 | // +build go1.9 7 | 8 | package unix 9 | 10 | import "syscall" 11 | 12 | type Signal = syscall.Signal 13 | type Errno = syscall.Errno 14 | type SysProcAttr = syscall.SysProcAttr 15 | -------------------------------------------------------------------------------- /vendor/github.com/gorilla/mux/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | sudo: false 3 | 4 | matrix: 5 | include: 6 | - go: 1.5.x 7 | - go: 1.6.x 8 | - go: 1.7.x 9 | - go: 1.8.x 10 | - go: 1.9.x 11 | - go: 1.10.x 12 | - go: tip 13 | allow_failures: 14 | - go: tip 15 | 16 | install: 17 | - # Skip 18 | 19 | script: 20 | - go get -t -v ./... 21 | - diff -u <(echo -n) <(gofmt -d .) 22 | - go tool vet . 23 | - go test -v -race ./... 24 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/pagesize_unix.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build darwin dragonfly freebsd linux netbsd openbsd solaris 6 | 7 | // For Unix, get the pagesize from the runtime. 8 | 9 | package unix 10 | 11 | import "syscall" 12 | 13 | func Getpagesize() int { 14 | return syscall.Getpagesize() 15 | } 16 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/windows/asm_windows_386.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // 6 | // System calls for 386, Windows are implemented in runtime/syscall_windows.goc 7 | // 8 | 9 | TEXT ·getprocaddress(SB), 7, $0-16 10 | JMP syscall·getprocaddress(SB) 11 | 12 | TEXT ·loadlibrary(SB), 7, $0-12 13 | JMP syscall·loadlibrary(SB) 14 | -------------------------------------------------------------------------------- /pkg/config/testdata/success.yaml: -------------------------------------------------------------------------------- 1 | server: 2 | port: :8080 3 | read_timeout_seconds: 31 4 | write_timeout_seconds: 30 5 | 6 | database: 7 | psn: postgre 8 | log_queries: true 9 | timeout_seconds: 10 10 | 11 | jwt: 12 | secret: changedvalue # Change this value 13 | duration_minutes: 15 14 | signing_algorithm: HS256 15 | 16 | application: 17 | min_password_strength: 1 # Minimum password zxcvbn strength 18 | 19 | openapi: 20 | username: twisk 21 | password: twisk -------------------------------------------------------------------------------- /vendor/github.com/go-pg/pg/.travis.yml: -------------------------------------------------------------------------------- 1 | dist: trusty 2 | language: go 3 | 4 | addons: 5 | postgresql: "9.6" 6 | 7 | go: 8 | - 1.9.x 9 | - 1.10.x 10 | - tip 11 | 12 | matrix: 13 | allow_failures: 14 | - go: tip 15 | 16 | before_install: 17 | - psql -U postgres -c "CREATE EXTENSION hstore" 18 | 19 | install: 20 | - go get github.com/jinzhu/inflection 21 | - go get gopkg.in/check.v1 22 | - go get github.com/onsi/ginkgo 23 | - go get github.com/onsi/gomega 24 | -------------------------------------------------------------------------------- /vendor/github.com/go-pg/pg/orm/model_discard.go: -------------------------------------------------------------------------------- 1 | package orm 2 | 3 | type Discard struct { 4 | hookStubs 5 | } 6 | 7 | var _ Model = (*Discard)(nil) 8 | 9 | func (Discard) Init() error { 10 | return nil 11 | } 12 | 13 | func (m Discard) NewModel() ColumnScanner { 14 | return m 15 | } 16 | 17 | func (m Discard) AddModel(ColumnScanner) error { 18 | return nil 19 | } 20 | 21 | func (m Discard) ScanColumn(colIdx int, colName string, b []byte) error { 22 | return nil 23 | } 24 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/windows/asm_windows_amd64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // 6 | // System calls for amd64, Windows are implemented in runtime/syscall_windows.goc 7 | // 8 | 9 | TEXT ·getprocaddress(SB), 7, $0-32 10 | JMP syscall·getprocaddress(SB) 11 | 12 | TEXT ·loadlibrary(SB), 7, $0-24 13 | JMP syscall·loadlibrary(SB) 14 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/fcntl_linux_32bit.go: -------------------------------------------------------------------------------- 1 | // +build linux,386 linux,arm linux,mips linux,mipsle 2 | 3 | // Copyright 2014 The Go Authors. All rights reserved. 4 | // Use of this source code is governed by a BSD-style 5 | // license that can be found in the LICENSE file. 6 | 7 | package unix 8 | 9 | func init() { 10 | // On 32-bit Linux systems, the fcntl syscall that matches Go's 11 | // Flock_t type is SYS_FCNTL64, not SYS_FCNTL. 12 | fcntl64Syscall = SYS_FCNTL64 13 | } 14 | -------------------------------------------------------------------------------- /vendor/github.com/go-pg/pg/orm/inflection.go: -------------------------------------------------------------------------------- 1 | package orm 2 | 3 | import ( 4 | "github.com/jinzhu/inflection" 5 | ) 6 | 7 | var tableNameInflector func(string) string 8 | 9 | func init() { 10 | SetTableNameInflector(inflection.Plural) 11 | } 12 | 13 | // SetTableNameInflector overrides the default func that pluralizes 14 | // model name to get table name, e.g. my_article becomes my_articles. 15 | func SetTableNameInflector(fn func(string) string) { 16 | tableNameInflector = fn 17 | } 18 | -------------------------------------------------------------------------------- /vendor/github.com/rs/xid/.appveyor.yml: -------------------------------------------------------------------------------- 1 | version: 1.0.0.{build} 2 | 3 | platform: x64 4 | 5 | branches: 6 | only: 7 | - master 8 | 9 | clone_folder: c:\gopath\src\github.com\rs\xid 10 | 11 | environment: 12 | GOPATH: c:\gopath 13 | 14 | install: 15 | - echo %PATH% 16 | - echo %GOPATH% 17 | - set PATH=%GOPATH%\bin;c:\go\bin;%PATH% 18 | - go version 19 | - go env 20 | - go get -t . 21 | 22 | build_script: 23 | - go build 24 | 25 | test_script: 26 | - go test 27 | 28 | -------------------------------------------------------------------------------- /vendor/github.com/jinzhu/inflection/wercker.yml: -------------------------------------------------------------------------------- 1 | box: golang 2 | 3 | build: 4 | steps: 5 | - setup-go-workspace 6 | 7 | # Gets the dependencies 8 | - script: 9 | name: go get 10 | code: | 11 | go get 12 | 13 | # Build the project 14 | - script: 15 | name: go build 16 | code: | 17 | go build ./... 18 | 19 | # Test the project 20 | - script: 21 | name: go test 22 | code: | 23 | go test ./... 24 | -------------------------------------------------------------------------------- /vendor/github.com/go-pg/pg/internal/unsafe.go: -------------------------------------------------------------------------------- 1 | // +build !appengine 2 | 3 | package internal 4 | 5 | import ( 6 | "unsafe" 7 | ) 8 | 9 | // BytesToString converts byte slice to string. 10 | func BytesToString(b []byte) string { 11 | return *(*string)(unsafe.Pointer(&b)) 12 | } 13 | 14 | // StringToBytes converts string to byte slice. 15 | func StringToBytes(s string) []byte { 16 | return *(*[]byte)(unsafe.Pointer( 17 | &struct { 18 | string 19 | Cap int 20 | }{s, len(s)}, 21 | )) 22 | } 23 | -------------------------------------------------------------------------------- /vendor/github.com/go-pg/pg/orm/result.go: -------------------------------------------------------------------------------- 1 | package orm 2 | 3 | // A Result summarizes an executed SQL command. 4 | type Result interface { 5 | Model() Model 6 | 7 | // RowsAffected returns the number of rows affected by SELECT, INSERT, UPDATE, 8 | // or DELETE queries. It returns -1 if query can't possibly affect any rows, 9 | // e.g. in case of CREATE or SHOW queries. 10 | RowsAffected() int 11 | 12 | // RowsReturned returns the number of rows returned by the query. 13 | RowsReturned() int 14 | } 15 | -------------------------------------------------------------------------------- /vendor/github.com/stretchr/testify/assert/forward_assertions.go: -------------------------------------------------------------------------------- 1 | package assert 2 | 3 | // Assertions provides assertion methods around the 4 | // TestingT interface. 5 | type Assertions struct { 6 | t TestingT 7 | } 8 | 9 | // New makes a new Assertions object for the specified TestingT. 10 | func New(t TestingT) *Assertions { 11 | return &Assertions{ 12 | t: t, 13 | } 14 | } 15 | 16 | //go:generate go run ../_codegen/main.go -output-package=assert -template=assertion_forward.go.tmpl -include-format-funcs 17 | -------------------------------------------------------------------------------- /vendor/github.com/gorilla/mux/context_native.go: -------------------------------------------------------------------------------- 1 | // +build go1.7 2 | 3 | package mux 4 | 5 | import ( 6 | "context" 7 | "net/http" 8 | ) 9 | 10 | func contextGet(r *http.Request, key interface{}) interface{} { 11 | return r.Context().Value(key) 12 | } 13 | 14 | func contextSet(r *http.Request, key, val interface{}) *http.Request { 15 | if val == nil { 16 | return r 17 | } 18 | 19 | return r.WithContext(context.WithValue(r.Context(), key, val)) 20 | } 21 | 22 | func contextClear(r *http.Request) { 23 | return 24 | } 25 | -------------------------------------------------------------------------------- /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/github.com/gorilla/mux/context_gorilla.go: -------------------------------------------------------------------------------- 1 | // +build !go1.7 2 | 3 | package mux 4 | 5 | import ( 6 | "net/http" 7 | 8 | "github.com/gorilla/context" 9 | ) 10 | 11 | func contextGet(r *http.Request, key interface{}) interface{} { 12 | return context.Get(r, key) 13 | } 14 | 15 | func contextSet(r *http.Request, key, val interface{}) *http.Request { 16 | if val == nil { 17 | return r 18 | } 19 | 20 | context.Set(r, key, val) 21 | return r 22 | } 23 | 24 | func contextClear(r *http.Request) { 25 | context.Clear(r) 26 | } 27 | -------------------------------------------------------------------------------- /pkg/mw/auth.go: -------------------------------------------------------------------------------- 1 | package mw 2 | 3 | import ( 4 | "context" 5 | "net/http" 6 | 7 | pkgctx "github.com/ribice/twisk/pkg/context" 8 | ) 9 | 10 | // AuthContext adds context with autorization key to http request 11 | func AuthContext(h http.Handler) http.Handler { 12 | fn := func(w http.ResponseWriter, r *http.Request) { 13 | ctx := context.Background() 14 | ctx = context.WithValue(ctx, pkgctx.KeyString("HTTP-Authorization"), r.Header.Get("Authorization")) 15 | h.ServeHTTP(w, r.WithContext(ctx)) 16 | } 17 | return http.HandlerFunc(fn) 18 | } 19 | -------------------------------------------------------------------------------- /tools.json: -------------------------------------------------------------------------------- 1 | { 2 | "Tools": [ 3 | { 4 | "Repository": "github.com/twitchtv/twirp/protoc-gen-twirp", 5 | "Commit": "59d9d44fba085c60e61a28a6180433efcfe150e7" 6 | }, 7 | { 8 | "Repository": "github.com/mwitkow/go-proto-validators/protoc-gen-govalidators", 9 | "Commit": "0950a79900071e9f3f5979b78078c599376422fd" 10 | }, 11 | { 12 | "Repository": "github.com/elliots/protoc-gen-twirp_swagger", 13 | "Commit": "5f13214f71d7b2425fecd1751e7330173124d0ea" 14 | } 15 | ], 16 | "RetoolVersion": "1.3.7" 17 | } -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /pkg/context/context.go: -------------------------------------------------------------------------------- 1 | package context 2 | 3 | import ( 4 | "context" 5 | 6 | "github.com/ribice/twisk/model" 7 | ) 8 | 9 | // KeyString should be used when setting and fetching context values 10 | type KeyString string 11 | 12 | // JWTKey is a context key for storing token 13 | var JWTKey = "http_jwt_key" 14 | 15 | // Service represents context service 16 | type Service struct{} 17 | 18 | // GetUser fetches auth user from context 19 | func (s *Service) GetUser(c context.Context) *twisk.AuthUser { 20 | return c.Value(KeyString("_authuser")).(*twisk.AuthUser) 21 | } 22 | -------------------------------------------------------------------------------- /vendor/github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/generator/BUILD.bazel: -------------------------------------------------------------------------------- 1 | load("@io_bazel_rules_go//go:def.bzl", "go_library") 2 | 3 | package(default_visibility = ["//:generators"]) 4 | 5 | go_library( 6 | name = "go_default_library", 7 | srcs = ["generator.go"], 8 | importpath = "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/generator", 9 | deps = [ 10 | "//protoc-gen-grpc-gateway/descriptor:go_default_library", 11 | "@com_github_golang_protobuf//protoc-gen-go/plugin:go_default_library", 12 | ], 13 | ) 14 | -------------------------------------------------------------------------------- /mock/secure.go: -------------------------------------------------------------------------------- 1 | package mock 2 | 3 | // Secure mock 4 | type Secure struct { 5 | PasswordFn func(string, ...string) bool 6 | HashFn func(string) string 7 | MatchesHashFn func(string, string) bool 8 | } 9 | 10 | // Password mock 11 | func (s *Secure) Password(pw string, inputs ...string) bool { 12 | return s.PasswordFn(pw, inputs...) 13 | } 14 | 15 | // Hash mock 16 | func (s *Secure) Hash(str string) string { 17 | return s.HashFn(str) 18 | } 19 | 20 | // MatchesHash mock 21 | func (s *Secure) MatchesHash(hash, pw string) bool { 22 | return s.MatchesHashFn(hash, pw) 23 | } 24 | -------------------------------------------------------------------------------- /vendor/github.com/grpc-ecosystem/grpc-gateway/utilities/BUILD.bazel: -------------------------------------------------------------------------------- 1 | load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test") 2 | 3 | package(default_visibility = ["//visibility:public"]) 4 | 5 | go_library( 6 | name = "go_default_library", 7 | srcs = [ 8 | "doc.go", 9 | "pattern.go", 10 | "trie.go", 11 | ], 12 | importpath = "github.com/grpc-ecosystem/grpc-gateway/utilities", 13 | ) 14 | 15 | go_test( 16 | name = "go_default_xtest", 17 | size = "small", 18 | srcs = ["trie_test.go"], 19 | deps = [":go_default_library"], 20 | ) 21 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_linux_gc.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build linux,!gccgo 6 | 7 | package unix 8 | 9 | // SyscallNoError may be used instead of Syscall for syscalls that don't fail. 10 | func SyscallNoError(trap, a1, a2, a3 uintptr) (r1, r2 uintptr) 11 | 12 | // RawSyscallNoError may be used instead of RawSyscall for syscalls that don't 13 | // fail. 14 | func RawSyscallNoError(trap, a1, a2, a3 uintptr) (r1, r2 uintptr) 15 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/windows/race0.go: -------------------------------------------------------------------------------- 1 | // Copyright 2012 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build windows,!race 6 | 7 | package windows 8 | 9 | import ( 10 | "unsafe" 11 | ) 12 | 13 | const raceenabled = false 14 | 15 | func raceAcquire(addr unsafe.Pointer) { 16 | } 17 | 18 | func raceReleaseMerge(addr unsafe.Pointer) { 19 | } 20 | 21 | func raceReadRange(addr unsafe.Pointer, len int) { 22 | } 23 | 24 | func raceWriteRange(addr unsafe.Pointer, len int) { 25 | } 26 | -------------------------------------------------------------------------------- /vendor/github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/generator/generator.go: -------------------------------------------------------------------------------- 1 | // Package generator provides an abstract interface to code generators. 2 | package generator 3 | 4 | import ( 5 | plugin "github.com/golang/protobuf/protoc-gen-go/plugin" 6 | "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/descriptor" 7 | ) 8 | 9 | // Generator is an abstraction of code generators. 10 | type Generator interface { 11 | // Generate generates output files from input .proto files. 12 | Generate(targets []*descriptor.File) ([]*plugin.CodeGeneratorResponse_File, error) 13 | } 14 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/windows/types_windows_386.go: -------------------------------------------------------------------------------- 1 | // Copyright 2011 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package windows 6 | 7 | type WSAData struct { 8 | Version uint16 9 | HighVersion uint16 10 | Description [WSADESCRIPTION_LEN + 1]byte 11 | SystemStatus [WSASYS_STATUS_LEN + 1]byte 12 | MaxSockets uint16 13 | MaxUdpDg uint16 14 | VendorInfo *byte 15 | } 16 | 17 | type Servent struct { 18 | Name *byte 19 | Aliases **byte 20 | Port uint16 21 | Proto *byte 22 | } 23 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/windows/types_windows_amd64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2011 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package windows 6 | 7 | type WSAData struct { 8 | Version uint16 9 | HighVersion uint16 10 | MaxSockets uint16 11 | MaxUdpDg uint16 12 | VendorInfo *byte 13 | Description [WSADESCRIPTION_LEN + 1]byte 14 | SystemStatus [WSASYS_STATUS_LEN + 1]byte 15 | } 16 | 17 | type Servent struct { 18 | Name *byte 19 | Aliases **byte 20 | Proto *byte 21 | Port uint16 22 | } 23 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/windows/str.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build windows 6 | 7 | package windows 8 | 9 | func itoa(val int) string { // do it here rather than with fmt to avoid dependency 10 | if val < 0 { 11 | return "-" + itoa(-val) 12 | } 13 | var buf [32]byte // big enough for int64 14 | i := len(buf) - 1 15 | for val >= 10 { 16 | buf[i] = byte(val%10 + '0') 17 | i-- 18 | val /= 10 19 | } 20 | buf[i] = byte(val + '0') 21 | return string(buf[i:]) 22 | } 23 | -------------------------------------------------------------------------------- /vendor/gopkg.in/yaml.v2/NOTICE: -------------------------------------------------------------------------------- 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/golang.org/x/sys/unix/race0.go: -------------------------------------------------------------------------------- 1 | // Copyright 2012 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build darwin,!race linux,!race freebsd,!race netbsd openbsd solaris dragonfly 6 | 7 | package unix 8 | 9 | import ( 10 | "unsafe" 11 | ) 12 | 13 | const raceenabled = false 14 | 15 | func raceAcquire(addr unsafe.Pointer) { 16 | } 17 | 18 | func raceReleaseMerge(addr unsafe.Pointer) { 19 | } 20 | 21 | func raceReadRange(addr unsafe.Pointer, len int) { 22 | } 23 | 24 | func raceWriteRange(addr unsafe.Pointer, len int) { 25 | } 26 | -------------------------------------------------------------------------------- /vendor/github.com/gogo/protobuf/AUTHORS: -------------------------------------------------------------------------------- 1 | # This is the official list of GoGo authors for copyright purposes. 2 | # This file is distinct from the CONTRIBUTORS file, which 3 | # lists people. For example, employees are listed in CONTRIBUTORS, 4 | # but not in AUTHORS, because the employer holds the copyright. 5 | 6 | # Names should be added to this file as one of 7 | # Organization's name 8 | # Individual's name 9 | # Individual's name 10 | 11 | # Please keep the list sorted. 12 | 13 | Sendgrid, Inc 14 | Vastech SA (PTY) LTD 15 | Walter Schulze 16 | -------------------------------------------------------------------------------- /vendor/github.com/twitchtv/twirp/tools.json: -------------------------------------------------------------------------------- 1 | { 2 | "Tools": [ 3 | { 4 | "Repository": "github.com/golang/protobuf/protoc-gen-go", 5 | "Commit": "c9c7427a2a70d2eb3bafa0ab2dc163e45f143317" 6 | }, 7 | { 8 | "Repository": "github.com/kisielk/errcheck", 9 | "Commit": "db0ca22445717d1b2c51ac1034440e0a2a2de645" 10 | }, 11 | { 12 | "Repository": "github.com/gogo/protobuf/protoc-gen-gofast", 13 | "Commit": "30433562cfbf487fe1df7cd26c7bab168d2f14d0" 14 | }, 15 | { 16 | "Repository": "github.com/twitchtv/retool", 17 | "Commit": "6f6d4930d88c40e23d2b54d12e64f0444e1fb4ef" 18 | } 19 | ] 20 | } -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_solaris_amd64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build amd64,solaris 6 | 7 | package unix 8 | 9 | func setTimespec(sec, nsec int64) Timespec { 10 | return Timespec{Sec: sec, Nsec: nsec} 11 | } 12 | 13 | func setTimeval(sec, usec int64) Timeval { 14 | return Timeval{Sec: sec, Usec: usec} 15 | } 16 | 17 | func (iov *Iovec) SetLen(length int) { 18 | iov.Len = uint64(length) 19 | } 20 | 21 | func (cmsg *Cmsghdr) SetLen(length int) { 22 | cmsg.Len = uint32(length) 23 | } 24 | -------------------------------------------------------------------------------- /vendor/github.com/go-pg/pg/internal/internal.go: -------------------------------------------------------------------------------- 1 | package internal 2 | 3 | import ( 4 | "math/rand" 5 | "time" 6 | ) 7 | 8 | // Retry backoff with jitter sleep to prevent overloaded conditions during intervals 9 | // https://www.awsarchitectureblog.com/2015/03/backoff.html 10 | func RetryBackoff(retry int, minBackoff, maxBackoff time.Duration) time.Duration { 11 | if retry < 0 { 12 | retry = 0 13 | } 14 | 15 | backoff := minBackoff << uint(retry) 16 | if backoff > maxBackoff || backoff < minBackoff { 17 | backoff = maxBackoff 18 | } 19 | 20 | if backoff == 0 { 21 | return 0 22 | } 23 | return time.Duration(rand.Int63n(int64(backoff))) 24 | } 25 | -------------------------------------------------------------------------------- /vendor/github.com/go-pg/pg/orm/relation.go: -------------------------------------------------------------------------------- 1 | package orm 2 | 3 | import ( 4 | "fmt" 5 | 6 | "github.com/go-pg/pg/types" 7 | ) 8 | 9 | const ( 10 | HasOneRelation = 1 << iota 11 | BelongsToRelation 12 | HasManyRelation 13 | Many2ManyRelation 14 | ) 15 | 16 | type Relation struct { 17 | Type int 18 | Field *Field 19 | JoinTable *Table 20 | FKs []*Field 21 | Polymorphic *Field 22 | FKValues []*Field 23 | 24 | M2MTableName types.Q 25 | M2MTableAlias types.Q 26 | BaseFKs []string 27 | JoinFKs []string 28 | } 29 | 30 | func (r *Relation) String() string { 31 | return fmt.Sprintf("relation=%s", r.Field.GoName) 32 | } 33 | -------------------------------------------------------------------------------- /vendor/github.com/go-pg/pg/orm/table_params.go: -------------------------------------------------------------------------------- 1 | package orm 2 | 3 | import "reflect" 4 | 5 | type tableParams struct { 6 | table *Table 7 | strct reflect.Value 8 | } 9 | 10 | func newTableParams(strct interface{}) (*tableParams, bool) { 11 | v := reflect.ValueOf(strct) 12 | if !v.IsValid() { 13 | return nil, false 14 | } 15 | 16 | v = reflect.Indirect(v) 17 | if v.Kind() != reflect.Struct { 18 | return nil, false 19 | } 20 | 21 | return &tableParams{ 22 | table: GetTable(v.Type()), 23 | strct: v, 24 | }, true 25 | } 26 | 27 | func (m tableParams) AppendParam(b []byte, f QueryFormatter, name string) ([]byte, bool) { 28 | return m.table.AppendParam(b, m.strct, name) 29 | } 30 | -------------------------------------------------------------------------------- /vendor/github.com/rs/zerolog/encoder_json.go: -------------------------------------------------------------------------------- 1 | // +build !binary_log 2 | 3 | package zerolog 4 | 5 | // encoder_json.go file contains bindings to generate 6 | // JSON encoded byte stream. 7 | 8 | import ( 9 | "github.com/rs/zerolog/internal/json" 10 | ) 11 | 12 | var ( 13 | _ encoder = (*json.Encoder)(nil) 14 | 15 | enc = json.Encoder{} 16 | ) 17 | 18 | func appendJSON(dst []byte, j []byte) []byte { 19 | return append(dst, j...) 20 | } 21 | 22 | func decodeIfBinaryToString(in []byte) string { 23 | return string(in) 24 | } 25 | 26 | func decodeObjectToStr(in []byte) string { 27 | return string(in) 28 | } 29 | 30 | func decodeIfBinaryToBytes(in []byte) []byte { 31 | return in 32 | } 33 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_linux_gc_386.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build linux,!gccgo,386 6 | 7 | package unix 8 | 9 | import "syscall" 10 | 11 | // Underlying system call writes to newoffset via pointer. 12 | // Implemented in assembly to avoid allocation. 13 | func seek(fd int, offset int64, whence int) (newoffset int64, err syscall.Errno) 14 | 15 | func socketcall(call int, a0, a1, a2, a3, a4, a5 uintptr) (n int, err syscall.Errno) 16 | func rawsocketcall(call int, a0, a1, a2, a3, a4, a5 uintptr) (n int, err syscall.Errno) 17 | -------------------------------------------------------------------------------- /pkg/mw/cors.go: -------------------------------------------------------------------------------- 1 | package mw 2 | 3 | import "net/http" 4 | 5 | // CORS adds support for Cross-Origin Resource Sharing 6 | func CORS(hf http.Handler) http.Handler { 7 | fn := func(w http.ResponseWriter, r *http.Request) { 8 | if r.Method == "OPTIONS" { 9 | w.Header().Add("Access-Control-Allow-Origin", "*") 10 | w.Header().Add("Access-Control-Allow-Methods", "POST") 11 | w.Header().Add("Access-Control-Allow-Headers", "Authorization, Content-Type") 12 | w.Header().Add("Access-Control-Max-Age", "86400") 13 | w.WriteHeader(200) 14 | return 15 | } 16 | w.Header().Add("Access-Control-Allow-Origin", "*") 17 | 18 | hf.ServeHTTP(w, r) 19 | } 20 | 21 | return http.HandlerFunc(fn) 22 | } 23 | -------------------------------------------------------------------------------- /vendor/github.com/mwitkow/go-proto-validators/install_protoc.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright 2016 Michal Witkowski. All Rights Reserved. 3 | # See LICENSE for licensing terms. 4 | # 5 | # This script installs protobuf compiler `protoc` into PATH. 6 | 7 | version=${PROTOBUF_VERSION:-"3.0.0-beta-2"} 8 | dst_dir="${HOME}/soft/protobuf" 9 | 10 | # Fail on issues. 11 | set -e 12 | 13 | echo "Downloading and installing protoc ${version}" 14 | 15 | mkdir -p ${dst_dir} 16 | 17 | wget https://github.com/google/protobuf/releases/download/v${version}/protoc-${version}-linux-x86_64.zip -O ${dst_dir}/dist.zip 18 | 19 | cd ${dst_dir} 20 | unzip -o dist.zip 21 | 22 | echo "Proto in \$PROTOBUF_DIR=${PROTOBUF_DIR}" 23 | -------------------------------------------------------------------------------- /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/dirent.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build darwin dragonfly freebsd linux nacl netbsd openbsd solaris 6 | 7 | package unix 8 | 9 | import "syscall" 10 | 11 | // ParseDirent parses up to max directory entries in buf, 12 | // appending the names to names. It returns the number of 13 | // bytes consumed from buf, the number of entries added 14 | // to names, and the new names slice. 15 | func ParseDirent(buf []byte, max int, names []string) (consumed int, count int, newnames []string) { 16 | return syscall.ParseDirent(buf, max, names) 17 | } 18 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_linux_gccgo_arm.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build linux,gccgo,arm 6 | 7 | package unix 8 | 9 | import ( 10 | "syscall" 11 | "unsafe" 12 | ) 13 | 14 | func seek(fd int, offset int64, whence int) (int64, syscall.Errno) { 15 | var newoffset int64 16 | offsetLow := uint32(offset & 0xffffffff) 17 | offsetHigh := uint32((offset >> 32) & 0xffffffff) 18 | _, _, err := Syscall6(SYS__LLSEEK, uintptr(fd), uintptr(offsetHigh), uintptr(offsetLow), uintptr(unsafe.Pointer(&newoffset)), uintptr(whence), 0) 19 | return newoffset, err 20 | } 21 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/windows/env_windows.go: -------------------------------------------------------------------------------- 1 | // Copyright 2010 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // Windows environment variables. 6 | 7 | package windows 8 | 9 | import "syscall" 10 | 11 | func Getenv(key string) (value string, found bool) { 12 | return syscall.Getenv(key) 13 | } 14 | 15 | func Setenv(key, value string) error { 16 | return syscall.Setenv(key, value) 17 | } 18 | 19 | func Clearenv() { 20 | syscall.Clearenv() 21 | } 22 | 23 | func Environ() []string { 24 | return syscall.Environ() 25 | } 26 | 27 | func Unsetenv(key string) error { 28 | return syscall.Unsetenv(key) 29 | } 30 | -------------------------------------------------------------------------------- /vendor/github.com/gorilla/context/README.md: -------------------------------------------------------------------------------- 1 | context 2 | ======= 3 | [![Build Status](https://travis-ci.org/gorilla/context.png?branch=master)](https://travis-ci.org/gorilla/context) 4 | 5 | gorilla/context is a general purpose registry for global request variables. 6 | 7 | > Note: gorilla/context, having been born well before `context.Context` existed, does not play well 8 | > with the shallow copying of the request that [`http.Request.WithContext`](https://golang.org/pkg/net/http/#Request.WithContext) (added to net/http Go 1.7 onwards) performs. You should either use *just* gorilla/context, or moving forward, the new `http.Request.Context()`. 9 | 10 | Read the full documentation here: http://www.gorillatoolkit.org/pkg/context 11 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/str.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build darwin dragonfly freebsd linux netbsd openbsd solaris 6 | 7 | package unix 8 | 9 | func itoa(val int) string { // do it here rather than with fmt to avoid dependency 10 | if val < 0 { 11 | return "-" + uitoa(uint(-val)) 12 | } 13 | return uitoa(uint(val)) 14 | } 15 | 16 | func uitoa(val uint) string { 17 | var buf [32]byte // big enough for int64 18 | i := len(buf) - 1 19 | for val >= 10 { 20 | buf[i] = byte(val%10 + '0') 21 | i-- 22 | val /= 10 23 | } 24 | buf[i] = byte(val + '0') 25 | return string(buf[i:]) 26 | } 27 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/windows/race.go: -------------------------------------------------------------------------------- 1 | // Copyright 2012 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build windows,race 6 | 7 | package windows 8 | 9 | import ( 10 | "runtime" 11 | "unsafe" 12 | ) 13 | 14 | const raceenabled = true 15 | 16 | func raceAcquire(addr unsafe.Pointer) { 17 | runtime.RaceAcquire(addr) 18 | } 19 | 20 | func raceReleaseMerge(addr unsafe.Pointer) { 21 | runtime.RaceReleaseMerge(addr) 22 | } 23 | 24 | func raceReadRange(addr unsafe.Pointer, len int) { 25 | runtime.RaceReadRange(addr, len) 26 | } 27 | 28 | func raceWriteRange(addr unsafe.Pointer, len int) { 29 | runtime.RaceWriteRange(addr, len) 30 | } 31 | -------------------------------------------------------------------------------- /vendor/github.com/go-pg/pg/types/interface.go: -------------------------------------------------------------------------------- 1 | package types 2 | 3 | type ValueAppender interface { 4 | AppendValue(b []byte, quote int) []byte 5 | } 6 | 7 | //------------------------------------------------------------------------------ 8 | 9 | // Q represents safe SQL query. 10 | type Q string 11 | 12 | var _ ValueAppender = Q("") 13 | 14 | func (q Q) AppendValue(b []byte, quote int) []byte { 15 | return append(b, q...) 16 | } 17 | 18 | //------------------------------------------------------------------------------ 19 | 20 | // F represents a SQL field, e.g. table or column name. 21 | type F string 22 | 23 | var _ ValueAppender = F("") 24 | 25 | func (f F) AppendValue(b []byte, quote int) []byte { 26 | return AppendField(b, string(f), quote) 27 | } 28 | -------------------------------------------------------------------------------- /vendor/github.com/nbutton23/zxcvbn-go/Gopkg.toml: -------------------------------------------------------------------------------- 1 | 2 | # Gopkg.toml example 3 | # 4 | # Refer to https://github.com/golang/dep/blob/master/docs/Gopkg.toml.md 5 | # for detailed Gopkg.toml documentation. 6 | # 7 | # required = ["github.com/user/thing/cmd/thing"] 8 | # ignored = ["github.com/user/project/pkgX", "bitbucket.org/user/project/pkgA/pkgY"] 9 | # 10 | # [[constraint]] 11 | # name = "github.com/user/project" 12 | # version = "1.0.0" 13 | # 14 | # [[constraint]] 15 | # name = "github.com/user/project2" 16 | # branch = "dev" 17 | # source = "github.com/myfork/project2" 18 | # 19 | # [[override]] 20 | # name = "github.com/x/y" 21 | # version = "2.4.0" 22 | 23 | 24 | [[constraint]] 25 | name = "github.com/stretchr/testify" 26 | version = "1.1.4" 27 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/race.go: -------------------------------------------------------------------------------- 1 | // Copyright 2012 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build darwin,race linux,race freebsd,race 6 | 7 | package unix 8 | 9 | import ( 10 | "runtime" 11 | "unsafe" 12 | ) 13 | 14 | const raceenabled = true 15 | 16 | func raceAcquire(addr unsafe.Pointer) { 17 | runtime.RaceAcquire(addr) 18 | } 19 | 20 | func raceReleaseMerge(addr unsafe.Pointer) { 21 | runtime.RaceReleaseMerge(addr) 22 | } 23 | 24 | func raceReadRange(addr unsafe.Pointer, len int) { 25 | runtime.RaceReadRange(addr, len) 26 | } 27 | 28 | func raceWriteRange(addr unsafe.Pointer, len int) { 29 | runtime.RaceWriteRange(addr, len) 30 | } 31 | -------------------------------------------------------------------------------- /vendor/github.com/grpc-ecosystem/grpc-gateway/utilities/pattern.go: -------------------------------------------------------------------------------- 1 | package utilities 2 | 3 | // An OpCode is a opcode of compiled path patterns. 4 | type OpCode int 5 | 6 | // These constants are the valid values of OpCode. 7 | const ( 8 | // OpNop does nothing 9 | OpNop = OpCode(iota) 10 | // OpPush pushes a component to stack 11 | OpPush 12 | // OpLitPush pushes a component to stack if it matches to the literal 13 | OpLitPush 14 | // OpPushM concatenates the remaining components and pushes it to stack 15 | OpPushM 16 | // OpConcatN pops N items from stack, concatenates them and pushes it back to stack 17 | OpConcatN 18 | // OpCapture pops an item and binds it to the variable 19 | OpCapture 20 | // OpEnd is the least positive invalid opcode. 21 | OpEnd 22 | ) 23 | -------------------------------------------------------------------------------- /vendor/github.com/grpc-ecosystem/grpc-gateway/codegenerator/parse_req.go: -------------------------------------------------------------------------------- 1 | package codegenerator 2 | 3 | import ( 4 | "fmt" 5 | "io" 6 | "io/ioutil" 7 | 8 | "github.com/golang/protobuf/proto" 9 | plugin "github.com/golang/protobuf/protoc-gen-go/plugin" 10 | ) 11 | 12 | // ParseRequest parses a code generator request from a proto Message. 13 | func ParseRequest(r io.Reader) (*plugin.CodeGeneratorRequest, error) { 14 | input, err := ioutil.ReadAll(r) 15 | if err != nil { 16 | return nil, fmt.Errorf("failed to read code generator request: %v", err) 17 | } 18 | req := new(plugin.CodeGeneratorRequest) 19 | if err = proto.Unmarshal(input, req); err != nil { 20 | return nil, fmt.Errorf("failed to unmarshal code generator request: %v", err) 21 | } 22 | return req, nil 23 | } 24 | -------------------------------------------------------------------------------- /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 | 29 | func Unsetenv(key string) error { 30 | return syscall.Unsetenv(key) 31 | } 32 | -------------------------------------------------------------------------------- /vendor/github.com/nbutton23/zxcvbn-go/zxcvbn.go: -------------------------------------------------------------------------------- 1 | package zxcvbn 2 | 3 | import ( 4 | "time" 5 | 6 | "github.com/nbutton23/zxcvbn-go/match" 7 | "github.com/nbutton23/zxcvbn-go/matching" 8 | "github.com/nbutton23/zxcvbn-go/scoring" 9 | "github.com/nbutton23/zxcvbn-go/utils/math" 10 | ) 11 | 12 | func PasswordStrength(password string, userInputs []string, filters ...func(match.Matcher) bool) scoring.MinEntropyMatch { 13 | start := time.Now() 14 | matches := matching.Omnimatch(password, userInputs, filters...) 15 | result := scoring.MinimumEntropyMatchSequence(password, matches) 16 | end := time.Now() 17 | 18 | calcTime := end.Nanosecond() - start.Nanosecond() 19 | result.CalcTime = zxcvbn_math.Round(float64(calcTime)*time.Nanosecond.Seconds(), .5, 3) 20 | return result 21 | } 22 | -------------------------------------------------------------------------------- /vendor/gopkg.in/yaml.v2/writerc.go: -------------------------------------------------------------------------------- 1 | package yaml 2 | 3 | // Set the writer error and return false. 4 | func yaml_emitter_set_writer_error(emitter *yaml_emitter_t, problem string) bool { 5 | emitter.error = yaml_WRITER_ERROR 6 | emitter.problem = problem 7 | return false 8 | } 9 | 10 | // Flush the output buffer. 11 | func yaml_emitter_flush(emitter *yaml_emitter_t) bool { 12 | if emitter.write_handler == nil { 13 | panic("write handler not set") 14 | } 15 | 16 | // Check if the buffer is empty. 17 | if emitter.buffer_pos == 0 { 18 | return true 19 | } 20 | 21 | if err := emitter.write_handler(emitter, emitter.buffer[:emitter.buffer_pos]); err != nil { 22 | return yaml_emitter_set_writer_error(emitter, "write error: "+err.Error()) 23 | } 24 | emitter.buffer_pos = 0 25 | return true 26 | } 27 | -------------------------------------------------------------------------------- /cmd/api/conf.local.yaml: -------------------------------------------------------------------------------- 1 | server: 2 | port: :8080 3 | read_timeout_seconds: 31 4 | write_timeout_seconds: 30 5 | 6 | database: 7 | # postgres://docvsjvu:hR7Zs5Yx58hKSoMOGeYjgJj3BbLZcQvM@horton.elephantsql.com:5432/docvsjvu 8 | # Provided database is a sample instance from elephantsql.com 9 | # Feel free to use it for testing. You can easily host one for yourself 10 | # and fill in the data using cmd/api/migration.go 11 | psn: postgres://postgres:postgres@localhost:5432/postgres 12 | log_queries: false 13 | timeout_seconds: 10 14 | 15 | jwt: 16 | secret: jwtsecret # Change this value 17 | duration_minutes: 15 18 | signing_algorithm: HS256 19 | 20 | application: 21 | min_password_strength: 1 # Minimum password zxcvbn strength 22 | 23 | openapi: 24 | username: admin 25 | password: admin -------------------------------------------------------------------------------- /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_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_arm.s: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for ARM, OpenBSD 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-28 17 | B syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-40 20 | B syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-52 23 | B syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28 26 | B syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 29 | B syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /vendor/github.com/go-pg/pg/orm/model_slice.go: -------------------------------------------------------------------------------- 1 | package orm 2 | 3 | import ( 4 | "reflect" 5 | 6 | "github.com/go-pg/pg/internal" 7 | ) 8 | 9 | type sliceModel struct { 10 | Discard 11 | slice reflect.Value 12 | nextElem func() reflect.Value 13 | scan func(reflect.Value, []byte) error 14 | } 15 | 16 | var _ Model = (*sliceModel)(nil) 17 | 18 | func (m *sliceModel) Init() error { 19 | if m.slice.IsValid() && m.slice.Len() > 0 { 20 | m.slice.Set(m.slice.Slice(0, 0)) 21 | } 22 | return nil 23 | } 24 | 25 | func (m *sliceModel) NewModel() ColumnScanner { 26 | return m 27 | } 28 | 29 | func (m *sliceModel) ScanColumn(colIdx int, _ string, b []byte) error { 30 | if m.nextElem == nil { 31 | m.nextElem = internal.MakeSliceNextElemFunc(m.slice) 32 | } 33 | v := m.nextElem() 34 | return m.scan(v, b) 35 | } 36 | -------------------------------------------------------------------------------- /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_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_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_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_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_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_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_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_dragonfly_amd64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for AMD64, DragonFly 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-56 17 | JMP syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 20 | JMP syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-104 23 | JMP syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 26 | JMP syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 29 | JMP syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_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/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/github.com/davecgh/go-spew/LICENSE: -------------------------------------------------------------------------------- 1 | ISC License 2 | 3 | Copyright (c) 2012-2016 Dave Collins 4 | 5 | Permission to use, copy, modify, and distribute this software for any 6 | purpose with or without fee is hereby granted, provided that the above 7 | copyright notice and this permission notice appear in all copies. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 10 | WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 11 | MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 12 | ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 13 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 14 | ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 15 | OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16 | -------------------------------------------------------------------------------- /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/github.com/go-pg/pg/types/append_jsonb.go: -------------------------------------------------------------------------------- 1 | package types 2 | 3 | import "github.com/go-pg/pg/internal/parser" 4 | 5 | func AppendJSONB(b, jsonb []byte, quote int) []byte { 6 | if quote == 1 { 7 | b = append(b, '\'') 8 | } 9 | 10 | p := parser.New(jsonb) 11 | for p.Valid() { 12 | c := p.Read() 13 | switch c { 14 | case '\'': 15 | if quote == 1 { 16 | b = append(b, '\'', '\'') 17 | } else { 18 | b = append(b, '\'') 19 | } 20 | case '\000': 21 | continue 22 | case '\\': 23 | if p.SkipBytes([]byte("u0000")) { 24 | b = append(b, "\\\\u0000"...) 25 | } else { 26 | b = append(b, '\\') 27 | if p.Valid() { 28 | b = append(b, p.Read()) 29 | } 30 | } 31 | default: 32 | b = append(b, c) 33 | } 34 | } 35 | 36 | if quote == 1 { 37 | b = append(b, '\'') 38 | } 39 | 40 | return b 41 | } 42 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/windows/memory_windows.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package windows 6 | 7 | const ( 8 | MEM_COMMIT = 0x00001000 9 | MEM_RESERVE = 0x00002000 10 | MEM_DECOMMIT = 0x00004000 11 | MEM_RELEASE = 0x00008000 12 | MEM_RESET = 0x00080000 13 | MEM_TOP_DOWN = 0x00100000 14 | MEM_WRITE_WATCH = 0x00200000 15 | MEM_PHYSICAL = 0x00400000 16 | MEM_RESET_UNDO = 0x01000000 17 | MEM_LARGE_PAGES = 0x20000000 18 | 19 | PAGE_NOACCESS = 0x01 20 | PAGE_READONLY = 0x02 21 | PAGE_READWRITE = 0x04 22 | PAGE_WRITECOPY = 0x08 23 | PAGE_EXECUTE_READ = 0x20 24 | PAGE_EXECUTE_READWRITE = 0x40 25 | PAGE_EXECUTE_WRITECOPY = 0x80 26 | ) 27 | -------------------------------------------------------------------------------- /internal/pkg/query/query.go: -------------------------------------------------------------------------------- 1 | package query 2 | 3 | import ( 4 | "fmt" 5 | 6 | "github.com/ribice/twisk/model" 7 | ) 8 | 9 | // ForTenant returns query for filtering rows by tenant_id 10 | func ForTenant(u *twisk.AuthUser, tenantID int32) string { 11 | switch u.Role { 12 | case twisk.SuperAdminRole, twisk.AdminRole: 13 | if tenantID != 0 { 14 | return fmt.Sprintf("tenant_id = %v", tenantID) 15 | } 16 | return "" 17 | default: 18 | return fmt.Sprintf("tenant_id = %v", u.TenantID) 19 | 20 | } 21 | } 22 | 23 | // Pagination holds paginations data 24 | type Pagination struct { 25 | Limit int32 26 | Offset int32 27 | } 28 | 29 | // Paginate returns pagination details with default query limit 30 | func Paginate(limit, page int32) (int, int) { 31 | if limit < 1 { 32 | limit = 50 33 | } 34 | return int(limit), int(limit * (page - 1)) 35 | 36 | } 37 | -------------------------------------------------------------------------------- /vendor/github.com/gorilla/mux/test_helpers.go: -------------------------------------------------------------------------------- 1 | // Copyright 2012 The Gorilla Authors. All rights reserved. 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 mux 6 | 7 | import "net/http" 8 | 9 | // SetURLVars sets the URL variables for the given request, to be accessed via 10 | // mux.Vars for testing route behaviour. Arguments are not modified, a shallow 11 | // copy is returned. 12 | // 13 | // This API should only be used for testing purposes; it provides a way to 14 | // inject variables into the request context. Alternatively, URL variables 15 | // can be set by making a route that captures the required variables, 16 | // starting a server and sending the request to that server. 17 | func SetURLVars(r *http.Request, val map[string]string) *http.Request { 18 | return setVars(r, val) 19 | } 20 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/dev_darwin.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // Functions to access/create device major and minor numbers matching the 6 | // encoding used in Darwin's sys/types.h header. 7 | 8 | package unix 9 | 10 | // Major returns the major component of a Darwin device number. 11 | func Major(dev uint64) uint32 { 12 | return uint32((dev >> 24) & 0xff) 13 | } 14 | 15 | // Minor returns the minor component of a Darwin device number. 16 | func Minor(dev uint64) uint32 { 17 | return uint32(dev & 0xffffff) 18 | } 19 | 20 | // Mkdev returns a Darwin device number generated from the given major and minor 21 | // components. 22 | func Mkdev(major, minor uint32) uint64 { 23 | return (uint64(major) << 24) | uint64(minor) 24 | } 25 | -------------------------------------------------------------------------------- /vendor/github.com/nbutton23/zxcvbn-go/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/pmezard/go-difflib" 12 | packages = ["difflib"] 13 | revision = "792786c7400a136282c1664665ae0a8db921c6c2" 14 | version = "v1.0.0" 15 | 16 | [[projects]] 17 | name = "github.com/stretchr/testify" 18 | packages = ["assert"] 19 | revision = "69483b4bd14f5845b5a1e55bca19e954e827f1d0" 20 | version = "v1.1.4" 21 | 22 | [solve-meta] 23 | analyzer-name = "dep" 24 | analyzer-version = 1 25 | inputs-digest = "b750880cdc8ce044e6f9bf3b331d8a392471c328107b8c3d42e3e11022d76858" 26 | solver-name = "gps-cdcl" 27 | solver-version = 1 28 | -------------------------------------------------------------------------------- /vendor/github.com/nbutton23/zxcvbn-go/match/match.go: -------------------------------------------------------------------------------- 1 | package match 2 | 3 | type Matches []Match 4 | 5 | func (s Matches) Len() int { 6 | return len(s) 7 | } 8 | func (s Matches) Swap(i, j int) { 9 | s[i], s[j] = s[j], s[i] 10 | } 11 | func (s Matches) Less(i, j int) bool { 12 | if s[i].I < s[j].I { 13 | return true 14 | } else if s[i].I == s[j].I { 15 | return s[i].J < s[j].J 16 | } else { 17 | return false 18 | } 19 | } 20 | 21 | type Match struct { 22 | Pattern string 23 | I, J int 24 | Token string 25 | DictionaryName string 26 | Entropy float64 27 | } 28 | 29 | type DateMatch struct { 30 | Pattern string 31 | I, J int 32 | Token string 33 | Separator string 34 | Day, Month, Year int64 35 | } 36 | 37 | type Matcher struct { 38 | MatchingFunc func(password string) []Match 39 | ID string 40 | } 41 | -------------------------------------------------------------------------------- /vendor/github.com/grpc-ecosystem/grpc-gateway/codegenerator/BUILD.bazel: -------------------------------------------------------------------------------- 1 | load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test") 2 | 3 | package(default_visibility = ["//:generators"]) 4 | 5 | go_library( 6 | name = "go_default_library", 7 | srcs = [ 8 | "doc.go", 9 | "parse_req.go", 10 | ], 11 | importpath = "github.com/grpc-ecosystem/grpc-gateway/codegenerator", 12 | deps = [ 13 | "@com_github_golang_protobuf//proto:go_default_library", 14 | "@com_github_golang_protobuf//protoc-gen-go/plugin:go_default_library", 15 | ], 16 | ) 17 | 18 | go_test( 19 | name = "go_default_xtest", 20 | srcs = ["parse_req_test.go"], 21 | deps = [ 22 | ":go_default_library", 23 | "@com_github_golang_protobuf//proto:go_default_library", 24 | "@com_github_golang_protobuf//protoc-gen-go/plugin:go_default_library", 25 | ], 26 | ) 27 | -------------------------------------------------------------------------------- /vendor/github.com/nbutton23/zxcvbn-go/utils/math/mathutils.go: -------------------------------------------------------------------------------- 1 | package zxcvbn_math 2 | 3 | import "math" 4 | 5 | /** 6 | I am surprised that I have to define these. . . Maybe i just didn't look hard enough for a lib. 7 | */ 8 | 9 | //http://blog.plover.com/math/choose.html 10 | func NChoseK(n, k float64) float64 { 11 | if k > n { 12 | return 0 13 | } else if k == 0 { 14 | return 1 15 | } 16 | 17 | var r float64 = 1 18 | 19 | for d := float64(1); d <= k; d++ { 20 | r *= n 21 | r /= d 22 | n-- 23 | } 24 | 25 | return r 26 | } 27 | 28 | func Round(val float64, roundOn float64, places int) (newVal float64) { 29 | var round float64 30 | pow := math.Pow(10, float64(places)) 31 | digit := pow * val 32 | _, div := math.Modf(digit) 33 | if div >= roundOn { 34 | round = math.Ceil(digit) 35 | } else { 36 | round = math.Floor(digit) 37 | } 38 | newVal = round / pow 39 | return 40 | } 41 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_netbsd_amd64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build amd64,netbsd 6 | 7 | package unix 8 | 9 | func setTimespec(sec, nsec int64) Timespec { 10 | return Timespec{Sec: sec, Nsec: nsec} 11 | } 12 | 13 | func setTimeval(sec, usec int64) Timeval { 14 | return Timeval{Sec: sec, Usec: int32(usec)} 15 | } 16 | 17 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 18 | k.Ident = uint64(fd) 19 | k.Filter = uint32(mode) 20 | k.Flags = uint32(flags) 21 | } 22 | 23 | func (iov *Iovec) SetLen(length int) { 24 | iov.Len = uint64(length) 25 | } 26 | 27 | func (msghdr *Msghdr) SetControllen(length int) { 28 | msghdr.Controllen = uint32(length) 29 | } 30 | 31 | func (cmsg *Cmsghdr) SetLen(length int) { 32 | cmsg.Len = uint32(length) 33 | } 34 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_netbsd_386.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build 386,netbsd 6 | 7 | package unix 8 | 9 | func setTimespec(sec, nsec int64) Timespec { 10 | return Timespec{Sec: sec, Nsec: int32(nsec)} 11 | } 12 | 13 | func setTimeval(sec, usec int64) Timeval { 14 | return Timeval{Sec: sec, Usec: int32(usec)} 15 | } 16 | 17 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 18 | k.Ident = uint32(fd) 19 | k.Filter = uint32(mode) 20 | k.Flags = uint32(flags) 21 | } 22 | 23 | func (iov *Iovec) SetLen(length int) { 24 | iov.Len = uint32(length) 25 | } 26 | 27 | func (msghdr *Msghdr) SetControllen(length int) { 28 | msghdr.Controllen = uint32(length) 29 | } 30 | 31 | func (cmsg *Cmsghdr) SetLen(length int) { 32 | cmsg.Len = uint32(length) 33 | } 34 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_netbsd_arm.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build arm,netbsd 6 | 7 | package unix 8 | 9 | func setTimespec(sec, nsec int64) Timespec { 10 | return Timespec{Sec: sec, Nsec: int32(nsec)} 11 | } 12 | 13 | func setTimeval(sec, usec int64) Timeval { 14 | return Timeval{Sec: sec, Usec: int32(usec)} 15 | } 16 | 17 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 18 | k.Ident = uint32(fd) 19 | k.Filter = uint32(mode) 20 | k.Flags = uint32(flags) 21 | } 22 | 23 | func (iov *Iovec) SetLen(length int) { 24 | iov.Len = uint32(length) 25 | } 26 | 27 | func (msghdr *Msghdr) SetControllen(length int) { 28 | msghdr.Controllen = uint32(length) 29 | } 30 | 31 | func (cmsg *Cmsghdr) SetLen(length int) { 32 | cmsg.Len = uint32(length) 33 | } 34 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_openbsd_386.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build 386,openbsd 6 | 7 | package unix 8 | 9 | func setTimespec(sec, nsec int64) Timespec { 10 | return Timespec{Sec: sec, Nsec: int32(nsec)} 11 | } 12 | 13 | func setTimeval(sec, usec int64) Timeval { 14 | return Timeval{Sec: sec, Usec: int32(usec)} 15 | } 16 | 17 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 18 | k.Ident = uint32(fd) 19 | k.Filter = int16(mode) 20 | k.Flags = uint16(flags) 21 | } 22 | 23 | func (iov *Iovec) SetLen(length int) { 24 | iov.Len = uint32(length) 25 | } 26 | 27 | func (msghdr *Msghdr) SetControllen(length int) { 28 | msghdr.Controllen = uint32(length) 29 | } 30 | 31 | func (cmsg *Cmsghdr) SetLen(length int) { 32 | cmsg.Len = uint32(length) 33 | } 34 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_openbsd_arm.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build arm,openbsd 6 | 7 | package unix 8 | 9 | func setTimespec(sec, nsec int64) Timespec { 10 | return Timespec{Sec: sec, Nsec: int32(nsec)} 11 | } 12 | 13 | func setTimeval(sec, usec int64) Timeval { 14 | return Timeval{Sec: sec, Usec: int32(usec)} 15 | } 16 | 17 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 18 | k.Ident = uint32(fd) 19 | k.Filter = int16(mode) 20 | k.Flags = uint16(flags) 21 | } 22 | 23 | func (iov *Iovec) SetLen(length int) { 24 | iov.Len = uint32(length) 25 | } 26 | 27 | func (msghdr *Msghdr) SetControllen(length int) { 28 | msghdr.Controllen = uint32(length) 29 | } 30 | 31 | func (cmsg *Cmsghdr) SetLen(length int) { 32 | cmsg.Len = uint32(length) 33 | } 34 | -------------------------------------------------------------------------------- /vendor/github.com/go-pg/pg/internal/util.go: -------------------------------------------------------------------------------- 1 | package internal 2 | 3 | import "reflect" 4 | 5 | func MakeSliceNextElemFunc(v reflect.Value) func() reflect.Value { 6 | elemType := v.Type().Elem() 7 | 8 | if elemType.Kind() == reflect.Ptr { 9 | elemType = elemType.Elem() 10 | return func() reflect.Value { 11 | if v.Len() < v.Cap() { 12 | v.Set(v.Slice(0, v.Len()+1)) 13 | elem := v.Index(v.Len() - 1) 14 | if elem.IsNil() { 15 | elem.Set(reflect.New(elemType)) 16 | } 17 | return elem.Elem() 18 | } 19 | 20 | elem := reflect.New(elemType) 21 | v.Set(reflect.Append(v, elem)) 22 | return elem.Elem() 23 | } 24 | } 25 | 26 | zero := reflect.Zero(elemType) 27 | return func() reflect.Value { 28 | if v.Len() < v.Cap() { 29 | v.Set(v.Slice(0, v.Len()+1)) 30 | return v.Index(v.Len() - 1) 31 | } 32 | 33 | v.Set(reflect.Append(v, zero)) 34 | return v.Index(v.Len() - 1) 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/windows/eventlog.go: -------------------------------------------------------------------------------- 1 | // Copyright 2012 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build windows 6 | 7 | package windows 8 | 9 | const ( 10 | EVENTLOG_SUCCESS = 0 11 | EVENTLOG_ERROR_TYPE = 1 12 | EVENTLOG_WARNING_TYPE = 2 13 | EVENTLOG_INFORMATION_TYPE = 4 14 | EVENTLOG_AUDIT_SUCCESS = 8 15 | EVENTLOG_AUDIT_FAILURE = 16 16 | ) 17 | 18 | //sys RegisterEventSource(uncServerName *uint16, sourceName *uint16) (handle Handle, err error) [failretval==0] = advapi32.RegisterEventSourceW 19 | //sys DeregisterEventSource(handle Handle) (err error) = advapi32.DeregisterEventSource 20 | //sys ReportEvent(log Handle, etype uint16, category uint16, eventId uint32, usrSId uintptr, numStrings uint16, dataSize uint32, strings **uint16, rawData *byte) (err error) = advapi32.ReportEventW 21 | -------------------------------------------------------------------------------- /vendor/github.com/go-pg/pg/internal/parser/hstore_parser.go: -------------------------------------------------------------------------------- 1 | package parser 2 | 3 | import "fmt" 4 | 5 | type HstoreParser struct { 6 | *Parser 7 | } 8 | 9 | func NewHstoreParser(b []byte) *HstoreParser { 10 | return &HstoreParser{ 11 | Parser: New(b), 12 | } 13 | } 14 | 15 | func (p *HstoreParser) NextKey() ([]byte, error) { 16 | if p.Skip(',') { 17 | p.Skip(' ') 18 | } 19 | 20 | if !p.Skip('"') { 21 | return nil, fmt.Errorf("pg: can't parse hstore key: %q", p.Bytes()) 22 | } 23 | 24 | key := p.readSubstring() 25 | if !(p.Skip('=') && p.Skip('>')) { 26 | return nil, fmt.Errorf("pg: can't parse hstore key: %q", p.Bytes()) 27 | } 28 | 29 | return key, nil 30 | } 31 | 32 | func (p *HstoreParser) NextValue() ([]byte, error) { 33 | if !p.Skip('"') { 34 | return nil, fmt.Errorf("pg: can't parse hstore value: %q", p.Bytes()) 35 | } 36 | 37 | value := p.readSubstring() 38 | p.SkipBytes([]byte(", ")) 39 | return value, nil 40 | } 41 | -------------------------------------------------------------------------------- /vendor/github.com/rs/zerolog/encoder_cbor.go: -------------------------------------------------------------------------------- 1 | // +build binary_log 2 | 3 | package zerolog 4 | 5 | // This file contains bindings to do binary encoding. 6 | 7 | import ( 8 | "github.com/rs/zerolog/internal/cbor" 9 | ) 10 | 11 | var ( 12 | _ encoder = (*cbor.Encoder)(nil) 13 | 14 | enc = cbor.Encoder{} 15 | ) 16 | 17 | func appendJSON(dst []byte, j []byte) []byte { 18 | return cbor.AppendEmbeddedJSON(dst, j) 19 | } 20 | 21 | // decodeIfBinaryToString - converts a binary formatted log msg to a 22 | // JSON formatted String Log message. 23 | func decodeIfBinaryToString(in []byte) string { 24 | return cbor.DecodeIfBinaryToString(in) 25 | } 26 | 27 | func decodeObjectToStr(in []byte) string { 28 | return cbor.DecodeObjectToStr(in) 29 | } 30 | 31 | // decodeIfBinaryToBytes - converts a binary formatted log msg to a 32 | // JSON formatted Bytes Log message. 33 | func decodeIfBinaryToBytes(in []byte) []byte { 34 | return cbor.DecodeIfBinaryToBytes(in) 35 | } 36 | -------------------------------------------------------------------------------- /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 < 2 | Brian Goff 3 | Clayton Coleman 4 | Denis Smirnov 5 | DongYun Kang 6 | Dwayne Schultz 7 | Georg Apitz 8 | Gustav Paul 9 | Johan Brandhorst 10 | John Shahid 11 | John Tuley 12 | Laurent 13 | Patrick Lee 14 | Peter Edge 15 | Roger Johansson 16 | Sam Nguyen 17 | Sergio Arbeo 18 | Stephen J Day 19 | Tamir Duberstein 20 | Todd Eisenberger 21 | Tormod Erevik Lea 22 | Vyacheslav Kim 23 | Walter Schulze 24 | -------------------------------------------------------------------------------- /vendor/github.com/twitchtv/twirp/Gopkg.toml: -------------------------------------------------------------------------------- 1 | # The importable parts of Twirp have no external dependencies. They just use the 2 | # standard library. But both protoc-gen-twirp and Twirp's tests *do* have some 3 | # dependencies, and this manifest lists them. 4 | # 5 | # All dependencies are specified as overrides, not constraints, so that dep 6 | # doesn't get confused if someone imports Twirp. We don't want to falsely 7 | # require any particular versions of these libraries - they are *only* for 8 | # tests and building main packages. 9 | 10 | [[override]] 11 | name = "github.com/gogo/protobuf" 12 | version = "0.5.0" 13 | 14 | [[override]] 15 | branch = "master" 16 | name = "github.com/golang/protobuf" 17 | 18 | [[override]] 19 | name = "github.com/pkg/errors" 20 | version = "0.8.0" 21 | 22 | [[override]] 23 | name = "github.com/stretchr/testify" 24 | version = "1.2.0" 25 | 26 | [prune] 27 | unused-packages = true 28 | go-tests = true 29 | non-go = true 30 | -------------------------------------------------------------------------------- /pkg/postgres/postgres.go: -------------------------------------------------------------------------------- 1 | package pgsql 2 | 3 | import ( 4 | "log" 5 | "time" 6 | 7 | "github.com/go-pg/pg" 8 | ) 9 | 10 | // New creates new database connection to a postgres database 11 | // Function panics if it can't connect to database 12 | func New(psn string, logQueries bool, timeout int) (*pg.DB, error) { 13 | u, err := pg.ParseURL(psn) 14 | if err != nil { 15 | return nil, err 16 | } 17 | 18 | db := pg.Connect(u) 19 | 20 | _, err = db.Exec("SELECT 1") 21 | if err != nil { 22 | return nil, err 23 | } 24 | 25 | if timeout > 0 { 26 | db.WithTimeout(time.Second * time.Duration(timeout)) 27 | } 28 | 29 | if logQueries { 30 | db.OnQueryProcessed(func(event *pg.QueryProcessedEvent) { 31 | query, err := event.FormattedQuery() 32 | checkErr(err) 33 | log.Printf("%s | %s", time.Since(event.StartTime), query) 34 | }) 35 | } 36 | 37 | return db, nil 38 | } 39 | 40 | func checkErr(err error) { 41 | if err != nil { 42 | log.Fatal(err) 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /vendor/github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/httprule/BUILD.bazel: -------------------------------------------------------------------------------- 1 | load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test") 2 | 3 | package(default_visibility = ["//:generators"]) 4 | 5 | go_library( 6 | name = "go_default_library", 7 | srcs = [ 8 | "compile.go", 9 | "parse.go", 10 | "types.go", 11 | ], 12 | importpath = "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/httprule", 13 | deps = [ 14 | "//utilities:go_default_library", 15 | "@com_github_golang_glog//:go_default_library", 16 | ], 17 | ) 18 | 19 | go_test( 20 | name = "go_default_test", 21 | size = "small", 22 | srcs = [ 23 | "compile_test.go", 24 | "parse_test.go", 25 | "types_test.go", 26 | ], 27 | embed = [":go_default_library"], 28 | deps = [ 29 | "//utilities:go_default_library", 30 | "@com_github_golang_glog//:go_default_library", 31 | ], 32 | ) 33 | -------------------------------------------------------------------------------- /model/role.go: -------------------------------------------------------------------------------- 1 | package twisk 2 | 3 | import "context" 4 | 5 | // AccessRole represents access role type 6 | type AccessRole int8 7 | 8 | const ( 9 | // SuperAdminRole has all permissions 10 | SuperAdminRole AccessRole = iota + 1 11 | 12 | // AdminRole has admin specific permissions 13 | AdminRole 14 | 15 | // TenantAdminRole can edit tenant specific things 16 | TenantAdminRole 17 | 18 | // UserRole is a standard user 19 | UserRole 20 | ) 21 | 22 | // RBACService represents role-based access control service interface 23 | type RBACService interface { 24 | EnforceRole(context.Context, AccessRole) bool 25 | EnforceUser(context.Context, int64) bool 26 | EnforceTenant(context.Context, int32) bool 27 | EnforceTenantAdmin(context.Context, int32) bool 28 | EnforceTenantAndRole(context.Context, AccessRole, int32) bool 29 | IsLowerRole(context.Context, AccessRole) bool 30 | } 31 | 32 | // Role entity 33 | type Role struct { 34 | ID int `json:"id"` 35 | Name string `json:"name"` 36 | } 37 | -------------------------------------------------------------------------------- /vendor/golang.org/x/crypto/bcrypt/base64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2011 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package bcrypt 6 | 7 | import "encoding/base64" 8 | 9 | const alphabet = "./ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789" 10 | 11 | var bcEncoding = base64.NewEncoding(alphabet) 12 | 13 | func base64Encode(src []byte) []byte { 14 | n := bcEncoding.EncodedLen(len(src)) 15 | dst := make([]byte, n) 16 | bcEncoding.Encode(dst, src) 17 | for dst[n-1] == '=' { 18 | n-- 19 | } 20 | return dst[:n] 21 | } 22 | 23 | func base64Decode(src []byte) ([]byte, error) { 24 | numOfEquals := 4 - (len(src) % 4) 25 | for i := 0; i < numOfEquals; i++ { 26 | src = append(src, '=') 27 | } 28 | 29 | dst := make([]byte, bcEncoding.DecodedLen(len(src))) 30 | n, err := bcEncoding.Decode(dst, src) 31 | if err != nil { 32 | return nil, err 33 | } 34 | return dst[:n], nil 35 | } 36 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/dev_netbsd.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // Functions to access/create device major and minor numbers matching the 6 | // encoding used in NetBSD's sys/types.h header. 7 | 8 | package unix 9 | 10 | // Major returns the major component of a NetBSD device number. 11 | func Major(dev uint64) uint32 { 12 | return uint32((dev & 0x000fff00) >> 8) 13 | } 14 | 15 | // Minor returns the minor component of a NetBSD device number. 16 | func Minor(dev uint64) uint32 { 17 | minor := uint32((dev & 0x000000ff) >> 0) 18 | minor |= uint32((dev & 0xfff00000) >> 12) 19 | return minor 20 | } 21 | 22 | // Mkdev returns a NetBSD device number generated from the given major and minor 23 | // components. 24 | func Mkdev(major, minor uint32) uint64 { 25 | dev := (uint64(major) << 8) & 0x000fff00 26 | dev |= (uint64(minor) << 12) & 0xfff00000 27 | dev |= (uint64(minor) << 0) & 0x000000ff 28 | return dev 29 | } 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/dev_openbsd.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // Functions to access/create device major and minor numbers matching the 6 | // encoding used in OpenBSD's sys/types.h header. 7 | 8 | package unix 9 | 10 | // Major returns the major component of an OpenBSD device number. 11 | func Major(dev uint64) uint32 { 12 | return uint32((dev & 0x0000ff00) >> 8) 13 | } 14 | 15 | // Minor returns the minor component of an OpenBSD device number. 16 | func Minor(dev uint64) uint32 { 17 | minor := uint32((dev & 0x000000ff) >> 0) 18 | minor |= uint32((dev & 0xffff0000) >> 8) 19 | return minor 20 | } 21 | 22 | // Mkdev returns an OpenBSD device number generated from the given major and minor 23 | // components. 24 | func Mkdev(major, minor uint32) uint64 { 25 | dev := (uint64(major) << 8) & 0x0000ff00 26 | dev |= (uint64(minor) << 8) & 0xffff0000 27 | dev |= (uint64(minor) << 0) & 0x000000ff 28 | return dev 29 | } 30 | -------------------------------------------------------------------------------- /vendor/github.com/go-pg/pg/types/in_op.go: -------------------------------------------------------------------------------- 1 | package types 2 | 3 | import ( 4 | "reflect" 5 | ) 6 | 7 | type inOp struct { 8 | slice reflect.Value 9 | } 10 | 11 | var _ ValueAppender = (*inOp)(nil) 12 | 13 | func In(values ...interface{}) ValueAppender { 14 | return &inOp{ 15 | slice: reflect.ValueOf(values), 16 | } 17 | } 18 | 19 | func InSlice(slice interface{}) ValueAppender { 20 | return &inOp{ 21 | slice: reflect.ValueOf(slice), 22 | } 23 | } 24 | 25 | func (in *inOp) AppendValue(b []byte, quote int) []byte { 26 | return appendIn(b, in.slice, quote) 27 | } 28 | 29 | func appendIn(b []byte, slice reflect.Value, quote int) []byte { 30 | for i := 0; i < slice.Len(); i++ { 31 | if i > 0 { 32 | b = append(b, ',') 33 | } 34 | 35 | elem := slice.Index(i) 36 | if elem.Kind() == reflect.Interface { 37 | elem = elem.Elem() 38 | } 39 | 40 | if elem.Kind() == reflect.Slice { 41 | b = append(b, '(') 42 | b = appendIn(b, elem, quote) 43 | b = append(b, ')') 44 | } else { 45 | b = appendValue(b, elem, quote) 46 | } 47 | } 48 | return b 49 | } 50 | -------------------------------------------------------------------------------- /vendor/github.com/go-pg/pg/internal/pool/pool_single.go: -------------------------------------------------------------------------------- 1 | package pool 2 | 3 | type SingleConnPool struct { 4 | cn *Conn 5 | } 6 | 7 | var _ Pooler = (*SingleConnPool)(nil) 8 | 9 | func NewSingleConnPool(cn *Conn) *SingleConnPool { 10 | return &SingleConnPool{ 11 | cn: cn, 12 | } 13 | } 14 | 15 | func (p *SingleConnPool) NewConn() (*Conn, error) { 16 | panic("not implemented") 17 | } 18 | 19 | func (p *SingleConnPool) CloseConn(*Conn) error { 20 | panic("not implemented") 21 | } 22 | 23 | func (p *SingleConnPool) Get() (*Conn, error) { 24 | return p.cn, nil 25 | } 26 | 27 | func (p *SingleConnPool) Put(cn *Conn) { 28 | if p.cn != cn { 29 | panic("p.cn != cn") 30 | } 31 | } 32 | 33 | func (p *SingleConnPool) Remove(cn *Conn) { 34 | if p.cn != cn { 35 | panic("p.cn != cn") 36 | } 37 | } 38 | 39 | func (p *SingleConnPool) Len() int { 40 | return 1 41 | } 42 | 43 | func (p *SingleConnPool) IdleLen() int { 44 | return 0 45 | } 46 | 47 | func (p *SingleConnPool) Stats() *Stats { 48 | return nil 49 | } 50 | 51 | func (p *SingleConnPool) Close() error { 52 | return nil 53 | } 54 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/openbsd_pledge.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 openbsd 6 | // +build 386 amd64 arm 7 | 8 | package unix 9 | 10 | import ( 11 | "syscall" 12 | "unsafe" 13 | ) 14 | 15 | const ( 16 | _SYS_PLEDGE = 108 17 | ) 18 | 19 | // Pledge implements the pledge syscall. For more information see pledge(2). 20 | func Pledge(promises string, paths []string) error { 21 | promisesPtr, err := syscall.BytePtrFromString(promises) 22 | if err != nil { 23 | return err 24 | } 25 | promisesUnsafe, pathsUnsafe := unsafe.Pointer(promisesPtr), unsafe.Pointer(nil) 26 | if paths != nil { 27 | var pathsPtr []*byte 28 | if pathsPtr, err = syscall.SlicePtrFromStrings(paths); err != nil { 29 | return err 30 | } 31 | pathsUnsafe = unsafe.Pointer(&pathsPtr[0]) 32 | } 33 | _, _, e := syscall.Syscall(_SYS_PLEDGE, uintptr(promisesUnsafe), uintptr(pathsUnsafe), 0) 34 | if e != 0 { 35 | return e 36 | } 37 | return nil 38 | } 39 | -------------------------------------------------------------------------------- /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/twitchtv/twirp/internal/contextkeys/keys.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 Twitch Interactive, Inc. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"). You may not 4 | // use this file except in compliance with the License. A copy of the License is 5 | // located at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // or in the "license" file accompanying this file. This file is distributed on 10 | // an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 11 | // express or implied. See the License for the specific language governing 12 | // permissions and limitations under the License. 13 | 14 | // Package contextkeys stores the keys to the context accessor 15 | // functions, letting generated code safely set values in contexts 16 | // without exposing the setters to the outside world. 17 | package contextkeys 18 | 19 | type contextKey int 20 | 21 | const ( 22 | MethodNameKey contextKey = 1 + iota 23 | ServiceNameKey 24 | PackageNameKey 25 | StatusCodeKey 26 | RequestHeaderKey 27 | ResponseWriterKey 28 | ) 29 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/ioctl.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build darwin dragonfly freebsd linux netbsd openbsd solaris 6 | 7 | package unix 8 | 9 | import "runtime" 10 | 11 | // IoctlSetWinsize performs an ioctl on fd with a *Winsize argument. 12 | // 13 | // To change fd's window size, the req argument should be TIOCSWINSZ. 14 | func IoctlSetWinsize(fd int, req uint, value *Winsize) error { 15 | // TODO: if we get the chance, remove the req parameter and 16 | // hardcode TIOCSWINSZ. 17 | err := ioctlSetWinsize(fd, req, value) 18 | runtime.KeepAlive(value) 19 | return err 20 | } 21 | 22 | // IoctlSetTermios performs an ioctl on fd with a *Termios. 23 | // 24 | // The req value will usually be TCSETA or TIOCSETA. 25 | func IoctlSetTermios(fd int, req uint, value *Termios) error { 26 | // TODO: if we get the chance, remove the req parameter. 27 | err := ioctlSetTermios(fd, req, value) 28 | runtime.KeepAlive(value) 29 | return err 30 | } 31 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_openbsd_amd64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build amd64,openbsd 6 | 7 | package unix 8 | 9 | func setTimespec(sec, nsec int64) Timespec { 10 | return Timespec{Sec: sec, Nsec: nsec} 11 | } 12 | 13 | func setTimeval(sec, usec int64) Timeval { 14 | return Timeval{Sec: sec, Usec: usec} 15 | } 16 | 17 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 18 | k.Ident = uint64(fd) 19 | k.Filter = int16(mode) 20 | k.Flags = uint16(flags) 21 | } 22 | 23 | func (iov *Iovec) SetLen(length int) { 24 | iov.Len = uint64(length) 25 | } 26 | 27 | func (msghdr *Msghdr) SetControllen(length int) { 28 | msghdr.Controllen = uint32(length) 29 | } 30 | 31 | func (cmsg *Cmsghdr) SetLen(length int) { 32 | cmsg.Len = uint32(length) 33 | } 34 | 35 | // SYS___SYSCTL is used by syscall_bsd.go for all BSDs, but in modern versions 36 | // of openbsd/amd64 the syscall is called sysctl instead of __sysctl. 37 | const SYS___SYSCTL = SYS_SYSCTL 38 | -------------------------------------------------------------------------------- /vendor/github.com/go-pg/pg/orm/drop_table.go: -------------------------------------------------------------------------------- 1 | package orm 2 | 3 | import "errors" 4 | 5 | type DropTableOptions struct { 6 | IfExists bool 7 | Cascade bool 8 | } 9 | 10 | func DropTable(db DB, model interface{}, opt *DropTableOptions) (Result, error) { 11 | q := NewQuery(db, model) 12 | 13 | return q.db.Exec(dropTableQuery{ 14 | q: q, 15 | opt: opt, 16 | }) 17 | } 18 | 19 | type dropTableQuery struct { 20 | q *Query 21 | opt *DropTableOptions 22 | } 23 | 24 | func (q dropTableQuery) Copy() QueryAppender { 25 | return q 26 | } 27 | 28 | func (q dropTableQuery) Query() *Query { 29 | return q.q 30 | } 31 | 32 | func (q dropTableQuery) AppendQuery(b []byte) ([]byte, error) { 33 | if q.q.stickyErr != nil { 34 | return nil, q.q.stickyErr 35 | } 36 | if q.q.model == nil { 37 | return nil, errors.New("pg: Model(nil)") 38 | } 39 | 40 | b = append(b, "DROP TABLE "...) 41 | if q.opt != nil && q.opt.IfExists { 42 | b = append(b, "IF EXISTS "...) 43 | } 44 | b = q.q.appendTableName(b) 45 | if q.opt != nil && q.opt.Cascade { 46 | b = append(b, " CASCADE"...) 47 | } 48 | 49 | return b, nil 50 | } 51 | -------------------------------------------------------------------------------- /vendor/github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger/BUILD.bazel: -------------------------------------------------------------------------------- 1 | load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library", "go_test") 2 | 3 | package(default_visibility = ["//visibility:private"]) 4 | 5 | go_library( 6 | name = "go_default_library", 7 | srcs = ["main.go"], 8 | importpath = "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger", 9 | deps = [ 10 | "//codegenerator:go_default_library", 11 | "//protoc-gen-grpc-gateway/descriptor:go_default_library", 12 | "//protoc-gen-swagger/genswagger:go_default_library", 13 | "@com_github_golang_glog//:go_default_library", 14 | "@com_github_golang_protobuf//proto:go_default_library", 15 | "@com_github_golang_protobuf//protoc-gen-go/plugin:go_default_library", 16 | ], 17 | ) 18 | 19 | go_binary( 20 | name = "protoc-gen-swagger", 21 | embed = [":go_default_library"], 22 | visibility = ["//visibility:public"], 23 | ) 24 | 25 | go_test( 26 | name = "go_default_test", 27 | size = "small", 28 | srcs = ["main_test.go"], 29 | embed = [":go_default_library"], 30 | ) 31 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Emir Ribić 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. -------------------------------------------------------------------------------- /pkg/zerolog/zerolog.go: -------------------------------------------------------------------------------- 1 | package zerolog 2 | 3 | import ( 4 | "context" 5 | "os" 6 | 7 | "github.com/ribice/twisk/model" 8 | 9 | pkgctx "github.com/ribice/twisk/pkg/context" 10 | 11 | "github.com/rs/zerolog" 12 | ) 13 | 14 | // ZLog represents zerolog logger 15 | type ZLog struct { 16 | logger *zerolog.Logger 17 | } 18 | 19 | // New instantiates new zero logger 20 | func New() *ZLog { 21 | z := zerolog.New(os.Stdout) 22 | return &ZLog{ 23 | logger: &z, 24 | } 25 | } 26 | 27 | // Log logs using zerolog 28 | func (z *ZLog) Log(ctx context.Context, source, msg string, err error, params map[string]interface{}) { 29 | 30 | if params == nil { 31 | params = make(map[string]interface{}) 32 | } 33 | 34 | params["source"] = source 35 | 36 | if user, ok := ctx.Value(pkgctx.KeyString("_authuser")).(*twisk.AuthUser); ok { 37 | params["id"] = user.ID 38 | params["username"] = user.Username 39 | params["tenant_id"] = user.TenantID 40 | } 41 | 42 | if err != nil { 43 | params["error"] = err 44 | z.logger.Error().Fields(params).Msg(msg) 45 | return 46 | } 47 | 48 | z.logger.Info().Fields(params).Msg(msg) 49 | 50 | } 51 | -------------------------------------------------------------------------------- /vendor/github.com/go-pg/pg/types/array.go: -------------------------------------------------------------------------------- 1 | package types 2 | 3 | import ( 4 | "database/sql" 5 | "fmt" 6 | "reflect" 7 | ) 8 | 9 | type Array struct { 10 | v reflect.Value 11 | 12 | append AppenderFunc 13 | scan ScannerFunc 14 | } 15 | 16 | var _ ValueAppender = (*Array)(nil) 17 | var _ sql.Scanner = (*Array)(nil) 18 | 19 | func NewArray(vi interface{}) *Array { 20 | v := reflect.ValueOf(vi) 21 | if !v.IsValid() { 22 | panic(fmt.Errorf("pg.Array(nil)")) 23 | } 24 | v = reflect.Indirect(v) 25 | if v.Kind() != reflect.Slice { 26 | panic(fmt.Errorf("pg.Array(unsupported %s)", v.Type())) 27 | } 28 | return &Array{ 29 | v: v, 30 | 31 | append: ArrayAppender(v.Type()), 32 | scan: ArrayScanner(v.Type()), 33 | } 34 | } 35 | 36 | func (a *Array) Value() interface{} { 37 | if a.v.IsValid() { 38 | return a.v.Interface() 39 | } 40 | return nil 41 | } 42 | 43 | func (a *Array) AppendValue(b []byte, quote int) []byte { 44 | return a.append(b, a.v, quote) 45 | } 46 | 47 | func (a *Array) Scan(b interface{}) error { 48 | if b == nil { 49 | return a.scan(a.v, nil) 50 | } 51 | return a.scan(a.v, b.([]byte)) 52 | } 53 | -------------------------------------------------------------------------------- /vendor/github.com/go-pg/pg/types/hstore.go: -------------------------------------------------------------------------------- 1 | package types 2 | 3 | import ( 4 | "database/sql" 5 | "fmt" 6 | "reflect" 7 | ) 8 | 9 | type Hstore struct { 10 | v reflect.Value 11 | 12 | append AppenderFunc 13 | scan ScannerFunc 14 | } 15 | 16 | var _ ValueAppender = (*Hstore)(nil) 17 | var _ sql.Scanner = (*Hstore)(nil) 18 | 19 | func NewHstore(vi interface{}) *Hstore { 20 | v := reflect.ValueOf(vi) 21 | if !v.IsValid() { 22 | panic(fmt.Errorf("pg.Hstore(nil)")) 23 | } 24 | v = reflect.Indirect(v) 25 | if v.Kind() != reflect.Map { 26 | panic(fmt.Errorf("pg.Hstore(unsupported %s)", v.Type())) 27 | } 28 | return &Hstore{ 29 | v: v, 30 | 31 | append: HstoreAppender(v.Type()), 32 | scan: HstoreScanner(v.Type()), 33 | } 34 | } 35 | 36 | func (h *Hstore) Value() interface{} { 37 | if h.v.IsValid() { 38 | return h.v.Interface() 39 | } 40 | return nil 41 | } 42 | 43 | func (h *Hstore) AppendValue(b []byte, quote int) []byte { 44 | return h.append(b, h.v, quote) 45 | } 46 | 47 | func (h *Hstore) Scan(b interface{}) error { 48 | if b == nil { 49 | return h.scan(h.v, nil) 50 | } 51 | return h.scan(h.v, b.([]byte)) 52 | } 53 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/fcntl.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build darwin dragonfly freebsd linux netbsd openbsd 6 | 7 | package unix 8 | 9 | import "unsafe" 10 | 11 | // fcntl64Syscall is usually SYS_FCNTL, but is overridden on 32-bit Linux 12 | // systems by flock_linux_32bit.go to be SYS_FCNTL64. 13 | var fcntl64Syscall uintptr = SYS_FCNTL 14 | 15 | // FcntlInt performs a fcntl syscall on fd with the provided command and argument. 16 | func FcntlInt(fd uintptr, cmd, arg int) (int, error) { 17 | valptr, _, errno := Syscall(fcntl64Syscall, fd, uintptr(cmd), uintptr(arg)) 18 | var err error 19 | if errno != 0 { 20 | err = errno 21 | } 22 | return int(valptr), err 23 | } 24 | 25 | // FcntlFlock performs a fcntl syscall for the F_GETLK, F_SETLK or F_SETLKW command. 26 | func FcntlFlock(fd uintptr, cmd int, lk *Flock_t) error { 27 | _, _, errno := Syscall(fcntl64Syscall, fd, uintptr(cmd), uintptr(unsafe.Pointer(lk))) 28 | if errno == 0 { 29 | return nil 30 | } 31 | return errno 32 | } 33 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_linux_gccgo_386.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build linux,gccgo,386 6 | 7 | package unix 8 | 9 | import ( 10 | "syscall" 11 | "unsafe" 12 | ) 13 | 14 | func seek(fd int, offset int64, whence int) (int64, syscall.Errno) { 15 | var newoffset int64 16 | offsetLow := uint32(offset & 0xffffffff) 17 | offsetHigh := uint32((offset >> 32) & 0xffffffff) 18 | _, _, err := Syscall6(SYS__LLSEEK, uintptr(fd), uintptr(offsetHigh), uintptr(offsetLow), uintptr(unsafe.Pointer(&newoffset)), uintptr(whence), 0) 19 | return newoffset, err 20 | } 21 | 22 | func socketcall(call int, a0, a1, a2, a3, a4, a5 uintptr) (int, syscall.Errno) { 23 | fd, _, err := Syscall(SYS_SOCKETCALL, uintptr(call), uintptr(unsafe.Pointer(&a0)), 0) 24 | return int(fd), err 25 | } 26 | 27 | func rawsocketcall(call int, a0, a1, a2, a3, a4, a5 uintptr) (int, syscall.Errno) { 28 | fd, _, err := RawSyscall(SYS_SOCKETCALL, uintptr(call), uintptr(unsafe.Pointer(&a0)), 0) 29 | return int(fd), err 30 | } 31 | -------------------------------------------------------------------------------- /vendor/github.com/mwitkow/go-proto-validators/helper.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 Michal Witkowski. All Rights Reserved. 2 | // See LICENSE for licensing terms. 3 | 4 | package validator 5 | 6 | import "strings" 7 | 8 | // Validator is a general interface that allows a message to be validated. 9 | type Validator interface { 10 | Validate() error 11 | } 12 | 13 | func CallValidatorIfExists(candidate interface{}) error { 14 | if validator, ok := candidate.(Validator); ok { 15 | return validator.Validate() 16 | } 17 | return nil 18 | } 19 | 20 | type fieldError struct { 21 | fieldStack []string 22 | nestedErr error 23 | } 24 | 25 | func (f *fieldError) Error() string { 26 | return "invalid field " + strings.Join(f.fieldStack, ".") + ": " + f.nestedErr.Error() 27 | } 28 | 29 | // FieldError wraps a given Validator error providing a message call stack. 30 | func FieldError(fieldName string, err error) error { 31 | if fErr, ok := err.(*fieldError); ok { 32 | fErr.fieldStack = append([]string{fieldName}, fErr.fieldStack...) 33 | return err 34 | } 35 | return &fieldError{ 36 | fieldStack: []string{fieldName}, 37 | nestedErr: err, 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /vendor/github.com/nbutton23/zxcvbn-go/LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) Nathan Button 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the 5 | "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /vendor/github.com/rs/xid/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2015 Olivier Poitrey 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is furnished 8 | to do so, subject to the following 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 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/dev_freebsd.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // Functions to access/create device major and minor numbers matching the 6 | // encoding used in FreeBSD's sys/types.h header. 7 | // 8 | // The information below is extracted and adapted from sys/types.h: 9 | // 10 | // Minor gives a cookie instead of an index since in order to avoid changing the 11 | // meanings of bits 0-15 or wasting time and space shifting bits 16-31 for 12 | // devices that don't use them. 13 | 14 | package unix 15 | 16 | // Major returns the major component of a FreeBSD device number. 17 | func Major(dev uint64) uint32 { 18 | return uint32((dev >> 8) & 0xff) 19 | } 20 | 21 | // Minor returns the minor component of a FreeBSD device number. 22 | func Minor(dev uint64) uint32 { 23 | return uint32(dev & 0xffff00ff) 24 | } 25 | 26 | // Mkdev returns a FreeBSD device number generated from the given major and 27 | // minor components. 28 | func Mkdev(major, minor uint32) uint64 { 29 | return (uint64(major) << 8) | uint64(minor) 30 | } 31 | -------------------------------------------------------------------------------- /vendor/github.com/rs/zerolog/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Olivier Poitrey 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 | -------------------------------------------------------------------------------- /internal/iam/secure/secure.go: -------------------------------------------------------------------------------- 1 | package secure 2 | 3 | import ( 4 | zxcvbn "github.com/nbutton23/zxcvbn-go" 5 | "golang.org/x/crypto/bcrypt" 6 | ) 7 | 8 | // New creates new password service 9 | func New(minStr int) *Service { 10 | return &Service{minStr: minStr} 11 | } 12 | 13 | // Service contains password related methods 14 | type Service struct { 15 | minStr int 16 | appWords []string 17 | } 18 | 19 | // Password checks whether password is secure enough using zxcvbn library 20 | func (s *Service) Password(pw string, inputs ...string) bool { 21 | inputs = append(inputs, s.appWords...) 22 | pwStrength := zxcvbn.PasswordStrength(pw, inputs) 23 | return !(pwStrength.Score < s.minStr) 24 | } 25 | 26 | // Hash hashes the password using bcrypt 27 | func (s *Service) Hash(password string) string { 28 | hashedPW, _ := bcrypt.GenerateFromPassword([]byte(password), bcrypt.DefaultCost) 29 | return string(hashedPW) 30 | } 31 | 32 | // MatchesHash checks whether hash matches with password. Returns true if hash and password match. 33 | func (s *Service) MatchesHash(hash, password string) bool { 34 | return bcrypt.CompareHashAndPassword([]byte(hash), []byte(password)) == nil 35 | } 36 | -------------------------------------------------------------------------------- /vendor/github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger/options/BUILD.bazel: -------------------------------------------------------------------------------- 1 | load("@io_bazel_rules_go//go:def.bzl", "go_library") 2 | load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library") 3 | 4 | package(default_visibility = ["//visibility:public"]) 5 | 6 | proto_library( 7 | name = "options_proto", 8 | srcs = [ 9 | "annotations.proto", 10 | "openapiv2.proto", 11 | ], 12 | deps = [ 13 | "@com_google_protobuf//:any_proto", 14 | "@com_google_protobuf//:descriptor_proto", 15 | ], 16 | ) 17 | 18 | go_proto_library( 19 | name = "options_go_proto", 20 | compilers = ["@io_bazel_rules_go//proto:go_grpc"], 21 | importpath = "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger/options", 22 | proto = ":options_proto", 23 | deps = [ 24 | "@com_github_golang_protobuf//protoc-gen-go/descriptor:go_default_library", 25 | "@com_github_golang_protobuf//ptypes/any:go_default_library", 26 | ], 27 | ) 28 | 29 | go_library( 30 | name = "go_default_library", 31 | embed = [":options_go_proto"], 32 | importpath = "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger/options", 33 | ) 34 | -------------------------------------------------------------------------------- /vendor/github.com/jinzhu/inflection/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 - Jinzhu 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/golang.org/x/sys/unix/dev_dragonfly.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // Functions to access/create device major and minor numbers matching the 6 | // encoding used in Dragonfly's sys/types.h header. 7 | // 8 | // The information below is extracted and adapted from sys/types.h: 9 | // 10 | // Minor gives a cookie instead of an index since in order to avoid changing the 11 | // meanings of bits 0-15 or wasting time and space shifting bits 16-31 for 12 | // devices that don't use them. 13 | 14 | package unix 15 | 16 | // Major returns the major component of a DragonFlyBSD device number. 17 | func Major(dev uint64) uint32 { 18 | return uint32((dev >> 8) & 0xff) 19 | } 20 | 21 | // Minor returns the minor component of a DragonFlyBSD device number. 22 | func Minor(dev uint64) uint32 { 23 | return uint32(dev & 0xffff00ff) 24 | } 25 | 26 | // Mkdev returns a DragonFlyBSD device number generated from the given major and 27 | // minor components. 28 | func Mkdev(major, minor uint32) uint64 { 29 | return (uint64(major) << 8) | uint64(minor) 30 | } 31 | -------------------------------------------------------------------------------- /vendor/github.com/justinas/alice/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Justinas Stankevicius 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | this software and associated documentation files (the "Software"), to deal in 7 | the Software without restriction, including without limitation the rights to 8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | the Software, and to permit persons to whom the Software is furnished to do so, 10 | subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /vendor/github.com/go-pg/pg/types/append_field.go: -------------------------------------------------------------------------------- 1 | package types 2 | 3 | import "github.com/go-pg/pg/internal/parser" 4 | 5 | func AppendField(b []byte, field string, quote int) []byte { 6 | return appendField(b, parser.NewString(field), quote) 7 | } 8 | 9 | func AppendFieldBytes(b []byte, field []byte, quote int) []byte { 10 | return appendField(b, parser.New(field), quote) 11 | } 12 | 13 | func appendField(b []byte, p *parser.Parser, quote int) []byte { 14 | var quoted bool 15 | for p.Valid() { 16 | c := p.Read() 17 | switch c { 18 | case '*': 19 | if !quoted { 20 | b = append(b, '*') 21 | continue 22 | } 23 | case '.': 24 | if quoted && quote == 1 { 25 | b = append(b, '"') 26 | quoted = false 27 | } 28 | b = append(b, '.') 29 | if p.Skip('*') { 30 | b = append(b, '*') 31 | } else if quote == 1 { 32 | b = append(b, '"') 33 | quoted = true 34 | } 35 | continue 36 | } 37 | 38 | if !quoted && quote == 1 { 39 | b = append(b, '"') 40 | quoted = true 41 | } 42 | if c == '"' { 43 | b = append(b, '"', '"') 44 | } else { 45 | b = append(b, c) 46 | } 47 | } 48 | if quoted && quote == 1 { 49 | b = append(b, '"') 50 | } 51 | return b 52 | } 53 | -------------------------------------------------------------------------------- /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 | uintptr_t 35 | gccgoRealSyscallNoError(uintptr_t trap, uintptr_t a1, uintptr_t a2, uintptr_t a3, uintptr_t a4, uintptr_t a5, uintptr_t a6, uintptr_t a7, uintptr_t a8, uintptr_t a9) 36 | { 37 | return syscall(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9); 38 | } 39 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/sockcmsg_linux.go: -------------------------------------------------------------------------------- 1 | // Copyright 2011 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // Socket control messages 6 | 7 | package unix 8 | 9 | import "unsafe" 10 | 11 | // UnixCredentials encodes credentials into a socket control message 12 | // for sending to another process. This can be used for 13 | // authentication. 14 | func UnixCredentials(ucred *Ucred) []byte { 15 | b := make([]byte, CmsgSpace(SizeofUcred)) 16 | h := (*Cmsghdr)(unsafe.Pointer(&b[0])) 17 | h.Level = SOL_SOCKET 18 | h.Type = SCM_CREDENTIALS 19 | h.SetLen(CmsgLen(SizeofUcred)) 20 | *((*Ucred)(cmsgData(h))) = *ucred 21 | return b 22 | } 23 | 24 | // ParseUnixCredentials decodes a socket control message that contains 25 | // credentials in a Ucred structure. To receive such a message, the 26 | // SO_PASSCRED option must be enabled on the socket. 27 | func ParseUnixCredentials(m *SocketControlMessage) (*Ucred, error) { 28 | if m.Header.Level != SOL_SOCKET { 29 | return nil, EINVAL 30 | } 31 | if m.Header.Type != SCM_CREDENTIALS { 32 | return nil, EINVAL 33 | } 34 | ucred := *(*Ucred)(unsafe.Pointer(&m.Data[0])) 35 | return &ucred, nil 36 | } 37 | -------------------------------------------------------------------------------- /vendor/github.com/rs/xid/hostid_windows.go: -------------------------------------------------------------------------------- 1 | // +build windows 2 | 3 | package xid 4 | 5 | import ( 6 | "fmt" 7 | "unsafe" 8 | 9 | "golang.org/x/sys/windows" 10 | ) 11 | 12 | func readPlatformMachineID() (string, error) { 13 | // source: https://github.com/shirou/gopsutil/blob/master/host/host_windows.go 14 | var h windows.Handle 15 | err := windows.RegOpenKeyEx(windows.HKEY_LOCAL_MACHINE, windows.StringToUTF16Ptr(`SOFTWARE\Microsoft\Cryptography`), 0, windows.KEY_READ|windows.KEY_WOW64_64KEY, &h) 16 | if err != nil { 17 | return "", err 18 | } 19 | defer windows.RegCloseKey(h) 20 | 21 | const windowsRegBufLen = 74 // len(`{`) + len(`abcdefgh-1234-456789012-123345456671` * 2) + len(`}`) // 2 == bytes/UTF16 22 | const uuidLen = 36 23 | 24 | var regBuf [windowsRegBufLen]uint16 25 | bufLen := uint32(windowsRegBufLen) 26 | var valType uint32 27 | err = windows.RegQueryValueEx(h, windows.StringToUTF16Ptr(`MachineGuid`), nil, &valType, (*byte)(unsafe.Pointer(®Buf[0])), &bufLen) 28 | if err != nil { 29 | return "", err 30 | } 31 | 32 | hostID := windows.UTF16ToString(regBuf[:]) 33 | hostIDLen := len(hostID) 34 | if hostIDLen != uuidLen { 35 | return "", fmt.Errorf("HostID incorrect: %q\n", hostID) 36 | } 37 | 38 | return hostID, nil 39 | } 40 | -------------------------------------------------------------------------------- /vendor/github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/httprule/types.go: -------------------------------------------------------------------------------- 1 | package httprule 2 | 3 | import ( 4 | "fmt" 5 | "strings" 6 | ) 7 | 8 | type template struct { 9 | segments []segment 10 | verb string 11 | template string 12 | } 13 | 14 | type segment interface { 15 | fmt.Stringer 16 | compile() (ops []op) 17 | } 18 | 19 | type wildcard struct{} 20 | 21 | type deepWildcard struct{} 22 | 23 | type literal string 24 | 25 | type variable struct { 26 | path string 27 | segments []segment 28 | } 29 | 30 | func (wildcard) String() string { 31 | return "*" 32 | } 33 | 34 | func (deepWildcard) String() string { 35 | return "**" 36 | } 37 | 38 | func (l literal) String() string { 39 | return string(l) 40 | } 41 | 42 | func (v variable) String() string { 43 | var segs []string 44 | for _, s := range v.segments { 45 | segs = append(segs, s.String()) 46 | } 47 | return fmt.Sprintf("{%s=%s}", v.path, strings.Join(segs, "/")) 48 | } 49 | 50 | func (t template) String() string { 51 | var segs []string 52 | for _, s := range t.segments { 53 | segs = append(segs, s.String()) 54 | } 55 | str := strings.Join(segs, "/") 56 | if t.verb != "" { 57 | str = fmt.Sprintf("%s:%s", str, t.verb) 58 | } 59 | return "/" + str 60 | } 61 | -------------------------------------------------------------------------------- /vendor/github.com/stretchr/testify/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2012 - 2013 Mat Ryer and Tyler Bunnell 2 | 3 | Please consider promoting this project if you find it useful. 4 | 5 | Permission is hereby granted, free of charge, to any person 6 | obtaining a copy of this software and associated documentation 7 | files (the "Software"), to deal in the Software without restriction, 8 | including without limitation the rights to use, copy, modify, merge, 9 | publish, distribute, sublicense, and/or sell copies of the Software, 10 | 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 14 | in all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 20 | DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT 21 | OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE 22 | OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | -------------------------------------------------------------------------------- /vendor/github.com/go-pg/pg/types/append_hstore.go: -------------------------------------------------------------------------------- 1 | package types 2 | 3 | import ( 4 | "fmt" 5 | "reflect" 6 | ) 7 | 8 | var mapStringStringType = reflect.TypeOf(map[string]string(nil)) 9 | 10 | func HstoreAppender(typ reflect.Type) AppenderFunc { 11 | if typ.Key() == stringType && typ.Elem() == stringType { 12 | return appendMapStringStringValue 13 | } 14 | return func(b []byte, v reflect.Value, quote int) []byte { 15 | err := fmt.Errorf("pg.Hstore(unsupported %s)", v.Type()) 16 | return AppendError(b, err) 17 | } 18 | } 19 | 20 | func appendMapStringString(b []byte, m map[string]string, quote int) []byte { 21 | if m == nil { 22 | return AppendNull(b, quote) 23 | } 24 | 25 | if quote == 1 { 26 | b = append(b, '\'') 27 | } 28 | 29 | for key, value := range m { 30 | b = AppendString(b, key, 2) 31 | b = append(b, '=', '>') 32 | b = AppendString(b, value, 2) 33 | b = append(b, ',') 34 | } 35 | if len(m) > 0 { 36 | b = b[:len(b)-1] // Strip trailing comma. 37 | } 38 | 39 | if quote == 1 { 40 | b = append(b, '\'') 41 | } 42 | 43 | return b 44 | } 45 | 46 | func appendMapStringStringValue(b []byte, v reflect.Value, quote int) []byte { 47 | m := v.Convert(mapStringStringType).Interface().(map[string]string) 48 | return appendMapStringString(b, m, quote) 49 | } 50 | -------------------------------------------------------------------------------- /Gopkg.toml: -------------------------------------------------------------------------------- 1 | # Gopkg.toml example 2 | # 3 | # Refer to https://github.com/golang/dep/blob/master/docs/Gopkg.toml.md 4 | # for detailed Gopkg.toml documentation. 5 | # 6 | # required = ["github.com/user/thing/cmd/thing"] 7 | # ignored = ["github.com/user/project/pkgX", "bitbucket.org/user/project/pkgA/pkgY"] 8 | # 9 | # [[constraint]] 10 | # name = "github.com/user/project" 11 | # version = "1.0.0" 12 | # 13 | # [[constraint]] 14 | # name = "github.com/user/project2" 15 | # branch = "dev" 16 | # source = "github.com/myfork/project2" 17 | # 18 | # [[override]] 19 | # name = "github.com/x/y" 20 | # version = "2.4.0" 21 | # 22 | # [prune] 23 | # non-go = false 24 | # go-tests = true 25 | # unused-packages = true 26 | 27 | required = [ 28 | "github.com/gogo/protobuf/protoc-gen-gogo", 29 | "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway", 30 | "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger", 31 | "github.com/mwitkow/go-proto-validators/protoc-gen-govalidators", 32 | "github.com/rakyll/statik", 33 | ] 34 | 35 | [[constraint]] 36 | name = "github.com/golang/protobuf" 37 | version = "1.1.0" 38 | 39 | [[constraint]] 40 | name = "github.com/twitchtv/twirp" 41 | version = "5.4.1" 42 | 43 | [prune] 44 | go-tests = true 45 | unused-packages = true 46 | -------------------------------------------------------------------------------- /vendor/github.com/go-pg/pg/internal/error.go: -------------------------------------------------------------------------------- 1 | package internal 2 | 3 | import ( 4 | "fmt" 5 | ) 6 | 7 | var ErrNoRows = Errorf("pg: no rows in result set") 8 | var ErrMultiRows = Errorf("pg: multiple rows in result set") 9 | 10 | type Error struct { 11 | s string 12 | } 13 | 14 | func Errorf(s string, args ...interface{}) Error { 15 | return Error{s: fmt.Sprintf(s, args...)} 16 | } 17 | 18 | func (err Error) Error() string { 19 | return err.s 20 | } 21 | 22 | type PGError struct { 23 | m map[byte]string 24 | } 25 | 26 | func NewPGError(m map[byte]string) PGError { 27 | return PGError{ 28 | m: m, 29 | } 30 | } 31 | 32 | func (err PGError) Field(k byte) string { 33 | return err.m[k] 34 | } 35 | 36 | func (err PGError) IntegrityViolation() bool { 37 | switch err.Field('C') { 38 | case "23000", "23001", "23502", "23503", "23505", "23514", "23P01": 39 | return true 40 | default: 41 | return false 42 | } 43 | } 44 | 45 | func (err PGError) Error() string { 46 | return fmt.Sprintf( 47 | "%s #%s %s (addr=%q)", 48 | err.Field('S'), err.Field('C'), err.Field('M'), err.Field('a'), 49 | ) 50 | } 51 | 52 | func AssertOneRow(l int) error { 53 | switch { 54 | case l == 0: 55 | return ErrNoRows 56 | case l > 1: 57 | return ErrMultiRows 58 | default: 59 | return nil 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/mksysnum_dragonfly.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 DragonFly from master list 7 | # (for example, /usr/src/sys/kern/syscalls.master). 8 | 9 | use strict; 10 | 11 | if($ENV{'GOARCH'} eq "" || $ENV{'GOOS'} eq "") { 12 | print STDERR "GOARCH or GOOS not defined in environment\n"; 13 | exit 1; 14 | } 15 | 16 | my $command = "mksysnum_dragonfly.pl " . join(' ', @ARGV); 17 | 18 | print <){ 30 | if(/^([0-9]+)\s+STD\s+({ \S+\s+(\w+).*)$/){ 31 | my $num = $1; 32 | my $proto = $2; 33 | my $name = "SYS_$3"; 34 | $name =~ y/a-z/A-Z/; 35 | 36 | # There are multiple entries for enosys and nosys, so comment them out. 37 | if($name =~ /^SYS_E?NOSYS$/){ 38 | $name = "// $name"; 39 | } 40 | if($name eq 'SYS_SYS_EXIT'){ 41 | $name = 'SYS_EXIT'; 42 | } 43 | 44 | print " $name = $num; // $proto\n"; 45 | } 46 | } 47 | 48 | print <){ 30 | if(/^([0-9]+)\s+\S+\s+STD\s+({ \S+\s+(\w+).*)$/){ 31 | my $num = $1; 32 | my $proto = $2; 33 | my $name = "SYS_$3"; 34 | $name =~ y/a-z/A-Z/; 35 | 36 | # There are multiple entries for enosys and nosys, so comment them out. 37 | if($name =~ /^SYS_E?NOSYS$/){ 38 | $name = "// $name"; 39 | } 40 | if($name eq 'SYS_SYS_EXIT'){ 41 | $name = 'SYS_EXIT'; 42 | } 43 | 44 | print " $name = $num; // $proto\n"; 45 | } 46 | } 47 | 48 | print <){ 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 < reflect.Float64 && 22 | v.Kind() != reflect.String && 23 | v.Kind() != reflect.Struct && 24 | v.Kind() != reflect.Ptr && 25 | v.Kind() != reflect.Slice { 26 | continue 27 | } 28 | if v.Kind() == reflect.Ptr { 29 | // Field is pointer check if it's nil or set 30 | if !v.IsNil() { 31 | // Field is set assign it to dest 32 | 33 | if d.Elem().FieldByName(fieldName).Kind() == reflect.Ptr { 34 | d.Elem().FieldByName(fieldName).Set(v) 35 | continue 36 | } 37 | f := d.Elem().FieldByName(fieldName) 38 | if f.IsValid() { 39 | f.Set(v.Elem()) 40 | } 41 | } 42 | continue 43 | } 44 | d.Elem().FieldByName(fieldName).Set(v) 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /vendor/github.com/rs/zerolog/internal/cbor/base.go: -------------------------------------------------------------------------------- 1 | package cbor 2 | 3 | type Encoder struct{} 4 | 5 | // AppendKey adds a key (string) to the binary encoded log message 6 | func (e Encoder) AppendKey(dst []byte, key string) []byte { 7 | if len(dst) < 1 { 8 | dst = e.AppendBeginMarker(dst) 9 | } 10 | return e.AppendString(dst, key) 11 | } 12 | 13 | // AppendError adds the Error to the log message if error is NOT nil 14 | func (e Encoder) AppendError(dst []byte, err error) []byte { 15 | if err == nil { 16 | return append(dst, `null`...) 17 | } 18 | return e.AppendString(dst, err.Error()) 19 | } 20 | 21 | // AppendErrors when given an array of errors, 22 | // adds them to the log message if a specific error is nil, then 23 | // Nil is added, or else the error string is added. 24 | func (e Encoder) AppendErrors(dst []byte, errs []error) []byte { 25 | if len(errs) == 0 { 26 | return e.AppendArrayEnd(e.AppendArrayStart(dst)) 27 | } 28 | dst = e.AppendArrayStart(dst) 29 | if errs[0] != nil { 30 | dst = e.AppendString(dst, errs[0].Error()) 31 | } else { 32 | dst = e.AppendNil(dst) 33 | } 34 | if len(errs) > 1 { 35 | for _, err := range errs[1:] { 36 | if err == nil { 37 | dst = e.AppendNil(dst) 38 | continue 39 | } 40 | dst = e.AppendString(dst, err.Error()) 41 | } 42 | } 43 | dst = e.AppendArrayEnd(dst) 44 | return dst 45 | } 46 | -------------------------------------------------------------------------------- /vendor/github.com/rs/zerolog/internal/json/base.go: -------------------------------------------------------------------------------- 1 | package json 2 | 3 | type Encoder struct{} 4 | 5 | // AppendKey appends a new key to the output JSON. 6 | func (e Encoder) AppendKey(dst []byte, key string) []byte { 7 | if len(dst) > 1 && dst[len(dst)-1] != '{' { 8 | dst = append(dst, ',') 9 | } 10 | dst = e.AppendString(dst, key) 11 | return append(dst, ':') 12 | } 13 | 14 | // AppendError encodes the error string to json and appends 15 | // the encoded string to the input byte slice. 16 | func (e Encoder) AppendError(dst []byte, err error) []byte { 17 | if err == nil { 18 | return append(dst, `null`...) 19 | } 20 | return e.AppendString(dst, err.Error()) 21 | } 22 | 23 | // AppendErrors encodes the error strings to json and 24 | // appends the encoded string list to the input byte slice. 25 | func (e Encoder) AppendErrors(dst []byte, errs []error) []byte { 26 | if len(errs) == 0 { 27 | return append(dst, '[', ']') 28 | } 29 | dst = append(dst, '[') 30 | if errs[0] != nil { 31 | dst = e.AppendString(dst, errs[0].Error()) 32 | } else { 33 | dst = append(dst, "null"...) 34 | } 35 | if len(errs) > 1 { 36 | for _, err := range errs[1:] { 37 | if err == nil { 38 | dst = append(dst, ",null"...) 39 | continue 40 | } 41 | dst = e.AppendString(append(dst, ','), err.Error()) 42 | } 43 | } 44 | dst = append(dst, ']') 45 | return dst 46 | } 47 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_linux_arm64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build linux 6 | // +build arm64 7 | // +build !gccgo 8 | 9 | #include "textflag.h" 10 | 11 | // Just jump to package syscall's implementation for all these functions. 12 | // The runtime may know about them. 13 | 14 | TEXT ·Syscall(SB),NOSPLIT,$0-56 15 | B syscall·Syscall(SB) 16 | 17 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 18 | B syscall·Syscall6(SB) 19 | 20 | TEXT ·SyscallNoError(SB),NOSPLIT,$0-48 21 | BL runtime·entersyscall(SB) 22 | MOVD a1+8(FP), R0 23 | MOVD a2+16(FP), R1 24 | MOVD a3+24(FP), R2 25 | MOVD $0, R3 26 | MOVD $0, R4 27 | MOVD $0, R5 28 | MOVD trap+0(FP), R8 // syscall entry 29 | SVC 30 | MOVD R0, r1+32(FP) // r1 31 | MOVD R1, r2+40(FP) // r2 32 | BL runtime·exitsyscall(SB) 33 | RET 34 | 35 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 36 | B syscall·RawSyscall(SB) 37 | 38 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 39 | B syscall·RawSyscall6(SB) 40 | 41 | TEXT ·RawSyscallNoError(SB),NOSPLIT,$0-48 42 | MOVD a1+8(FP), R0 43 | MOVD a2+16(FP), R1 44 | MOVD a3+24(FP), R2 45 | MOVD $0, R3 46 | MOVD $0, R4 47 | MOVD $0, R5 48 | MOVD trap+0(FP), R8 // syscall entry 49 | SVC 50 | MOVD R0, r1+32(FP) 51 | MOVD R1, r2+40(FP) 52 | RET 53 | -------------------------------------------------------------------------------- /vendor/github.com/go-pg/pg/time.go: -------------------------------------------------------------------------------- 1 | package pg 2 | 3 | import ( 4 | "bytes" 5 | "database/sql" 6 | "encoding/json" 7 | "time" 8 | 9 | "github.com/go-pg/pg/types" 10 | ) 11 | 12 | var jsonNull = []byte("null") 13 | 14 | // NullTime is a time.Time wrapper that marshals zero time as JSON null and 15 | // PostgreSQL NULL. 16 | type NullTime struct { 17 | time.Time 18 | } 19 | 20 | var _ json.Marshaler = (*NullTime)(nil) 21 | var _ json.Unmarshaler = (*NullTime)(nil) 22 | var _ sql.Scanner = (*NullTime)(nil) 23 | var _ types.ValueAppender = (*NullTime)(nil) 24 | 25 | func (tm NullTime) MarshalJSON() ([]byte, error) { 26 | if tm.IsZero() { 27 | return jsonNull, nil 28 | } 29 | return tm.Time.MarshalJSON() 30 | } 31 | 32 | func (tm *NullTime) UnmarshalJSON(b []byte) error { 33 | if bytes.Equal(b, jsonNull) { 34 | tm.Time = time.Time{} 35 | return nil 36 | } 37 | return tm.Time.UnmarshalJSON(b) 38 | } 39 | 40 | func (tm NullTime) AppendValue(b []byte, quote int) []byte { 41 | if tm.IsZero() { 42 | return types.AppendNull(b, quote) 43 | } 44 | return types.AppendTime(b, tm.Time, quote) 45 | } 46 | 47 | func (tm *NullTime) Scan(b interface{}) error { 48 | if b == nil { 49 | tm.Time = time.Time{} 50 | return nil 51 | } 52 | newtm, err := types.ParseTime(b.([]byte)) 53 | if err != nil { 54 | return err 55 | } 56 | tm.Time = newtm 57 | return nil 58 | } 59 | -------------------------------------------------------------------------------- /internal/iam/platform/postgres/user.go: -------------------------------------------------------------------------------- 1 | package pgsql 2 | 3 | import ( 4 | "strings" 5 | 6 | "github.com/ribice/twisk/model" 7 | 8 | "github.com/go-pg/pg/orm" 9 | ) 10 | 11 | // NewUser returns a new User instance 12 | func NewUser() *User { 13 | return &User{} 14 | } 15 | 16 | // User represents the client for user table 17 | type User struct{} 18 | 19 | // FindByAuth finds user by either username or email 20 | func (s *User) FindByAuth(cl orm.DB, auth string) (*twisk.User, error) { 21 | var user = new(twisk.User) 22 | 23 | lAuth := strings.ToLower(auth) 24 | if err := cl.Model(user). 25 | Where("deleted_at is null"). 26 | Where("lower(username) = ? or lower(email) = ?", 27 | lAuth, lAuth).Select(); err != nil { 28 | return nil, err 29 | } 30 | 31 | return user, nil 32 | } 33 | 34 | // FindByToken finds user by either username or email 35 | func (s *User) FindByToken(cl orm.DB, token string) (*twisk.User, error) { 36 | var user = new(twisk.User) 37 | 38 | if err := cl.Model(user).Where("token = ?", token). 39 | Where("deleted_at is null").Select(); err != nil { 40 | return nil, err 41 | } 42 | 43 | return user, nil 44 | } 45 | 46 | // UpdateLastLogin updates user's last login details 47 | func (s *User) UpdateLastLogin(cl orm.DB, user *twisk.User) error { 48 | _, err := cl.Model(user).Column("last_login", "token"). 49 | WherePK().Update() 50 | return err 51 | } 52 | -------------------------------------------------------------------------------- /vendor/github.com/rs/zerolog/hook.go: -------------------------------------------------------------------------------- 1 | package zerolog 2 | 3 | // Hook defines an interface to a log hook. 4 | type Hook interface { 5 | // Run runs the hook with the event. 6 | Run(e *Event, level Level, message string) 7 | } 8 | 9 | // LevelHook applies a different hook for each level. 10 | type LevelHook struct { 11 | NoLevelHook, DebugHook, InfoHook, WarnHook, ErrorHook, FatalHook, PanicHook Hook 12 | } 13 | 14 | // Run implements the Hook interface. 15 | func (h LevelHook) Run(e *Event, level Level, message string) { 16 | switch level { 17 | case DebugLevel: 18 | if h.DebugHook != nil { 19 | h.DebugHook.Run(e, level, message) 20 | } 21 | case InfoLevel: 22 | if h.InfoHook != nil { 23 | h.InfoHook.Run(e, level, message) 24 | } 25 | case WarnLevel: 26 | if h.WarnHook != nil { 27 | h.WarnHook.Run(e, level, message) 28 | } 29 | case ErrorLevel: 30 | if h.ErrorHook != nil { 31 | h.ErrorHook.Run(e, level, message) 32 | } 33 | case FatalLevel: 34 | if h.FatalHook != nil { 35 | h.FatalHook.Run(e, level, message) 36 | } 37 | case PanicLevel: 38 | if h.PanicHook != nil { 39 | h.PanicHook.Run(e, level, message) 40 | } 41 | case NoLevel: 42 | if h.NoLevelHook != nil { 43 | h.NoLevelHook.Run(e, level, message) 44 | } 45 | } 46 | } 47 | 48 | // NewLevelHook returns a new LevelHook. 49 | func NewLevelHook() LevelHook { 50 | return LevelHook{} 51 | } 52 | -------------------------------------------------------------------------------- /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/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_linux_arm.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System calls for arm, Linux 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-28 17 | B syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-40 20 | B syscall·Syscall6(SB) 21 | 22 | TEXT ·SyscallNoError(SB),NOSPLIT,$0-24 23 | BL runtime·entersyscall(SB) 24 | MOVW trap+0(FP), R7 25 | MOVW a1+4(FP), R0 26 | MOVW a2+8(FP), R1 27 | MOVW a3+12(FP), R2 28 | MOVW $0, R3 29 | MOVW $0, R4 30 | MOVW $0, R5 31 | SWI $0 32 | MOVW R0, r1+16(FP) 33 | MOVW $0, R0 34 | MOVW R0, r2+20(FP) 35 | BL runtime·exitsyscall(SB) 36 | RET 37 | 38 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28 39 | B syscall·RawSyscall(SB) 40 | 41 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 42 | B syscall·RawSyscall6(SB) 43 | 44 | TEXT ·RawSyscallNoError(SB),NOSPLIT,$0-24 45 | MOVW trap+0(FP), R7 // syscall entry 46 | MOVW a1+4(FP), R0 47 | MOVW a2+8(FP), R1 48 | MOVW a3+12(FP), R2 49 | SWI $0 50 | MOVW R0, r1+16(FP) 51 | MOVW $0, R0 52 | MOVW R0, r2+20(FP) 53 | RET 54 | 55 | TEXT ·seek(SB),NOSPLIT,$0-28 56 | B syscall·seek(SB) 57 | -------------------------------------------------------------------------------- /vendor/github.com/go-pg/pg/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2013 github.com/go-pg/pg 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 | 14 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 15 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 16 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 17 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 18 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 19 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 20 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 24 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | -------------------------------------------------------------------------------- /vendor/github.com/go-pg/pg/types/scan_hstore.go: -------------------------------------------------------------------------------- 1 | package types 2 | 3 | import ( 4 | "fmt" 5 | "reflect" 6 | 7 | "github.com/go-pg/pg/internal/parser" 8 | ) 9 | 10 | func HstoreScanner(typ reflect.Type) ScannerFunc { 11 | if typ.Key() == stringType && typ.Elem() == stringType { 12 | return scanMapStringStringValue 13 | } 14 | return func(v reflect.Value, b []byte) error { 15 | return fmt.Errorf("pg.Hstore(unsupported %s)", v.Type()) 16 | } 17 | } 18 | 19 | func scanMapStringString(b []byte) (map[string]string, error) { 20 | if b == nil { 21 | return nil, nil 22 | } 23 | 24 | p := parser.NewHstoreParser(b) 25 | m := make(map[string]string) 26 | for p.Valid() { 27 | key, err := p.NextKey() 28 | if err != nil { 29 | return nil, err 30 | } 31 | if key == nil { 32 | return nil, fmt.Errorf("pg: unexpected NULL: %q", b) 33 | } 34 | 35 | value, err := p.NextValue() 36 | if err != nil { 37 | return nil, err 38 | } 39 | if value == nil { 40 | return nil, fmt.Errorf("pg: unexpected NULL: %q", b) 41 | } 42 | 43 | m[string(key)] = string(value) 44 | } 45 | return m, nil 46 | } 47 | 48 | func scanMapStringStringValue(v reflect.Value, b []byte) error { 49 | if !v.CanSet() { 50 | return fmt.Errorf("pg: Scan(nonsettable %s)", v.Type()) 51 | } 52 | m, err := scanMapStringString(b) 53 | if err != nil { 54 | return err 55 | } 56 | v.Set(reflect.ValueOf(m)) 57 | return nil 58 | } 59 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_linux_s390x.s: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build s390x 6 | // +build linux 7 | // +build !gccgo 8 | 9 | #include "textflag.h" 10 | 11 | // 12 | // System calls for s390x, Linux 13 | // 14 | 15 | // Just jump to package syscall's implementation for all these functions. 16 | // The runtime may know about them. 17 | 18 | TEXT ·Syscall(SB),NOSPLIT,$0-56 19 | BR syscall·Syscall(SB) 20 | 21 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 22 | BR syscall·Syscall6(SB) 23 | 24 | TEXT ·SyscallNoError(SB),NOSPLIT,$0-48 25 | BL runtime·entersyscall(SB) 26 | MOVD a1+8(FP), R2 27 | MOVD a2+16(FP), R3 28 | MOVD a3+24(FP), R4 29 | MOVD $0, R5 30 | MOVD $0, R6 31 | MOVD $0, R7 32 | MOVD trap+0(FP), R1 // syscall entry 33 | SYSCALL 34 | MOVD R2, r1+32(FP) 35 | MOVD R3, r2+40(FP) 36 | BL runtime·exitsyscall(SB) 37 | RET 38 | 39 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 40 | BR syscall·RawSyscall(SB) 41 | 42 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 43 | BR syscall·RawSyscall6(SB) 44 | 45 | TEXT ·RawSyscallNoError(SB),NOSPLIT,$0-48 46 | MOVD a1+8(FP), R2 47 | MOVD a2+16(FP), R3 48 | MOVD a3+24(FP), R4 49 | MOVD $0, R5 50 | MOVD $0, R6 51 | MOVD $0, R7 52 | MOVD trap+0(FP), R1 // syscall entry 53 | SYSCALL 54 | MOVD R2, r1+32(FP) 55 | MOVD R3, r2+40(FP) 56 | RET 57 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/zptracearm_linux.go: -------------------------------------------------------------------------------- 1 | // Code generated by linux/mkall.go generatePtracePair(arm, arm64). DO NOT EDIT. 2 | 3 | // +build linux 4 | // +build arm arm64 5 | 6 | package unix 7 | 8 | import "unsafe" 9 | 10 | // PtraceRegsArm is the registers used by arm binaries. 11 | type PtraceRegsArm struct { 12 | Uregs [18]uint32 13 | } 14 | 15 | // PtraceGetRegsArm fetches the registers used by arm binaries. 16 | func PtraceGetRegsArm(pid int, regsout *PtraceRegsArm) error { 17 | return ptrace(PTRACE_GETREGS, pid, 0, uintptr(unsafe.Pointer(regsout))) 18 | } 19 | 20 | // PtraceSetRegsArm sets the registers used by arm binaries. 21 | func PtraceSetRegsArm(pid int, regs *PtraceRegsArm) error { 22 | return ptrace(PTRACE_SETREGS, pid, 0, uintptr(unsafe.Pointer(regs))) 23 | } 24 | 25 | // PtraceRegsArm64 is the registers used by arm64 binaries. 26 | type PtraceRegsArm64 struct { 27 | Regs [31]uint64 28 | Sp uint64 29 | Pc uint64 30 | Pstate uint64 31 | } 32 | 33 | // PtraceGetRegsArm64 fetches the registers used by arm64 binaries. 34 | func PtraceGetRegsArm64(pid int, regsout *PtraceRegsArm64) error { 35 | return ptrace(PTRACE_GETREGS, pid, 0, uintptr(unsafe.Pointer(regsout))) 36 | } 37 | 38 | // PtraceSetRegsArm64 sets the registers used by arm64 binaries. 39 | func PtraceSetRegsArm64(pid int, regs *PtraceRegsArm64) error { 40 | return ptrace(PTRACE_SETREGS, pid, 0, uintptr(unsafe.Pointer(regs))) 41 | } 42 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_linux_mipsx.s: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build linux 6 | // +build mips mipsle 7 | // +build !gccgo 8 | 9 | #include "textflag.h" 10 | 11 | // 12 | // System calls for mips, Linux 13 | // 14 | 15 | // Just jump to package syscall's implementation for all these functions. 16 | // The runtime may know about them. 17 | 18 | TEXT ·Syscall(SB),NOSPLIT,$0-28 19 | JMP syscall·Syscall(SB) 20 | 21 | TEXT ·Syscall6(SB),NOSPLIT,$0-40 22 | JMP syscall·Syscall6(SB) 23 | 24 | TEXT ·Syscall9(SB),NOSPLIT,$0-52 25 | JMP syscall·Syscall9(SB) 26 | 27 | TEXT ·SyscallNoError(SB),NOSPLIT,$0-24 28 | JAL runtime·entersyscall(SB) 29 | MOVW a1+4(FP), R4 30 | MOVW a2+8(FP), R5 31 | MOVW a3+12(FP), R6 32 | MOVW R0, R7 33 | MOVW trap+0(FP), R2 // syscall entry 34 | SYSCALL 35 | MOVW R2, r1+16(FP) // r1 36 | MOVW R3, r2+20(FP) // r2 37 | JAL runtime·exitsyscall(SB) 38 | RET 39 | 40 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28 41 | JMP syscall·RawSyscall(SB) 42 | 43 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 44 | JMP syscall·RawSyscall6(SB) 45 | 46 | TEXT ·RawSyscallNoError(SB),NOSPLIT,$0-24 47 | MOVW a1+4(FP), R4 48 | MOVW a2+8(FP), R5 49 | MOVW a3+12(FP), R6 50 | MOVW trap+0(FP), R2 // syscall entry 51 | SYSCALL 52 | MOVW R2, r1+16(FP) 53 | MOVW R3, r2+20(FP) 54 | RET 55 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_linux_mips64x.s: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build linux 6 | // +build mips64 mips64le 7 | // +build !gccgo 8 | 9 | #include "textflag.h" 10 | 11 | // 12 | // System calls for mips64, Linux 13 | // 14 | 15 | // Just jump to package syscall's implementation for all these functions. 16 | // The runtime may know about them. 17 | 18 | TEXT ·Syscall(SB),NOSPLIT,$0-56 19 | JMP syscall·Syscall(SB) 20 | 21 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 22 | JMP syscall·Syscall6(SB) 23 | 24 | TEXT ·SyscallNoError(SB),NOSPLIT,$0-48 25 | JAL runtime·entersyscall(SB) 26 | MOVV a1+8(FP), R4 27 | MOVV a2+16(FP), R5 28 | MOVV a3+24(FP), R6 29 | MOVV R0, R7 30 | MOVV R0, R8 31 | MOVV R0, R9 32 | MOVV trap+0(FP), R2 // syscall entry 33 | SYSCALL 34 | MOVV R2, r1+32(FP) 35 | MOVV R3, r2+40(FP) 36 | JAL runtime·exitsyscall(SB) 37 | RET 38 | 39 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 40 | JMP syscall·RawSyscall(SB) 41 | 42 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 43 | JMP syscall·RawSyscall6(SB) 44 | 45 | TEXT ·RawSyscallNoError(SB),NOSPLIT,$0-48 46 | MOVV a1+8(FP), R4 47 | MOVV a2+16(FP), R5 48 | MOVV a3+24(FP), R6 49 | MOVV R0, R7 50 | MOVV R0, R8 51 | MOVV R0, R9 52 | MOVV trap+0(FP), R2 // syscall entry 53 | SYSCALL 54 | MOVV R2, r1+32(FP) 55 | MOVV R3, r2+40(FP) 56 | RET 57 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_linux_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 ·SyscallNoError(SB),NOSPLIT,$0-48 25 | BL runtime·entersyscall(SB) 26 | MOVD a1+8(FP), R3 27 | MOVD a2+16(FP), R4 28 | MOVD a3+24(FP), R5 29 | MOVD R0, R6 30 | MOVD R0, R7 31 | MOVD R0, R8 32 | MOVD trap+0(FP), R9 // syscall entry 33 | SYSCALL R9 34 | MOVD R3, r1+32(FP) 35 | MOVD R4, r2+40(FP) 36 | BL runtime·exitsyscall(SB) 37 | RET 38 | 39 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 40 | BR syscall·RawSyscall(SB) 41 | 42 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 43 | BR syscall·RawSyscall6(SB) 44 | 45 | TEXT ·RawSyscallNoError(SB),NOSPLIT,$0-48 46 | MOVD a1+8(FP), R3 47 | MOVD a2+16(FP), R4 48 | MOVD a3+24(FP), R5 49 | MOVD R0, R6 50 | MOVD R0, R7 51 | MOVD R0, R8 52 | MOVD trap+0(FP), R9 // syscall entry 53 | SYSCALL R9 54 | MOVD R3, r1+32(FP) 55 | MOVD R4, r2+40(FP) 56 | RET 57 | -------------------------------------------------------------------------------- /vendor/github.com/rs/zerolog/syslog.go: -------------------------------------------------------------------------------- 1 | // +build !windows 2 | // +build !binary_log 3 | 4 | package zerolog 5 | 6 | import ( 7 | "io" 8 | ) 9 | 10 | // SyslogWriter is an interface matching a syslog.Writer struct. 11 | type SyslogWriter interface { 12 | io.Writer 13 | Debug(m string) error 14 | Info(m string) error 15 | Warning(m string) error 16 | Err(m string) error 17 | Emerg(m string) error 18 | Crit(m string) error 19 | } 20 | 21 | type syslogWriter struct { 22 | w SyslogWriter 23 | } 24 | 25 | // SyslogLevelWriter wraps a SyslogWriter and call the right syslog level 26 | // method matching the zerolog level. 27 | func SyslogLevelWriter(w SyslogWriter) LevelWriter { 28 | return syslogWriter{w} 29 | } 30 | 31 | func (sw syslogWriter) Write(p []byte) (n int, err error) { 32 | return sw.w.Write(p) 33 | } 34 | 35 | // WriteLevel implements LevelWriter interface. 36 | func (sw syslogWriter) WriteLevel(level Level, p []byte) (n int, err error) { 37 | switch level { 38 | case DebugLevel: 39 | err = sw.w.Debug(string(p)) 40 | case InfoLevel: 41 | err = sw.w.Info(string(p)) 42 | case WarnLevel: 43 | err = sw.w.Warning(string(p)) 44 | case ErrorLevel: 45 | err = sw.w.Err(string(p)) 46 | case FatalLevel: 47 | err = sw.w.Emerg(string(p)) 48 | case PanicLevel: 49 | err = sw.w.Crit(string(p)) 50 | case NoLevel: 51 | err = sw.w.Info(string(p)) 52 | default: 53 | panic("invalid level") 54 | } 55 | n = len(p) 56 | return 57 | } 58 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_dragonfly_amd64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build amd64,dragonfly 6 | 7 | package unix 8 | 9 | import ( 10 | "syscall" 11 | "unsafe" 12 | ) 13 | 14 | func setTimespec(sec, nsec int64) Timespec { 15 | return Timespec{Sec: sec, Nsec: nsec} 16 | } 17 | 18 | func setTimeval(sec, usec int64) Timeval { 19 | return Timeval{Sec: sec, Usec: usec} 20 | } 21 | 22 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 23 | k.Ident = uint64(fd) 24 | k.Filter = int16(mode) 25 | k.Flags = uint16(flags) 26 | } 27 | 28 | func (iov *Iovec) SetLen(length int) { 29 | iov.Len = uint64(length) 30 | } 31 | 32 | func (msghdr *Msghdr) SetControllen(length int) { 33 | msghdr.Controllen = uint32(length) 34 | } 35 | 36 | func (cmsg *Cmsghdr) SetLen(length int) { 37 | cmsg.Len = uint32(length) 38 | } 39 | 40 | func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) { 41 | var writtenOut uint64 = 0 42 | _, _, e1 := Syscall9(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr(count), 0, uintptr(unsafe.Pointer(&writtenOut)), 0, 0, 0) 43 | 44 | written = int(writtenOut) 45 | 46 | if e1 != 0 { 47 | err = e1 48 | } 49 | return 50 | } 51 | 52 | func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) 53 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_freebsd_amd64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build amd64,freebsd 6 | 7 | package unix 8 | 9 | import ( 10 | "syscall" 11 | "unsafe" 12 | ) 13 | 14 | func setTimespec(sec, nsec int64) Timespec { 15 | return Timespec{Sec: sec, Nsec: nsec} 16 | } 17 | 18 | func setTimeval(sec, usec int64) Timeval { 19 | return Timeval{Sec: sec, Usec: usec} 20 | } 21 | 22 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 23 | k.Ident = uint64(fd) 24 | k.Filter = int16(mode) 25 | k.Flags = uint16(flags) 26 | } 27 | 28 | func (iov *Iovec) SetLen(length int) { 29 | iov.Len = uint64(length) 30 | } 31 | 32 | func (msghdr *Msghdr) SetControllen(length int) { 33 | msghdr.Controllen = uint32(length) 34 | } 35 | 36 | func (cmsg *Cmsghdr) SetLen(length int) { 37 | cmsg.Len = uint32(length) 38 | } 39 | 40 | func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) { 41 | var writtenOut uint64 = 0 42 | _, _, e1 := Syscall9(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr(count), 0, uintptr(unsafe.Pointer(&writtenOut)), 0, 0, 0) 43 | 44 | written = int(writtenOut) 45 | 46 | if e1 != 0 { 47 | err = e1 48 | } 49 | return 50 | } 51 | 52 | func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) 53 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_linux_amd64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System calls for AMD64, Linux 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-56 17 | JMP syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 20 | JMP syscall·Syscall6(SB) 21 | 22 | TEXT ·SyscallNoError(SB),NOSPLIT,$0-48 23 | CALL runtime·entersyscall(SB) 24 | MOVQ a1+8(FP), DI 25 | MOVQ a2+16(FP), SI 26 | MOVQ a3+24(FP), DX 27 | MOVQ $0, R10 28 | MOVQ $0, R8 29 | MOVQ $0, R9 30 | MOVQ trap+0(FP), AX // syscall entry 31 | SYSCALL 32 | MOVQ AX, r1+32(FP) 33 | MOVQ DX, r2+40(FP) 34 | CALL runtime·exitsyscall(SB) 35 | RET 36 | 37 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 38 | JMP syscall·RawSyscall(SB) 39 | 40 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 41 | JMP syscall·RawSyscall6(SB) 42 | 43 | TEXT ·RawSyscallNoError(SB),NOSPLIT,$0-48 44 | MOVQ a1+8(FP), DI 45 | MOVQ a2+16(FP), SI 46 | MOVQ a3+24(FP), DX 47 | MOVQ $0, R10 48 | MOVQ $0, R8 49 | MOVQ $0, R9 50 | MOVQ trap+0(FP), AX // syscall entry 51 | SYSCALL 52 | MOVQ AX, r1+32(FP) 53 | MOVQ DX, r2+40(FP) 54 | RET 55 | 56 | TEXT ·gettimeofday(SB),NOSPLIT,$0-16 57 | JMP syscall·gettimeofday(SB) 58 | -------------------------------------------------------------------------------- /vendor/github.com/go-pg/pg/orm/orm.go: -------------------------------------------------------------------------------- 1 | package orm 2 | 3 | import ( 4 | "context" 5 | "io" 6 | ) 7 | 8 | // ColumnScanner is used to scan column values. 9 | type ColumnScanner interface { 10 | // Scan assigns a column value from a row. 11 | // 12 | // An error should be returned if the value can not be stored 13 | // without loss of information. 14 | ScanColumn(colIdx int, colName string, b []byte) error 15 | } 16 | 17 | type QueryAppender interface { 18 | Copy() QueryAppender 19 | Query() *Query 20 | AppendQuery(dst []byte) ([]byte, error) 21 | } 22 | 23 | type QueryFormatter interface { 24 | FormatQuery(b []byte, query string, params ...interface{}) []byte 25 | } 26 | 27 | // DB is a common interface for pg.DB and pg.Tx types. 28 | type DB interface { 29 | Model(model ...interface{}) *Query 30 | Select(model interface{}) error 31 | Insert(model ...interface{}) error 32 | Update(model interface{}) error 33 | Delete(model interface{}) error 34 | 35 | Exec(query interface{}, params ...interface{}) (Result, error) 36 | ExecOne(query interface{}, params ...interface{}) (Result, error) 37 | Query(coll, query interface{}, params ...interface{}) (Result, error) 38 | QueryOne(model, query interface{}, params ...interface{}) (Result, error) 39 | 40 | CopyFrom(r io.Reader, query interface{}, params ...interface{}) (Result, error) 41 | CopyTo(w io.Writer, query interface{}, params ...interface{}) (Result, error) 42 | 43 | Context() context.Context 44 | QueryFormatter 45 | } 46 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_freebsd_arm.go: -------------------------------------------------------------------------------- 1 | // Copyright 2012 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build arm,freebsd 6 | 7 | package unix 8 | 9 | import ( 10 | "syscall" 11 | "unsafe" 12 | ) 13 | 14 | func setTimespec(sec, nsec int64) Timespec { 15 | return Timespec{Sec: sec, Nsec: int32(nsec)} 16 | } 17 | 18 | func setTimeval(sec, usec int64) Timeval { 19 | return Timeval{Sec: sec, Usec: int32(usec)} 20 | } 21 | 22 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 23 | k.Ident = uint32(fd) 24 | k.Filter = int16(mode) 25 | k.Flags = uint16(flags) 26 | } 27 | 28 | func (iov *Iovec) SetLen(length int) { 29 | iov.Len = uint32(length) 30 | } 31 | 32 | func (msghdr *Msghdr) SetControllen(length int) { 33 | msghdr.Controllen = uint32(length) 34 | } 35 | 36 | func (cmsg *Cmsghdr) SetLen(length int) { 37 | cmsg.Len = uint32(length) 38 | } 39 | 40 | func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) { 41 | var writtenOut uint64 = 0 42 | _, _, e1 := Syscall9(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr((*offset)>>32), uintptr(count), 0, uintptr(unsafe.Pointer(&writtenOut)), 0, 0) 43 | 44 | written = int(writtenOut) 45 | 46 | if e1 != 0 { 47 | err = e1 48 | } 49 | return 50 | } 51 | 52 | func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) 53 | -------------------------------------------------------------------------------- /internal/iam/logging.go: -------------------------------------------------------------------------------- 1 | package iam 2 | 3 | import ( 4 | "context" 5 | "time" 6 | 7 | "github.com/ribice/twisk/model" 8 | 9 | "github.com/ribice/twisk/rpc/iam" 10 | ) 11 | 12 | var svcName = "iam" 13 | 14 | // NewLoggingService creates new Template logging service 15 | func NewLoggingService(svc iam.IAM, logger twisk.Logger) *LoggingService { 16 | return &LoggingService{ 17 | IAM: svc, 18 | logger: logger, 19 | } 20 | } 21 | 22 | // LoggingService represents iam logging service 23 | type LoggingService struct { 24 | iam.IAM 25 | logger twisk.Logger 26 | } 27 | 28 | // Auth logging 29 | func (ls *LoggingService) Auth(ctx context.Context, req *iam.AuthReq) (resp *iam.AuthResp, err error) { 30 | defer func(begin time.Time) { 31 | req.Password = "xxx-redacted-xxx" 32 | ls.logger.Log( 33 | ctx, 34 | svcName, "Auth request", err, 35 | map[string]interface{}{ 36 | "took": time.Since(begin), 37 | "req": req, 38 | "resp": resp, 39 | }, 40 | ) 41 | }(time.Now()) 42 | return ls.IAM.Auth(ctx, req) 43 | } 44 | 45 | // Refresh token logging 46 | func (ls *LoggingService) Refresh(ctx context.Context, req *iam.RefreshReq) (resp *iam.RefreshResp, err error) { 47 | defer func(begin time.Time) { 48 | ls.logger.Log( 49 | ctx, 50 | svcName, "Refresh request", err, 51 | map[string]interface{}{ 52 | "took": time.Since(begin), 53 | "req": req, 54 | "resp": resp, 55 | }, 56 | ) 57 | }(time.Now()) 58 | return ls.IAM.Refresh(ctx, req) 59 | } 60 | -------------------------------------------------------------------------------- /vendor/github.com/gogo/protobuf/gogoproto/gogo.pb.golden: -------------------------------------------------------------------------------- 1 | // Code generated by protoc-gen-go. 2 | // source: gogo.proto 3 | // DO NOT EDIT! 4 | 5 | package gogoproto 6 | 7 | import proto "github.com/gogo/protobuf/proto" 8 | import json "encoding/json" 9 | import math "math" 10 | import google_protobuf "github.com/gogo/protobuf/protoc-gen-gogo/descriptor" 11 | 12 | // Reference proto, json, and math imports to suppress error if they are not otherwise used. 13 | var _ = proto.Marshal 14 | var _ = &json.SyntaxError{} 15 | var _ = math.Inf 16 | 17 | var E_Nullable = &proto.ExtensionDesc{ 18 | ExtendedType: (*google_protobuf.FieldOptions)(nil), 19 | ExtensionType: (*bool)(nil), 20 | Field: 51235, 21 | Name: "gogoproto.nullable", 22 | Tag: "varint,51235,opt,name=nullable", 23 | } 24 | 25 | var E_Embed = &proto.ExtensionDesc{ 26 | ExtendedType: (*google_protobuf.FieldOptions)(nil), 27 | ExtensionType: (*bool)(nil), 28 | Field: 51236, 29 | Name: "gogoproto.embed", 30 | Tag: "varint,51236,opt,name=embed", 31 | } 32 | 33 | var E_Customtype = &proto.ExtensionDesc{ 34 | ExtendedType: (*google_protobuf.FieldOptions)(nil), 35 | ExtensionType: (*string)(nil), 36 | Field: 51237, 37 | Name: "gogoproto.customtype", 38 | Tag: "bytes,51237,opt,name=customtype", 39 | } 40 | 41 | func init() { 42 | proto.RegisterExtension(E_Nullable) 43 | proto.RegisterExtension(E_Embed) 44 | proto.RegisterExtension(E_Customtype) 45 | } 46 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_freebsd_386.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build 386,freebsd 6 | 7 | package unix 8 | 9 | import ( 10 | "syscall" 11 | "unsafe" 12 | ) 13 | 14 | func setTimespec(sec, nsec int64) Timespec { 15 | return Timespec{Sec: int32(sec), Nsec: int32(nsec)} 16 | } 17 | 18 | func setTimeval(sec, usec int64) Timeval { 19 | return Timeval{Sec: int32(sec), Usec: int32(usec)} 20 | } 21 | 22 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 23 | k.Ident = uint32(fd) 24 | k.Filter = int16(mode) 25 | k.Flags = uint16(flags) 26 | } 27 | 28 | func (iov *Iovec) SetLen(length int) { 29 | iov.Len = uint32(length) 30 | } 31 | 32 | func (msghdr *Msghdr) SetControllen(length int) { 33 | msghdr.Controllen = uint32(length) 34 | } 35 | 36 | func (cmsg *Cmsghdr) SetLen(length int) { 37 | cmsg.Len = uint32(length) 38 | } 39 | 40 | func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) { 41 | var writtenOut uint64 = 0 42 | _, _, e1 := Syscall9(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr((*offset)>>32), uintptr(count), 0, uintptr(unsafe.Pointer(&writtenOut)), 0, 0) 43 | 44 | written = int(writtenOut) 45 | 46 | if e1 != 0 { 47 | err = e1 48 | } 49 | return 50 | } 51 | 52 | func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) 53 | -------------------------------------------------------------------------------- /mock/rbac.go: -------------------------------------------------------------------------------- 1 | package mock 2 | 3 | import ( 4 | "context" 5 | 6 | "github.com/ribice/twisk/model" 7 | ) 8 | 9 | // RBAC Mock 10 | type RBAC struct { 11 | EnforceRoleFn func(context.Context, twisk.AccessRole) bool 12 | EnforceUserFn func(context.Context, int64) bool 13 | EnforceTenantFn func(context.Context, int32) bool 14 | EnforceTenantAdminFn func(context.Context, int32) bool 15 | IsLowerRoleFn func(context.Context, twisk.AccessRole) bool 16 | EnforceTenantAndRoleFn func(context.Context, twisk.AccessRole, int32) bool 17 | } 18 | 19 | // EnforceRole mock 20 | func (a *RBAC) EnforceRole(c context.Context, role twisk.AccessRole) bool { 21 | return a.EnforceRoleFn(c, role) 22 | } 23 | 24 | // EnforceUser mock 25 | func (a *RBAC) EnforceUser(c context.Context, id int64) bool { 26 | return a.EnforceUserFn(c, id) 27 | } 28 | 29 | // EnforceTenant mock 30 | func (a *RBAC) EnforceTenant(c context.Context, id int32) bool { 31 | return a.EnforceTenantFn(c, id) 32 | } 33 | 34 | // EnforceTenantAdmin mock 35 | func (a *RBAC) EnforceTenantAdmin(c context.Context, id int32) bool { 36 | return a.EnforceTenantAdminFn(c, id) 37 | } 38 | 39 | // EnforceTenantAndRole mock 40 | func (a *RBAC) EnforceTenantAndRole(c context.Context, role twisk.AccessRole, id int32) bool { 41 | return a.EnforceTenantAndRoleFn(c, role, id) 42 | } 43 | 44 | // IsLowerRole mock 45 | func (a *RBAC) IsLowerRole(c context.Context, role twisk.AccessRole) bool { 46 | return a.IsLowerRoleFn(c, role) 47 | } 48 | -------------------------------------------------------------------------------- /vendor/github.com/nbutton23/zxcvbn-go/frequency/frequency.go: -------------------------------------------------------------------------------- 1 | package frequency 2 | 3 | import ( 4 | "encoding/json" 5 | "github.com/nbutton23/zxcvbn-go/data" 6 | "log" 7 | ) 8 | 9 | type FrequencyList struct { 10 | Name string 11 | List []string 12 | } 13 | 14 | var FrequencyLists = make(map[string]FrequencyList) 15 | 16 | func init() { 17 | maleFilePath := getAsset("data/MaleNames.json") 18 | femaleFilePath := getAsset("data/FemaleNames.json") 19 | surnameFilePath := getAsset("data/Surnames.json") 20 | englishFilePath := getAsset("data/English.json") 21 | passwordsFilePath := getAsset("data/Passwords.json") 22 | 23 | FrequencyLists["MaleNames"] = GetStringListFromAsset(maleFilePath, "MaleNames") 24 | FrequencyLists["FemaleNames"] = GetStringListFromAsset(femaleFilePath, "FemaleNames") 25 | FrequencyLists["Surname"] = GetStringListFromAsset(surnameFilePath, "Surname") 26 | FrequencyLists["English"] = GetStringListFromAsset(englishFilePath, "English") 27 | FrequencyLists["Passwords"] = GetStringListFromAsset(passwordsFilePath, "Passwords") 28 | 29 | } 30 | func getAsset(name string) []byte { 31 | data, err := zxcvbn_data.Asset(name) 32 | if err != nil { 33 | panic("Error getting asset " + name) 34 | } 35 | 36 | return data 37 | } 38 | func GetStringListFromAsset(data []byte, name string) FrequencyList { 39 | 40 | var tempList FrequencyList 41 | err := json.Unmarshal(data, &tempList) 42 | if err != nil { 43 | log.Fatal(err) 44 | } 45 | tempList.Name = name 46 | return tempList 47 | } 48 | -------------------------------------------------------------------------------- /pkg/hooks/jwt.go: -------------------------------------------------------------------------------- 1 | package hooks 2 | 3 | import ( 4 | "context" 5 | "strings" 6 | 7 | "github.com/ribice/twisk/model" 8 | 9 | pkgctx "github.com/ribice/twisk/pkg/context" 10 | "github.com/twitchtv/twirp" 11 | ) 12 | 13 | // TokenParser represents jwt auth token parser and validator 14 | type TokenParser interface { 15 | ParseToken(string) (*twisk.AuthUser, error) 16 | } 17 | 18 | // WithJWTAuth creates new twirp authentication hook 19 | func WithJWTAuth(parser TokenParser, skip ...string) *twirp.ServerHooks { 20 | return &twirp.ServerHooks{ 21 | RequestRouted: func(ctx context.Context) (context.Context, error) { 22 | mtd, _ := twirp.MethodName(ctx) 23 | for _, smtd := range skip { 24 | if mtd == smtd { 25 | return ctx, nil 26 | } 27 | } 28 | 29 | bearer, ok := ctx.Value(pkgctx.KeyString("HTTP-Authorization")).(string) 30 | if !ok { 31 | return ctx, twirp.NewError(twirp.Unauthenticated, "no auth headers present") 32 | } 33 | 34 | slice := strings.Split(bearer, " ") 35 | 36 | if len(slice) != 2 || strings.ToLower(slice[0]) != "bearer" { 37 | return ctx, twirp.NewError(twirp.Unauthenticated, "no bearer token") 38 | } 39 | 40 | user, err := parser.ParseToken(slice[1]) 41 | if err != nil { 42 | return ctx, twirp.NewError(twirp.Unauthenticated, err.Error()) 43 | } 44 | 45 | ctx = context.WithValue(ctx, pkgctx.KeyString(pkgctx.JWTKey), slice[1]) 46 | return context.WithValue(ctx, pkgctx.KeyString("_authuser"), user), nil 47 | }, 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/mksysnum_netbsd.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 OpenBSD from master list 7 | # (for example, /usr/src/sys/kern/syscalls.master). 8 | 9 | use strict; 10 | 11 | if($ENV{'GOARCH'} eq "" || $ENV{'GOOS'} eq "") { 12 | print STDERR "GOARCH or GOOS not defined in environment\n"; 13 | exit 1; 14 | } 15 | 16 | my $command = "mksysnum_netbsd.pl " . join(' ', @ARGV); 17 | 18 | print <){ 31 | if($line =~ /^(.*)\\$/) { 32 | # Handle continuation 33 | $line = $1; 34 | $_ =~ s/^\s+//; 35 | $line .= $_; 36 | } else { 37 | # New line 38 | $line = $_; 39 | } 40 | next if $line =~ /\\$/; 41 | if($line =~ /^([0-9]+)\s+((STD)|(NOERR))\s+(RUMP\s+)?({\s+\S+\s*\*?\s*\|(\S+)\|(\S*)\|(\w+).*\s+})(\s+(\S+))?$/) { 42 | my $num = $1; 43 | my $proto = $6; 44 | my $compat = $8; 45 | my $name = "$7_$9"; 46 | 47 | $name = "$7_$11" if $11 ne ''; 48 | $name =~ y/a-z/A-Z/; 49 | 50 | if($compat eq '' || $compat eq '13' || $compat eq '30' || $compat eq '50') { 51 | print " $name = $num; // $proto\n"; 52 | } 53 | } 54 | } 55 | 56 | print < 0 && b[len(b)-1] != '\\' 66 | if ok { 67 | b = append(b, '"') 68 | } 69 | if stop { 70 | break 71 | } 72 | } 73 | case '}': 74 | return b 75 | default: 76 | b = append(b, c) 77 | } 78 | } 79 | return b 80 | } 81 | -------------------------------------------------------------------------------- /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 | --------------------------------------------------------------------------------