├── .gitignore ├── .travis.yml ├── Gopkg.lock ├── Gopkg.toml ├── LICENSE ├── Makefile ├── README.md ├── cmd ├── chunkserver │ └── main.go └── hfsclient │ └── main.go ├── pb ├── service.pb.go └── service.proto ├── pkg ├── chunkserver │ └── chunkserver.go ├── config │ ├── config.go │ └── config_test.go ├── files │ ├── files.go │ └── files_test.go ├── hfsclient │ └── hfsclient.go ├── logger │ └── logger.go ├── selection │ ├── selection.go │ └── selection_test.go └── utils │ └── utils.go └── vendor ├── github.com ├── coreos │ └── etcd │ │ ├── Documentation │ │ └── README.md │ │ ├── LICENSE │ │ ├── NOTICE │ │ ├── auth │ │ └── authpb │ │ │ ├── auth.pb.go │ │ │ └── auth.proto │ │ ├── clientv3 │ │ ├── README.md │ │ ├── auth.go │ │ ├── client.go │ │ ├── cluster.go │ │ ├── compact_op.go │ │ ├── compare.go │ │ ├── config.go │ │ ├── doc.go │ │ ├── health_balancer.go │ │ ├── kv.go │ │ ├── lease.go │ │ ├── logger.go │ │ ├── maintenance.go │ │ ├── op.go │ │ ├── options.go │ │ ├── ready_wait.go │ │ ├── retry.go │ │ ├── sort.go │ │ ├── txn.go │ │ └── watch.go │ │ ├── cmd │ │ ├── etcd │ │ ├── etcdctl │ │ ├── functional │ │ └── tools │ │ ├── etcdserver │ │ ├── api │ │ │ └── v3rpc │ │ │ │ └── rpctypes │ │ │ │ ├── doc.go │ │ │ │ ├── error.go │ │ │ │ └── md.go │ │ └── etcdserverpb │ │ │ ├── etcdserver.pb.go │ │ │ ├── etcdserver.proto │ │ │ ├── raft_internal.pb.go │ │ │ ├── raft_internal.proto │ │ │ ├── raft_internal_stringer.go │ │ │ ├── rpc.pb.go │ │ │ └── rpc.proto │ │ ├── mvcc │ │ └── mvccpb │ │ │ ├── kv.pb.go │ │ │ └── kv.proto │ │ └── pkg │ │ └── types │ │ ├── doc.go │ │ ├── id.go │ │ ├── set.go │ │ ├── slice.go │ │ ├── urls.go │ │ └── urlsmap.go ├── gogo │ └── protobuf │ │ ├── AUTHORS │ │ ├── CONTRIBUTORS │ │ ├── GOLANG_CONTRIBUTORS │ │ ├── LICENSE │ │ ├── gogoproto │ │ ├── Makefile │ │ ├── doc.go │ │ ├── gogo.pb.go │ │ ├── gogo.pb.golden │ │ ├── gogo.proto │ │ └── helper.go │ │ ├── proto │ │ ├── Makefile │ │ ├── clone.go │ │ ├── decode.go │ │ ├── decode_gogo.go │ │ ├── discard.go │ │ ├── duration.go │ │ ├── duration_gogo.go │ │ ├── encode.go │ │ ├── encode_gogo.go │ │ ├── equal.go │ │ ├── extensions.go │ │ ├── extensions_gogo.go │ │ ├── lib.go │ │ ├── lib_gogo.go │ │ ├── message_set.go │ │ ├── pointer_reflect.go │ │ ├── pointer_reflect_gogo.go │ │ ├── pointer_unsafe.go │ │ ├── pointer_unsafe_gogo.go │ │ ├── properties.go │ │ ├── properties_gogo.go │ │ ├── skip_gogo.go │ │ ├── text.go │ │ ├── text_gogo.go │ │ ├── text_parser.go │ │ ├── timestamp.go │ │ └── timestamp_gogo.go │ │ └── protoc-gen-gogo │ │ └── descriptor │ │ ├── Makefile │ │ ├── descriptor.go │ │ ├── descriptor.pb.go │ │ ├── descriptor_gostring.gen.go │ │ └── helper.go ├── golang │ └── protobuf │ │ ├── AUTHORS │ │ ├── CONTRIBUTORS │ │ ├── LICENSE │ │ ├── proto │ │ ├── clone.go │ │ ├── decode.go │ │ ├── discard.go │ │ ├── encode.go │ │ ├── equal.go │ │ ├── extensions.go │ │ ├── lib.go │ │ ├── message_set.go │ │ ├── pointer_reflect.go │ │ ├── pointer_unsafe.go │ │ ├── properties.go │ │ ├── table_marshal.go │ │ ├── table_merge.go │ │ ├── table_unmarshal.go │ │ ├── text.go │ │ └── text_parser.go │ │ └── ptypes │ │ ├── any.go │ │ ├── any │ │ ├── any.pb.go │ │ └── any.proto │ │ ├── doc.go │ │ ├── duration.go │ │ ├── duration │ │ ├── duration.pb.go │ │ └── duration.proto │ │ ├── timestamp.go │ │ └── timestamp │ │ ├── timestamp.pb.go │ │ └── timestamp.proto └── google │ └── uuid │ ├── .travis.yml │ ├── CONTRIBUTING.md │ ├── CONTRIBUTORS │ ├── LICENSE │ ├── README.md │ ├── dce.go │ ├── doc.go │ ├── hash.go │ ├── marshal.go │ ├── node.go │ ├── sql.go │ ├── time.go │ ├── util.go │ ├── uuid.go │ ├── version1.go │ └── version4.go ├── go.uber.org ├── atomic │ ├── .codecov.yml │ ├── .gitignore │ ├── .travis.yml │ ├── LICENSE.txt │ ├── Makefile │ ├── README.md │ ├── atomic.go │ ├── glide.lock │ ├── glide.yaml │ └── string.go ├── multierr │ ├── .codecov.yml │ ├── .gitignore │ ├── .travis.yml │ ├── CHANGELOG.md │ ├── LICENSE.txt │ ├── Makefile │ ├── README.md │ ├── error.go │ ├── glide.lock │ └── glide.yaml └── zap │ ├── .codecov.yml │ ├── .gitignore │ ├── .readme.tmpl │ ├── .travis.yml │ ├── CHANGELOG.md │ ├── CODE_OF_CONDUCT.md │ ├── CONTRIBUTING.md │ ├── FAQ.md │ ├── LICENSE.txt │ ├── Makefile │ ├── README.md │ ├── array.go │ ├── buffer │ ├── buffer.go │ └── pool.go │ ├── check_license.sh │ ├── config.go │ ├── doc.go │ ├── encoder.go │ ├── error.go │ ├── field.go │ ├── flag.go │ ├── glide.lock │ ├── glide.yaml │ ├── global.go │ ├── http_handler.go │ ├── internal │ ├── bufferpool │ │ └── bufferpool.go │ ├── color │ │ └── color.go │ └── exit │ │ └── exit.go │ ├── level.go │ ├── logger.go │ ├── options.go │ ├── stacktrace.go │ ├── sugar.go │ ├── time.go │ ├── writer.go │ └── zapcore │ ├── console_encoder.go │ ├── core.go │ ├── doc.go │ ├── encoder.go │ ├── entry.go │ ├── error.go │ ├── field.go │ ├── hook.go │ ├── json_encoder.go │ ├── level.go │ ├── level_strings.go │ ├── marshaler.go │ ├── memory_encoder.go │ ├── sampler.go │ ├── tee.go │ └── write_syncer.go ├── golang.org └── x │ ├── net │ ├── AUTHORS │ ├── CONTRIBUTORS │ ├── LICENSE │ ├── PATENTS │ ├── context │ │ ├── context.go │ │ ├── go17.go │ │ ├── go19.go │ │ ├── pre_go17.go │ │ └── pre_go19.go │ ├── http │ │ └── httpguts │ │ │ ├── guts.go │ │ │ └── httplex.go │ ├── http2 │ │ ├── .gitignore │ │ ├── Dockerfile │ │ ├── Makefile │ │ ├── README │ │ ├── ciphers.go │ │ ├── client_conn_pool.go │ │ ├── configure_transport.go │ │ ├── databuffer.go │ │ ├── errors.go │ │ ├── flow.go │ │ ├── frame.go │ │ ├── go16.go │ │ ├── go17.go │ │ ├── go17_not18.go │ │ ├── go18.go │ │ ├── go19.go │ │ ├── gotrack.go │ │ ├── headermap.go │ │ ├── hpack │ │ │ ├── encode.go │ │ │ ├── hpack.go │ │ │ ├── huffman.go │ │ │ └── tables.go │ │ ├── http2.go │ │ ├── not_go16.go │ │ ├── not_go17.go │ │ ├── not_go18.go │ │ ├── not_go19.go │ │ ├── pipe.go │ │ ├── server.go │ │ ├── transport.go │ │ ├── write.go │ │ ├── writesched.go │ │ ├── writesched_priority.go │ │ └── writesched_random.go │ ├── idna │ │ ├── idna.go │ │ ├── punycode.go │ │ ├── tables.go │ │ ├── trie.go │ │ └── trieval.go │ ├── internal │ │ └── timeseries │ │ │ └── timeseries.go │ └── trace │ │ ├── events.go │ │ ├── histogram.go │ │ ├── trace.go │ │ ├── trace_go16.go │ │ └── trace_go17.go │ └── text │ ├── AUTHORS │ ├── CONTRIBUTORS │ ├── LICENSE │ ├── PATENTS │ ├── collate │ ├── build │ │ ├── builder.go │ │ ├── colelem.go │ │ ├── contract.go │ │ ├── order.go │ │ ├── table.go │ │ └── trie.go │ ├── collate.go │ ├── index.go │ ├── maketables.go │ ├── option.go │ ├── sort.go │ └── tables.go │ ├── internal │ ├── colltab │ │ ├── collelem.go │ │ ├── colltab.go │ │ ├── contract.go │ │ ├── iter.go │ │ ├── numeric.go │ │ ├── table.go │ │ ├── trie.go │ │ └── weighter.go │ ├── gen │ │ ├── code.go │ │ └── gen.go │ ├── tag │ │ └── tag.go │ ├── triegen │ │ ├── compact.go │ │ ├── print.go │ │ └── triegen.go │ └── ucd │ │ └── ucd.go │ ├── language │ ├── Makefile │ ├── common.go │ ├── coverage.go │ ├── doc.go │ ├── gen.go │ ├── gen_common.go │ ├── gen_index.go │ ├── go1_1.go │ ├── go1_2.go │ ├── index.go │ ├── language.go │ ├── lookup.go │ ├── match.go │ ├── parse.go │ ├── tables.go │ └── tags.go │ ├── secure │ └── bidirule │ │ ├── bidirule.go │ │ ├── bidirule10.0.0.go │ │ └── bidirule9.0.0.go │ ├── transform │ └── transform.go │ └── unicode │ ├── bidi │ ├── bidi.go │ ├── bracket.go │ ├── core.go │ ├── gen.go │ ├── gen_ranges.go │ ├── gen_trieval.go │ ├── prop.go │ ├── tables10.0.0.go │ ├── tables9.0.0.go │ └── trieval.go │ ├── cldr │ ├── base.go │ ├── cldr.go │ ├── collate.go │ ├── decode.go │ ├── makexml.go │ ├── resolve.go │ ├── slice.go │ └── xml.go │ ├── norm │ ├── composition.go │ ├── forminfo.go │ ├── input.go │ ├── iter.go │ ├── maketables.go │ ├── normalize.go │ ├── readwriter.go │ ├── tables10.0.0.go │ ├── tables9.0.0.go │ ├── transform.go │ ├── trie.go │ └── triegen.go │ └── rangetable │ ├── gen.go │ ├── merge.go │ ├── rangetable.go │ ├── tables10.0.0.go │ └── tables9.0.0.go ├── google.golang.org ├── genproto │ ├── LICENSE │ └── googleapis │ │ └── rpc │ │ └── status │ │ └── status.pb.go └── grpc │ ├── .travis.yml │ ├── AUTHORS │ ├── CONTRIBUTING.md │ ├── LICENSE │ ├── Makefile │ ├── README.md │ ├── backoff.go │ ├── balancer.go │ ├── balancer │ ├── balancer.go │ ├── base │ │ ├── balancer.go │ │ └── base.go │ └── roundrobin │ │ └── roundrobin.go │ ├── balancer_conn_wrappers.go │ ├── balancer_v1_wrapper.go │ ├── call.go │ ├── clientconn.go │ ├── codec.go │ ├── codegen.sh │ ├── codes │ ├── code_string.go │ └── codes.go │ ├── connectivity │ └── connectivity.go │ ├── credentials │ ├── credentials.go │ ├── credentials_util_go17.go │ ├── credentials_util_go18.go │ └── credentials_util_pre_go17.go │ ├── doc.go │ ├── encoding │ ├── encoding.go │ └── proto │ │ └── proto.go │ ├── envconfig.go │ ├── go16.go │ ├── go17.go │ ├── grpclog │ ├── grpclog.go │ ├── logger.go │ └── loggerv2.go │ ├── health │ └── grpc_health_v1 │ │ └── health.pb.go │ ├── interceptor.go │ ├── internal │ ├── backoff │ │ └── backoff.go │ ├── channelz │ │ ├── funcs.go │ │ └── types.go │ ├── grpcrand │ │ └── grpcrand.go │ └── internal.go │ ├── keepalive │ └── keepalive.go │ ├── metadata │ └── metadata.go │ ├── naming │ ├── dns_resolver.go │ ├── go17.go │ ├── go18.go │ └── naming.go │ ├── peer │ └── peer.go │ ├── picker_wrapper.go │ ├── pickfirst.go │ ├── proxy.go │ ├── resolver │ ├── dns │ │ ├── dns_resolver.go │ │ ├── go17.go │ │ └── go18.go │ ├── passthrough │ │ └── passthrough.go │ └── resolver.go │ ├── resolver_conn_wrapper.go │ ├── rpc_util.go │ ├── server.go │ ├── service_config.go │ ├── stats │ ├── handlers.go │ └── stats.go │ ├── status │ ├── go16.go │ ├── go17.go │ └── status.go │ ├── stickiness_linkedmap.go │ ├── stream.go │ ├── tap │ └── tap.go │ ├── trace.go │ ├── transport │ ├── bdp_estimator.go │ ├── controlbuf.go │ ├── flowcontrol.go │ ├── go16.go │ ├── go17.go │ ├── handler_server.go │ ├── http2_client.go │ ├── http2_server.go │ ├── http_util.go │ ├── log.go │ └── transport.go │ ├── version.go │ └── vet.sh └── gopkg.in └── urfave └── cli.v1 ├── .flake8 ├── .gitignore ├── .travis.yml ├── CHANGELOG.md ├── LICENSE ├── README.md ├── app.go ├── appveyor.yml ├── category.go ├── cli.go ├── command.go ├── context.go ├── errors.go ├── flag-types.json ├── flag.go ├── flag_generated.go ├── funcs.go ├── generate-flag-types ├── help.go └── runtests /.gitignore: -------------------------------------------------------------------------------- 1 | bin/ 2 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | go: 3 | - 1.10.x 4 | 5 | before_install: 6 | - go get -t -v ./... 7 | 8 | script: 9 | - go test -race -coverprofile=coverage.txt -covermode=atomic ./... 10 | 11 | after_success: 12 | - bash <(curl -s https://codecov.io/bash) 13 | -------------------------------------------------------------------------------- /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 | 28 | [prune] 29 | go-tests = true 30 | unused-packages = true 31 | 32 | [[constraint]] 33 | name = "go.uber.org/zap" 34 | version = "1.8.0" 35 | 36 | [[constraint]] 37 | name = "gopkg.in/urfave/cli.v1" 38 | version = "1.20.0" 39 | 40 | [[constraint]] 41 | name = "github.com/coreos/etcd" 42 | version = "3.3.8" 43 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: all 2 | 3 | all: protogen fmt vet test build 4 | echo "success" 5 | 6 | fmt: 7 | go fmt ./... 8 | 9 | vet: 10 | go vet -v ./... 11 | 12 | test: 13 | go test -race -cover ./... 14 | 15 | build: 16 | go build -o bin/chunkserver cmd/chunkserver/main.go 17 | go build -o bin/hfsclient cmd/hfsclient/main.go 18 | 19 | protogen: 20 | protoc -I pb pb/service.proto --go_out=plugins=grpc:pb 21 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # HFS 2 | 3 | [![Build Status](https://travis-ci.org/jiajunhuang/hfs.svg?branch=master)](https://travis-ci.org/jiajunhuang/hfs) 4 | [![codecov](https://codecov.io/gh/jiajunhuang/hfs/branch/master/graph/badge.svg)](https://codecov.io/gh/jiajunhuang/hfs) 5 | 6 | Huang's Chunked Distributed File System. 7 | 8 | My toy. 9 | 10 | TODO: 11 | 12 | - [ ] concurrently download file 13 | 14 | ## Make it works 15 | 16 | 0. install and start etcd: 17 | 18 | ```bash 19 | $ # check https://coreos.com/etcd/docs/latest/dl_build.html 20 | ``` 21 | 22 | 1. first, create a directory which stores chunks: 23 | 24 | ```bash 25 | $ sudo mkdir -p /hfs/chunks/ 26 | $ sudo chown -R : /hfs 27 | ``` 28 | 29 | 2. clone code: 30 | 31 | ```bash 32 | $ git clone https://github.com/jiajunhuang/hfs.git 33 | $ cd hfs 34 | $ make 35 | ``` 36 | 37 | 3. start chunk server: 38 | 39 | ```bash 40 | $ ./bin/chunkserver 41 | ``` 42 | 43 | 4. open another terminal, run the client: 44 | 45 | ```bash 46 | $ ./bin/hfsclient upload ~/Downloads/ubuntu-16.04.4-server-amd64.iso 47 | file created, uuid is 60aca0d4-28d9-481b-9a62-460f642664d0 48 | $ ./bin/hfsclient download 60aca0d4-28d9-481b-9a62-460f642664d0 49 | file with UUID 60aca0d4-28d9-481b-9a62-460f642664d0 download successful! origin file name is ubuntu-16.04.4-server-amd64.iso 50 | $ md5sum 60aca0d4-28d9-481b-9a62-460f642664d0 51 | 6a7f31eb125a0b2908cf2333d7777c82 60aca0d4-28d9-481b-9a62-460f642664d0 52 | $ md5sum ~/Downloads/ubuntu-16.04.4-server-amd64.iso 53 | 6a7f31eb125a0b2908cf2333d7777c82 /Users/neo.huang/Downloads/ubuntu-16.04.4-server-amd64.iso 54 | ``` 55 | 56 | 5. check chunks: 57 | 58 | ```bash 59 | $ ls /hfs/chunks/ 60 | 06c520d5-9c01-438f-9760-7004decce303 28749da5-2ad7-4d01-8dff-3b4d5426b0bf 6cba4f9c-4121-4388-b1e9-5015d7aac9bb d246ea5c-c66e-4ba6-a4aa-b4b3d46f0ef1 61 | 0949ed79-4b75-4b9d-aa24-799e725aeffb 39d242e5-4c63-4d0f-8145-629a61e1b4a2 9021960b-b283-4f21-bcbb-9fc425609e99 e97c274b-0467-4295-a488-f917dceb2f70 62 | 1dcb04a8-4f3e-4df4-a1bf-28b38de2ac7c 44884d3e-4017-42cd-b0e3-baf3bb0090f2 acb103bb-d140-4cd8-869f-a7ef0f14b1c0 63 | 2581cc6c-3ae1-4b8f-8f69-86290d9e2191 4c18bf25-d652-4ed4-ab01-cda48f87a5e6 c3983a62-b770-43df-81c5-c8f2684951ea 64 | ``` 65 | 66 | 6. check KVs in etcd: 67 | 68 | ```bash 69 | $ ETCDCTL_API=3 etcdctl get "" --prefix=true 70 | /hfs/chunks/06c520d5-9c01-438f-9760-7004decce303 71 | ...(ignore the rest) 72 | ``` 73 | 74 | 7. delete file: 75 | 76 | ```bash 77 | $ ./bin/hfsclient delete 60aca0d4-28d9-481b-9a62-460f642664d0 78 | ``` 79 | -------------------------------------------------------------------------------- /cmd/chunkserver/main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "os" 5 | 6 | "github.com/jiajunhuang/hfs/pkg/chunkserver" 7 | "github.com/jiajunhuang/hfs/pkg/logger" 8 | cli "gopkg.in/urfave/cli.v1" 9 | ) 10 | 11 | func main() { 12 | defer logger.Logger.Sync() 13 | 14 | app := cli.NewApp() 15 | app.Name = "chunkserver" 16 | app.Usage = "Chunkserver for Huang's Distributed File System" 17 | app.Action = func(c *cli.Context) error { 18 | chunkserver.StartChunkServer() 19 | return nil 20 | } 21 | 22 | err := app.Run(os.Args) 23 | if err != nil { 24 | logger.Sugar.Fatal(err) 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /cmd/hfsclient/main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "os" 6 | 7 | "github.com/jiajunhuang/hfs/pb" 8 | "github.com/jiajunhuang/hfs/pkg/config" 9 | "github.com/jiajunhuang/hfs/pkg/hfsclient" 10 | "github.com/jiajunhuang/hfs/pkg/logger" 11 | "google.golang.org/grpc" 12 | cli "gopkg.in/urfave/cli.v1" 13 | ) 14 | 15 | func main() { 16 | defer logger.Logger.Sync() 17 | conn, err := grpc.Dial(config.GRPCAddr, grpc.WithInsecure(), grpc.WithMaxMsgSize(config.GRPCMaxMsgSize)) 18 | if err != nil { 19 | logger.Sugar.Fatalf("failed to connect to grpc server %s: %s", config.GRPCAddr, err) 20 | } 21 | defer conn.Close() 22 | 23 | grpcClient := pb.NewChunkServerClient(conn) 24 | 25 | app := cli.NewApp() 26 | app.Name = "hfsclient" 27 | app.Usage = "cli for Huang's Distributed File System" 28 | app.Commands = []cli.Command{ 29 | { 30 | Name: "upload", 31 | Usage: "upload file", 32 | Action: func(c *cli.Context) error { 33 | filePath := c.Args().First() 34 | if filePath == "" { 35 | fmt.Printf("Usage: $ hfsclient upload \n") 36 | return nil 37 | } 38 | 39 | if err := hfsclient.Upload(grpcClient, filePath); err != nil { 40 | fmt.Printf("failed to upload: %s\n", err) 41 | } 42 | 43 | return nil 44 | }, 45 | }, 46 | { 47 | Name: "download", 48 | Usage: "download file", 49 | Action: func(c *cli.Context) error { 50 | fileUUID := c.Args().First() 51 | if fileUUID == "" { 52 | fmt.Printf("Usage: $ hfsclient download \n") 53 | return nil 54 | } 55 | 56 | if err := hfsclient.Download(grpcClient, fileUUID); err != nil { 57 | fmt.Printf("failed to download: %s\n", err) 58 | } 59 | 60 | return nil 61 | }, 62 | }, 63 | { 64 | Name: "delete", 65 | Usage: "delete file", 66 | Action: func(c *cli.Context) error { 67 | fileUUID := c.Args().First() 68 | if fileUUID == "" { 69 | fmt.Printf("Usage: $ hfsclient download \n") 70 | return nil 71 | } 72 | 73 | if err := hfsclient.Delete(grpcClient, fileUUID); err != nil { 74 | fmt.Printf("failed to download: %s\n", err) 75 | } 76 | 77 | return nil 78 | }, 79 | }, 80 | } 81 | 82 | err = app.Run(os.Args) 83 | if err != nil { 84 | logger.Sugar.Fatal(err) 85 | } 86 | } 87 | -------------------------------------------------------------------------------- /pb/service.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package pb; 4 | 5 | message Chunk { 6 | string UUID = 1; // chunk uuid 7 | int64 size = 2; // chunk size 8 | int64 used = 3; // size in bytes real used 9 | repeated string replicas = 4; // all the locations of itself 10 | string FileUUID = 5; // which file does this chunk belongs to 11 | } 12 | 13 | message File { 14 | string UUID = 1; // file uuid 15 | string file_name = 2; 16 | int64 size = 3; // file size 17 | int32 replica_num = 4; // how many replica do this file have 18 | int64 created_at = 5; 19 | int64 updated_at = 6; 20 | repeated Chunk chunks = 7; 21 | } 22 | 23 | message FileChunkData { 24 | bytes data = 1; // bytes it contains 25 | // msg it describe these data, may be file name, file uuid, chunk uuid, or something else. 26 | //depends on what it need 27 | string msg = 2; 28 | } 29 | 30 | message ReadFileRequest { 31 | string FileUUID = 1; 32 | } 33 | 34 | message GenericResponse { 35 | int64 code = 1; 36 | string msg = 2; 37 | } 38 | 39 | message CreateFileResponse { 40 | int64 code = 1; 41 | string msg = 2; 42 | File file = 3; 43 | } 44 | 45 | service ChunkServer { 46 | rpc CreateFile(stream FileChunkData) returns (CreateFileResponse) {} 47 | rpc RemoveFile(File) returns (GenericResponse) {} 48 | rpc ReadFile(ReadFileRequest) returns (stream FileChunkData) {} 49 | rpc CreateChunk(FileChunkData) returns (GenericResponse) {} 50 | } 51 | -------------------------------------------------------------------------------- /pkg/config/config.go: -------------------------------------------------------------------------------- 1 | package config 2 | 3 | import ( 4 | "os" 5 | "strconv" 6 | "strings" 7 | ) 8 | 9 | // configurations 10 | var ( 11 | GRPCAddr = "127.0.0.1:8899" 12 | ChunkServerName = "hfs-chunk" 13 | ChunkServerAddr = "127.0.0.1:8899" 14 | ChunkSize = 1024 * 1024 * 64 // 64M 15 | GRPCMaxMsgSize = ChunkSize + 4096 // 64M + 4K 16 | 17 | EtcdEndpoints = []string{"127.0.0.1:2379"} 18 | 19 | FileBasePath = "/hfs/files/" 20 | ChunkBasePath = "/hfs/chunks/" 21 | WorkerBasePath = "/hfs/workers/" 22 | 23 | ReplicaNum = 3 24 | ) 25 | 26 | // Config contains configurations, it will read from process environment, rewrite it with 27 | // values in process environment 28 | func init() { 29 | if v := os.Getenv("GRPCAddr"); v != "" { 30 | GRPCAddr = v 31 | } 32 | if v := os.Getenv("ChunkServerName"); v != "" { 33 | ChunkServerName = v 34 | } 35 | if v := os.Getenv("ChunkServerAddr"); v != "" { 36 | ChunkServerAddr = v 37 | } 38 | if v := os.Getenv("EtcdEndpoints"); v != "" { 39 | EtcdEndpoints = strings.Split(v, ",") 40 | } 41 | if v := os.Getenv("FileBasePath"); v != "" { 42 | FileBasePath = v 43 | } 44 | if v := os.Getenv("ChunkBasePath"); v != "" { 45 | ChunkBasePath = v 46 | } 47 | if v := os.Getenv("WorkerBasePath"); v != "" { 48 | WorkerBasePath = v 49 | } 50 | if v := os.Getenv("ReplicaNum"); v != "" { 51 | ReplicaNum, _ = strconv.Atoi(v) 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /pkg/config/config_test.go: -------------------------------------------------------------------------------- 1 | package config 2 | 3 | import ( 4 | "testing" 5 | ) 6 | 7 | func TestConfig(t *testing.T) { 8 | if GRPCAddr != "127.0.0.1:8899" { 9 | t.Fatalf("default GRPCAddr should be 127.0.0.1:8899") 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /pkg/files/files.go: -------------------------------------------------------------------------------- 1 | package files 2 | 3 | import ( 4 | "errors" 5 | "io" 6 | "os" 7 | "strings" 8 | 9 | "github.com/jiajunhuang/hfs/pkg/logger" 10 | ) 11 | 12 | // error definitions 13 | var ( 14 | ErrWriteFailed = errors.New("failed to write same length bytes as read") 15 | ) 16 | 17 | // Create create a file at path, with all the directory 18 | // same as mkdir -p && touch 19 | func Create(path string) (*os.File, error) { 20 | paths := strings.Split(path, "/") 21 | 22 | dirPath := strings.Join(paths[:len(paths)-1], "/") 23 | os.MkdirAll(dirPath, 0700) 24 | 25 | logger.Sugar.Debugf("create file: %s", path) 26 | return os.Create(path) 27 | } 28 | 29 | // Remove remove file in the given path 30 | func Remove(path string) error { 31 | logger.Sugar.Debugf("remove file: %s", path) 32 | return os.Remove(path) 33 | } 34 | 35 | // Append read bytes from r, append it to given file in path 36 | func Append(path string, r io.Reader) error { 37 | logger.Sugar.Debugf("append file: %s", path) 38 | 39 | f, err := os.OpenFile(path, os.O_RDWR|os.O_CREATE|os.O_APPEND, 0600) 40 | if err != nil { 41 | return err 42 | } 43 | defer f.Close() 44 | 45 | bufSize := 1024 46 | buf := make([]byte, bufSize) 47 | 48 | for { 49 | n, err := r.Read(buf) 50 | if err == io.EOF { 51 | break 52 | } 53 | nw, e := f.Write(buf[:n]) 54 | logger.Sugar.Debugf("Append: read %d bytes, write %d bytes, read err: %s, write err: %s", n, nw, err, e) 55 | if e != nil { 56 | return e 57 | } 58 | } 59 | 60 | return nil 61 | } 62 | -------------------------------------------------------------------------------- /pkg/files/files_test.go: -------------------------------------------------------------------------------- 1 | package files 2 | 3 | import ( 4 | "io/ioutil" 5 | "os" 6 | "strings" 7 | "testing" 8 | ) 9 | 10 | func TestCreate(t *testing.T) { 11 | path := "./test/hello/world" 12 | defer os.RemoveAll("./test/") 13 | 14 | f, err := Create(path) 15 | if err != nil { 16 | t.Errorf("failed to create file: %s", err) 17 | } 18 | f.Close() 19 | 20 | f, err = os.Open(path) 21 | if err != nil { 22 | t.Errorf("failed to open file: %s", err) 23 | } 24 | f.Close() 25 | } 26 | 27 | func TestRemove(t *testing.T) { 28 | path := "./test/hello/world" 29 | defer os.RemoveAll("./test/") 30 | 31 | f, err := Create(path) 32 | if err != nil { 33 | t.Errorf("failed to create file: %s", err) 34 | } 35 | f.Close() 36 | 37 | err = Remove(path) 38 | if err != nil { 39 | t.Fatalf("failed to remove file: %s", err) 40 | } 41 | 42 | f, err = os.Open(path) 43 | defer f.Close() 44 | 45 | if err == nil { 46 | t.Errorf("should failed to open file but not") 47 | } 48 | } 49 | 50 | func TestAppend(t *testing.T) { 51 | // if file not exist 52 | path := "./world" 53 | data := "hello" 54 | defer os.Remove(path) 55 | 56 | Append(path, strings.NewReader(data)) 57 | 58 | if b, err := ioutil.ReadFile(path); err != nil { 59 | t.Fatalf("should read file %s success but got error: %s", path, err) 60 | } else { 61 | if string(b) != data { 62 | t.Fatalf("bytes from file %s(%s) not equal to content %s", path, b, data) 63 | } 64 | } 65 | 66 | // append 67 | Append(path, strings.NewReader("world")) 68 | if b, err := ioutil.ReadFile(path); err != nil { 69 | t.Fatalf("should read file %s success but got error: %s", path, err) 70 | } else { 71 | if string(b) != "helloworld" { 72 | t.Fatalf("bytes from file %s(%s) not equal to content %s", path, b, data) 73 | } 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /pkg/logger/logger.go: -------------------------------------------------------------------------------- 1 | package logger 2 | 3 | import ( 4 | "go.uber.org/zap" 5 | ) 6 | 7 | // global logger, remember call `defer Logger.Sync()` in `main` function 8 | var ( 9 | Logger, _ = zap.NewProduction() 10 | Sugar = Logger.Sugar() 11 | ) 12 | -------------------------------------------------------------------------------- /pkg/selection/selection.go: -------------------------------------------------------------------------------- 1 | package selection 2 | 3 | import ( 4 | "math/rand" 5 | ) 6 | 7 | /* 8 | package selection provide chunk selection algorithms. 9 | */ 10 | 11 | // Random random select min(len(avalable), num) elems in avalable and return 12 | func Random(avalable []string, itself string, num int32) []string { 13 | if num <= 1 { 14 | return []string{} 15 | } 16 | 17 | last := len(avalable) - 1 18 | for i, a := range avalable { 19 | if a == itself { 20 | avalable[i], avalable[last] = avalable[last], avalable[i] // swap 21 | avalable = avalable[:last] // ignore itself 22 | break 23 | } 24 | } 25 | 26 | // shuffle 27 | rand.Shuffle(len(avalable), func(i, j int) { 28 | avalable[i], avalable[j] = avalable[j], avalable[i] 29 | }) 30 | 31 | min := int(num) 32 | if len(avalable) < min { 33 | min = len(avalable) 34 | } 35 | 36 | return avalable[:min] 37 | } 38 | -------------------------------------------------------------------------------- /pkg/selection/selection_test.go: -------------------------------------------------------------------------------- 1 | package selection 2 | 3 | import ( 4 | "testing" 5 | ) 6 | 7 | func TestRandomSelection(t *testing.T) { 8 | itself := "192.168.1.2" 9 | avalable := []string{"192.168.1.1", itself, "192.168.1.3", "192.168.1.4"} 10 | 11 | if len(Random(avalable, itself, 0)) != 0 { 12 | t.Fatalf("should not get any node return") 13 | } 14 | 15 | if len(Random(avalable, itself, 1)) != 0 { 16 | t.Fatalf("should not get any node return") 17 | } 18 | 19 | var result []string 20 | result = Random(avalable, itself, 2) 21 | for _, r := range result { 22 | if r == itself { 23 | t.Fatalf("should not select itself") 24 | } 25 | } 26 | 27 | result = Random(avalable, itself, 3) 28 | for _, r := range result { 29 | if r == itself { 30 | t.Fatalf("should not select itself") 31 | } 32 | } 33 | 34 | result = Random(avalable, itself, 4) 35 | for _, r := range result { 36 | if r == itself { 37 | t.Fatalf("should not select itself") 38 | } 39 | } 40 | 41 | result = Random(avalable, itself, 5) 42 | if len(result) != 3 { 43 | t.Fatalf("result should be 3 elems, but got: %s", result) 44 | } 45 | for _, r := range result { 46 | if r == itself { 47 | t.Fatalf("should not select itself") 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /vendor/github.com/coreos/etcd/Documentation/README.md: -------------------------------------------------------------------------------- 1 | docs.md -------------------------------------------------------------------------------- /vendor/github.com/coreos/etcd/NOTICE: -------------------------------------------------------------------------------- 1 | CoreOS Project 2 | Copyright 2014 CoreOS, Inc 3 | 4 | This product includes software developed at CoreOS, Inc. 5 | (http://www.coreos.com/). 6 | -------------------------------------------------------------------------------- /vendor/github.com/coreos/etcd/auth/authpb/auth.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | package authpb; 3 | 4 | import "gogoproto/gogo.proto"; 5 | 6 | option (gogoproto.marshaler_all) = true; 7 | option (gogoproto.sizer_all) = true; 8 | option (gogoproto.unmarshaler_all) = true; 9 | option (gogoproto.goproto_getters_all) = false; 10 | option (gogoproto.goproto_enum_prefix_all) = false; 11 | 12 | // User is a single entry in the bucket authUsers 13 | message User { 14 | bytes name = 1; 15 | bytes password = 2; 16 | repeated string roles = 3; 17 | } 18 | 19 | // Permission is a single entity 20 | message Permission { 21 | enum Type { 22 | READ = 0; 23 | WRITE = 1; 24 | READWRITE = 2; 25 | } 26 | Type permType = 1; 27 | 28 | bytes key = 2; 29 | bytes range_end = 3; 30 | } 31 | 32 | // Role is a single entry in the bucket authRoles 33 | message Role { 34 | bytes name = 1; 35 | 36 | repeated Permission keyPermission = 2; 37 | } 38 | -------------------------------------------------------------------------------- /vendor/github.com/coreos/etcd/clientv3/compact_op.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The etcd Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package clientv3 16 | 17 | import ( 18 | pb "github.com/coreos/etcd/etcdserver/etcdserverpb" 19 | ) 20 | 21 | // CompactOp represents a compact operation. 22 | type CompactOp struct { 23 | revision int64 24 | physical bool 25 | } 26 | 27 | // CompactOption configures compact operation. 28 | type CompactOption func(*CompactOp) 29 | 30 | func (op *CompactOp) applyCompactOpts(opts []CompactOption) { 31 | for _, opt := range opts { 32 | opt(op) 33 | } 34 | } 35 | 36 | // OpCompact wraps slice CompactOption to create a CompactOp. 37 | func OpCompact(rev int64, opts ...CompactOption) CompactOp { 38 | ret := CompactOp{revision: rev} 39 | ret.applyCompactOpts(opts) 40 | return ret 41 | } 42 | 43 | func (op CompactOp) toRequest() *pb.CompactionRequest { 44 | return &pb.CompactionRequest{Revision: op.revision, Physical: op.physical} 45 | } 46 | 47 | // WithCompactPhysical makes Compact wait until all compacted entries are 48 | // removed from the etcd server's storage. 49 | func WithCompactPhysical() CompactOption { 50 | return func(op *CompactOp) { op.physical = true } 51 | } 52 | -------------------------------------------------------------------------------- /vendor/github.com/coreos/etcd/clientv3/options.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The etcd Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package clientv3 16 | 17 | import ( 18 | "math" 19 | 20 | "google.golang.org/grpc" 21 | ) 22 | 23 | var ( 24 | // Disable gRPC internal retrial logic 25 | // TODO: enable when gRPC retry is stable (FailFast=false) 26 | // Reference: 27 | // - https://github.com/grpc/grpc-go/issues/1532 28 | // - https://github.com/grpc/proposal/blob/master/A6-client-retries.md 29 | defaultFailFast = grpc.FailFast(true) 30 | 31 | // client-side request send limit, gRPC default is math.MaxInt32 32 | // Make sure that "client-side send limit < server-side default send/recv limit" 33 | // Same value as "embed.DefaultMaxRequestBytes" plus gRPC overhead bytes 34 | defaultMaxCallSendMsgSize = grpc.MaxCallSendMsgSize(2 * 1024 * 1024) 35 | 36 | // client-side response receive limit, gRPC default is 4MB 37 | // Make sure that "client-side receive limit >= server-side default send/recv limit" 38 | // because range response can easily exceed request send limits 39 | // Default to math.MaxInt32; writes exceeding server-side send limit fails anyway 40 | defaultMaxCallRecvMsgSize = grpc.MaxCallRecvMsgSize(math.MaxInt32) 41 | ) 42 | 43 | // defaultCallOpts defines a list of default "gRPC.CallOption". 44 | // Some options are exposed to "clientv3.Config". 45 | // Defaults will be overridden by the settings in "clientv3.Config". 46 | var defaultCallOpts = []grpc.CallOption{defaultFailFast, defaultMaxCallSendMsgSize, defaultMaxCallRecvMsgSize} 47 | 48 | // MaxLeaseTTL is the maximum lease TTL value 49 | const MaxLeaseTTL = 9000000000 50 | -------------------------------------------------------------------------------- /vendor/github.com/coreos/etcd/clientv3/ready_wait.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The etcd Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package clientv3 16 | 17 | import "context" 18 | 19 | // TODO: remove this when "FailFast=false" is fixed. 20 | // See https://github.com/grpc/grpc-go/issues/1532. 21 | func readyWait(rpcCtx, clientCtx context.Context, ready <-chan struct{}) error { 22 | select { 23 | case <-ready: 24 | return nil 25 | case <-rpcCtx.Done(): 26 | return rpcCtx.Err() 27 | case <-clientCtx.Done(): 28 | return clientCtx.Err() 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /vendor/github.com/coreos/etcd/clientv3/sort.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The etcd Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package clientv3 16 | 17 | type SortTarget int 18 | type SortOrder int 19 | 20 | const ( 21 | SortNone SortOrder = iota 22 | SortAscend 23 | SortDescend 24 | ) 25 | 26 | const ( 27 | SortByKey SortTarget = iota 28 | SortByVersion 29 | SortByCreateRevision 30 | SortByModRevision 31 | SortByValue 32 | ) 33 | 34 | type SortOption struct { 35 | Target SortTarget 36 | Order SortOrder 37 | } 38 | -------------------------------------------------------------------------------- /vendor/github.com/coreos/etcd/cmd/etcd: -------------------------------------------------------------------------------- 1 | ../ -------------------------------------------------------------------------------- /vendor/github.com/coreos/etcd/cmd/etcdctl: -------------------------------------------------------------------------------- 1 | ../etcdctl -------------------------------------------------------------------------------- /vendor/github.com/coreos/etcd/cmd/functional: -------------------------------------------------------------------------------- 1 | ../functional -------------------------------------------------------------------------------- /vendor/github.com/coreos/etcd/cmd/tools: -------------------------------------------------------------------------------- 1 | ../tools -------------------------------------------------------------------------------- /vendor/github.com/coreos/etcd/etcdserver/api/v3rpc/rpctypes/doc.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The etcd Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | // Package rpctypes has types and values shared by the etcd server and client for v3 RPC interaction. 16 | package rpctypes 17 | -------------------------------------------------------------------------------- /vendor/github.com/coreos/etcd/etcdserver/api/v3rpc/rpctypes/md.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The etcd Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package rpctypes 16 | 17 | var ( 18 | MetadataRequireLeaderKey = "hasleader" 19 | MetadataHasLeader = "true" 20 | ) 21 | -------------------------------------------------------------------------------- /vendor/github.com/coreos/etcd/etcdserver/etcdserverpb/etcdserver.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto2"; 2 | package etcdserverpb; 3 | 4 | import "gogoproto/gogo.proto"; 5 | 6 | option (gogoproto.marshaler_all) = true; 7 | option (gogoproto.sizer_all) = true; 8 | option (gogoproto.unmarshaler_all) = true; 9 | option (gogoproto.goproto_getters_all) = false; 10 | 11 | message Request { 12 | optional uint64 ID = 1 [(gogoproto.nullable) = false]; 13 | optional string Method = 2 [(gogoproto.nullable) = false]; 14 | optional string Path = 3 [(gogoproto.nullable) = false]; 15 | optional string Val = 4 [(gogoproto.nullable) = false]; 16 | optional bool Dir = 5 [(gogoproto.nullable) = false]; 17 | optional string PrevValue = 6 [(gogoproto.nullable) = false]; 18 | optional uint64 PrevIndex = 7 [(gogoproto.nullable) = false]; 19 | optional bool PrevExist = 8 [(gogoproto.nullable) = true]; 20 | optional int64 Expiration = 9 [(gogoproto.nullable) = false]; 21 | optional bool Wait = 10 [(gogoproto.nullable) = false]; 22 | optional uint64 Since = 11 [(gogoproto.nullable) = false]; 23 | optional bool Recursive = 12 [(gogoproto.nullable) = false]; 24 | optional bool Sorted = 13 [(gogoproto.nullable) = false]; 25 | optional bool Quorum = 14 [(gogoproto.nullable) = false]; 26 | optional int64 Time = 15 [(gogoproto.nullable) = false]; 27 | optional bool Stream = 16 [(gogoproto.nullable) = false]; 28 | optional bool Refresh = 17 [(gogoproto.nullable) = true]; 29 | } 30 | 31 | message Metadata { 32 | optional uint64 NodeID = 1 [(gogoproto.nullable) = false]; 33 | optional uint64 ClusterID = 2 [(gogoproto.nullable) = false]; 34 | } 35 | -------------------------------------------------------------------------------- /vendor/github.com/coreos/etcd/mvcc/mvccpb/kv.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | package mvccpb; 3 | 4 | import "gogoproto/gogo.proto"; 5 | 6 | option (gogoproto.marshaler_all) = true; 7 | option (gogoproto.sizer_all) = true; 8 | option (gogoproto.unmarshaler_all) = true; 9 | option (gogoproto.goproto_getters_all) = false; 10 | option (gogoproto.goproto_enum_prefix_all) = false; 11 | 12 | message KeyValue { 13 | // key is the key in bytes. An empty key is not allowed. 14 | bytes key = 1; 15 | // create_revision is the revision of last creation on this key. 16 | int64 create_revision = 2; 17 | // mod_revision is the revision of last modification on this key. 18 | int64 mod_revision = 3; 19 | // version is the version of the key. A deletion resets 20 | // the version to zero and any modification of the key 21 | // increases its version. 22 | int64 version = 4; 23 | // value is the value held by the key, in bytes. 24 | bytes value = 5; 25 | // lease is the ID of the lease that attached to key. 26 | // When the attached lease expires, the key will be deleted. 27 | // If lease is 0, then no lease is attached to the key. 28 | int64 lease = 6; 29 | } 30 | 31 | message Event { 32 | enum EventType { 33 | PUT = 0; 34 | DELETE = 1; 35 | } 36 | // type is the kind of event. If type is a PUT, it indicates 37 | // new data has been stored to the key. If type is a DELETE, 38 | // it indicates the key was deleted. 39 | EventType type = 1; 40 | // kv holds the KeyValue for the event. 41 | // A PUT event contains current kv pair. 42 | // A PUT event with kv.Version=1 indicates the creation of a key. 43 | // A DELETE/EXPIRE event contains the deleted key with 44 | // its modification revision set to the revision of deletion. 45 | KeyValue kv = 2; 46 | 47 | // prev_kv holds the key-value pair before the event happens. 48 | KeyValue prev_kv = 3; 49 | } 50 | -------------------------------------------------------------------------------- /vendor/github.com/coreos/etcd/pkg/types/doc.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The etcd Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | // Package types declares various data types and implements type-checking 16 | // functions. 17 | package types 18 | -------------------------------------------------------------------------------- /vendor/github.com/coreos/etcd/pkg/types/id.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The etcd Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package types 16 | 17 | import ( 18 | "strconv" 19 | ) 20 | 21 | // ID represents a generic identifier which is canonically 22 | // stored as a uint64 but is typically represented as a 23 | // base-16 string for input/output 24 | type ID uint64 25 | 26 | func (i ID) String() string { 27 | return strconv.FormatUint(uint64(i), 16) 28 | } 29 | 30 | // IDFromString attempts to create an ID from a base-16 string. 31 | func IDFromString(s string) (ID, error) { 32 | i, err := strconv.ParseUint(s, 16, 64) 33 | return ID(i), err 34 | } 35 | 36 | // IDSlice implements the sort interface 37 | type IDSlice []ID 38 | 39 | func (p IDSlice) Len() int { return len(p) } 40 | func (p IDSlice) Less(i, j int) bool { return uint64(p[i]) < uint64(p[j]) } 41 | func (p IDSlice) Swap(i, j int) { p[i], p[j] = p[j], p[i] } 42 | -------------------------------------------------------------------------------- /vendor/github.com/coreos/etcd/pkg/types/slice.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The etcd Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package types 16 | 17 | // Uint64Slice implements sort interface 18 | type Uint64Slice []uint64 19 | 20 | func (p Uint64Slice) Len() int { return len(p) } 21 | func (p Uint64Slice) Less(i, j int) bool { return p[i] < p[j] } 22 | func (p Uint64Slice) Swap(i, j int) { p[i], p[j] = p[j], p[i] } 23 | -------------------------------------------------------------------------------- /vendor/github.com/coreos/etcd/pkg/types/urls.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The etcd Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package types 16 | 17 | import ( 18 | "errors" 19 | "fmt" 20 | "net" 21 | "net/url" 22 | "sort" 23 | "strings" 24 | ) 25 | 26 | type URLs []url.URL 27 | 28 | func NewURLs(strs []string) (URLs, error) { 29 | all := make([]url.URL, len(strs)) 30 | if len(all) == 0 { 31 | return nil, errors.New("no valid URLs given") 32 | } 33 | for i, in := range strs { 34 | in = strings.TrimSpace(in) 35 | u, err := url.Parse(in) 36 | if err != nil { 37 | return nil, err 38 | } 39 | if u.Scheme != "http" && u.Scheme != "https" && u.Scheme != "unix" && u.Scheme != "unixs" { 40 | return nil, fmt.Errorf("URL scheme must be http, https, unix, or unixs: %s", in) 41 | } 42 | if _, _, err := net.SplitHostPort(u.Host); err != nil { 43 | return nil, fmt.Errorf(`URL address does not have the form "host:port": %s`, in) 44 | } 45 | if u.Path != "" { 46 | return nil, fmt.Errorf("URL must not contain a path: %s", in) 47 | } 48 | all[i] = *u 49 | } 50 | us := URLs(all) 51 | us.Sort() 52 | 53 | return us, nil 54 | } 55 | 56 | func MustNewURLs(strs []string) URLs { 57 | urls, err := NewURLs(strs) 58 | if err != nil { 59 | panic(err) 60 | } 61 | return urls 62 | } 63 | 64 | func (us URLs) String() string { 65 | return strings.Join(us.StringSlice(), ",") 66 | } 67 | 68 | func (us *URLs) Sort() { 69 | sort.Sort(us) 70 | } 71 | func (us URLs) Len() int { return len(us) } 72 | func (us URLs) Less(i, j int) bool { return us[i].String() < us[j].String() } 73 | func (us URLs) Swap(i, j int) { us[i], us[j] = us[j], us[i] } 74 | 75 | func (us URLs) StringSlice() []string { 76 | out := make([]string, len(us)) 77 | for i := range us { 78 | out[i] = us[i].String() 79 | } 80 | 81 | return out 82 | } 83 | -------------------------------------------------------------------------------- /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/gogo/protobuf/CONTRIBUTORS: -------------------------------------------------------------------------------- 1 | Anton Povarov 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/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/gogo/protobuf/LICENSE: -------------------------------------------------------------------------------- 1 | Protocol Buffers for Go with Gadgets 2 | 3 | Copyright (c) 2013, The GoGo Authors. All rights reserved. 4 | http://github.com/gogo/protobuf 5 | 6 | Go support for Protocol Buffers - Google's data interchange format 7 | 8 | Copyright 2010 The Go Authors. All rights reserved. 9 | https://github.com/golang/protobuf 10 | 11 | Redistribution and use in source and binary forms, with or without 12 | modification, are permitted provided that the following conditions are 13 | met: 14 | 15 | * Redistributions of source code must retain the above copyright 16 | notice, this list of conditions and the following disclaimer. 17 | * Redistributions in binary form must reproduce the above 18 | copyright notice, this list of conditions and the following disclaimer 19 | in the documentation and/or other materials provided with the 20 | distribution. 21 | * Neither the name of Google Inc. nor the names of its 22 | contributors may be used to endorse or promote products derived from 23 | this software without specific prior written permission. 24 | 25 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 26 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 27 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 28 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 29 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 30 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 31 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 32 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 33 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 34 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 35 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 36 | 37 | -------------------------------------------------------------------------------- /vendor/github.com/gogo/protobuf/gogoproto/Makefile: -------------------------------------------------------------------------------- 1 | # Protocol Buffers for Go with Gadgets 2 | # 3 | # Copyright (c) 2013, The GoGo Authors. All rights reserved. 4 | # http://github.com/gogo/protobuf 5 | # 6 | # Redistribution and use in source and binary forms, with or without 7 | # modification, are permitted provided that the following conditions are 8 | # met: 9 | # 10 | # * Redistributions of source code must retain the above copyright 11 | # notice, this list of conditions and the following disclaimer. 12 | # * Redistributions in binary form must reproduce the above 13 | # copyright notice, this list of conditions and the following disclaimer 14 | # in the documentation and/or other materials provided with the 15 | # distribution. 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 | 29 | regenerate: 30 | go install github.com/gogo/protobuf/protoc-gen-gogo 31 | protoc --gogo_out=Mgoogle/protobuf/descriptor.proto=github.com/gogo/protobuf/protoc-gen-gogo/descriptor:../../../../ --proto_path=../../../../:../protobuf/:. *.proto 32 | 33 | restore: 34 | cp gogo.pb.golden gogo.pb.go 35 | 36 | preserve: 37 | cp gogo.pb.go gogo.pb.golden 38 | -------------------------------------------------------------------------------- /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/github.com/gogo/protobuf/proto/Makefile: -------------------------------------------------------------------------------- 1 | # Go support for Protocol Buffers - Google's data interchange format 2 | # 3 | # Copyright 2010 The Go Authors. All rights reserved. 4 | # https://github.com/golang/protobuf 5 | # 6 | # Redistribution and use in source and binary forms, with or without 7 | # modification, are permitted provided that the following conditions are 8 | # met: 9 | # 10 | # * Redistributions of source code must retain the above copyright 11 | # notice, this list of conditions and the following disclaimer. 12 | # * Redistributions in binary form must reproduce the above 13 | # copyright notice, this list of conditions and the following disclaimer 14 | # in the documentation and/or other materials provided with the 15 | # distribution. 16 | # * Neither the name of Google Inc. nor the names of its 17 | # contributors may be used to endorse or promote products derived from 18 | # this software without specific prior written permission. 19 | # 20 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 23 | # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 24 | # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 25 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 26 | # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 30 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | 32 | install: 33 | go install 34 | 35 | test: install generate-test-pbs 36 | go test 37 | 38 | 39 | generate-test-pbs: 40 | make install 41 | make -C testdata 42 | protoc-min-version --version="3.0.0" --proto_path=.:../../../../:../protobuf --gogo_out=Mtestdata/test.proto=github.com/gogo/protobuf/proto/testdata,Mgoogle/protobuf/any.proto=github.com/gogo/protobuf/types:. proto3_proto/proto3.proto 43 | make 44 | -------------------------------------------------------------------------------- /vendor/github.com/gogo/protobuf/proto/lib_gogo.go: -------------------------------------------------------------------------------- 1 | // Protocol Buffers for Go with Gadgets 2 | // 3 | // Copyright (c) 2013, The GoGo Authors. All rights reserved. 4 | // http://github.com/gogo/protobuf 5 | // 6 | // Redistribution and use in source and binary forms, with or without 7 | // modification, are permitted provided that the following conditions are 8 | // met: 9 | // 10 | // * Redistributions of source code must retain the above copyright 11 | // notice, this list of conditions and the following disclaimer. 12 | // * Redistributions in binary form must reproduce the above 13 | // copyright notice, this list of conditions and the following disclaimer 14 | // in the documentation and/or other materials provided with the 15 | // distribution. 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 | 29 | package proto 30 | 31 | import ( 32 | "encoding/json" 33 | "strconv" 34 | ) 35 | 36 | func MarshalJSONEnum(m map[int32]string, value int32) ([]byte, error) { 37 | s, ok := m[value] 38 | if !ok { 39 | s = strconv.Itoa(int(value)) 40 | } 41 | return json.Marshal(s) 42 | } 43 | -------------------------------------------------------------------------------- /vendor/github.com/gogo/protobuf/proto/text_gogo.go: -------------------------------------------------------------------------------- 1 | // Protocol Buffers for Go with Gadgets 2 | // 3 | // Copyright (c) 2013, The GoGo Authors. All rights reserved. 4 | // http://github.com/gogo/protobuf 5 | // 6 | // Redistribution and use in source and binary forms, with or without 7 | // modification, are permitted provided that the following conditions are 8 | // met: 9 | // 10 | // * Redistributions of source code must retain the above copyright 11 | // notice, this list of conditions and the following disclaimer. 12 | // * Redistributions in binary form must reproduce the above 13 | // copyright notice, this list of conditions and the following disclaimer 14 | // in the documentation and/or other materials provided with the 15 | // distribution. 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 | 29 | package proto 30 | 31 | import ( 32 | "fmt" 33 | "reflect" 34 | ) 35 | 36 | func (tm *TextMarshaler) writeEnum(w *textWriter, v reflect.Value, props *Properties) error { 37 | m, ok := enumStringMaps[props.Enum] 38 | if !ok { 39 | if err := tm.writeAny(w, v, props); err != nil { 40 | return err 41 | } 42 | } 43 | key := int32(0) 44 | if v.Kind() == reflect.Ptr { 45 | key = int32(v.Elem().Int()) 46 | } else { 47 | key = int32(v.Int()) 48 | } 49 | s, ok := m[key] 50 | if !ok { 51 | if err := tm.writeAny(w, v, props); err != nil { 52 | return err 53 | } 54 | } 55 | _, err := fmt.Fprint(w, s) 56 | return err 57 | } 58 | -------------------------------------------------------------------------------- /vendor/github.com/gogo/protobuf/protoc-gen-gogo/descriptor/Makefile: -------------------------------------------------------------------------------- 1 | # Go support for Protocol Buffers - Google's data interchange format 2 | # 3 | # Copyright 2010 The Go Authors. All rights reserved. 4 | # https://github.com/golang/protobuf 5 | # 6 | # Redistribution and use in source and binary forms, with or without 7 | # modification, are permitted provided that the following conditions are 8 | # met: 9 | # 10 | # * Redistributions of source code must retain the above copyright 11 | # notice, this list of conditions and the following disclaimer. 12 | # * Redistributions in binary form must reproduce the above 13 | # copyright notice, this list of conditions and the following disclaimer 14 | # in the documentation and/or other materials provided with the 15 | # distribution. 16 | # * Neither the name of Google Inc. nor the names of its 17 | # contributors may be used to endorse or promote products derived from 18 | # this software without specific prior written permission. 19 | # 20 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 23 | # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 24 | # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 25 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 26 | # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 30 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | 32 | regenerate: 33 | go install github.com/gogo/protobuf/protoc-gen-gogo 34 | go install github.com/gogo/protobuf/protoc-gen-gostring 35 | protoc --gogo_out=. -I=../../protobuf/google/protobuf ../../protobuf/google/protobuf/descriptor.proto 36 | protoc --gostring_out=. -I=../../protobuf/google/protobuf ../../protobuf/google/protobuf/descriptor.proto 37 | -------------------------------------------------------------------------------- /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/golang/protobuf/LICENSE: -------------------------------------------------------------------------------- 1 | Go support for Protocol Buffers - Google's data interchange format 2 | 3 | Copyright 2010 The Go Authors. All rights reserved. 4 | https://github.com/golang/protobuf 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions are 8 | met: 9 | 10 | * Redistributions of source code must retain the above copyright 11 | notice, this list of conditions and the following disclaimer. 12 | * Redistributions in binary form must reproduce the above 13 | copyright notice, this list of conditions and the following disclaimer 14 | in the documentation and/or other materials provided with the 15 | distribution. 16 | * Neither the name of Google Inc. nor the names of its 17 | contributors may be used to endorse or promote products derived from 18 | this software without specific prior written permission. 19 | 20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 23 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 24 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 25 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 26 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 30 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | 32 | -------------------------------------------------------------------------------- /vendor/github.com/golang/protobuf/ptypes/doc.go: -------------------------------------------------------------------------------- 1 | // Go support for Protocol Buffers - Google's data interchange format 2 | // 3 | // Copyright 2016 The Go Authors. All rights reserved. 4 | // https://github.com/golang/protobuf 5 | // 6 | // Redistribution and use in source and binary forms, with or without 7 | // modification, are permitted provided that the following conditions are 8 | // met: 9 | // 10 | // * Redistributions of source code must retain the above copyright 11 | // notice, this list of conditions and the following disclaimer. 12 | // * Redistributions in binary form must reproduce the above 13 | // copyright notice, this list of conditions and the following disclaimer 14 | // in the documentation and/or other materials provided with the 15 | // distribution. 16 | // * Neither the name of Google Inc. nor the names of its 17 | // contributors may be used to endorse or promote products derived from 18 | // this software without specific prior written permission. 19 | // 20 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 23 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 24 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 25 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 26 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 30 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | 32 | /* 33 | Package ptypes contains code for interacting with well-known types. 34 | */ 35 | package ptypes 36 | -------------------------------------------------------------------------------- /vendor/github.com/google/uuid/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | 3 | go: 4 | - 1.4.3 5 | - 1.5.3 6 | - tip 7 | 8 | script: 9 | - go test -v ./... 10 | -------------------------------------------------------------------------------- /vendor/github.com/google/uuid/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # How to contribute 2 | 3 | We definitely welcome patches and contribution to this project! 4 | 5 | ### Legal requirements 6 | 7 | In order to protect both you and ourselves, you will need to sign the 8 | [Contributor License Agreement](https://cla.developers.google.com/clas). 9 | 10 | You may have already signed it for other Google projects. 11 | -------------------------------------------------------------------------------- /vendor/github.com/google/uuid/CONTRIBUTORS: -------------------------------------------------------------------------------- 1 | Paul Borman 2 | bmatsuo 3 | shawnps 4 | theory 5 | jboverfelt 6 | dsymonds 7 | cd1 8 | wallclockbuilder 9 | dansouza 10 | -------------------------------------------------------------------------------- /vendor/github.com/google/uuid/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2009,2014 Google Inc. All rights reserved. 2 | 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions are 5 | met: 6 | 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above 10 | copyright notice, this list of conditions and the following disclaimer 11 | in the documentation and/or other materials provided with the 12 | distribution. 13 | * Neither the name of Google Inc. nor the names of its 14 | contributors may be used to endorse or promote products derived from 15 | this software without specific prior written permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | -------------------------------------------------------------------------------- /vendor/github.com/google/uuid/README.md: -------------------------------------------------------------------------------- 1 | **This package is currently in development and the API may not be stable.** 2 | 3 | The API will become stable with v1. 4 | 5 | # uuid ![build status](https://travis-ci.org/google/uuid.svg?branch=master) 6 | The uuid package generates and inspects UUIDs based on 7 | [RFC 4122](http://tools.ietf.org/html/rfc4122) 8 | and DCE 1.1: Authentication and Security Services. 9 | 10 | This package is based on the github.com/pborman/uuid package (previously named 11 | code.google.com/p/go-uuid). It differs from these earlier packages in that 12 | a UUID is a 16 byte array rather than a byte slice. One loss due to this 13 | change is the ability to represent an invalid UUID (vs a NIL UUID). 14 | 15 | ###### Install 16 | `go get github.com/google/uuid` 17 | 18 | ###### Documentation 19 | [![GoDoc](https://godoc.org/github.com/google/uuid?status.svg)](http://godoc.org/github.com/google/uuid) 20 | 21 | Full `go doc` style documentation for the package can be viewed online without 22 | installing this package by using the GoDoc site here: 23 | http://godoc.org/github.com/google/uuid 24 | -------------------------------------------------------------------------------- /vendor/github.com/google/uuid/dce.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 Google Inc. All rights reserved. 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 uuid 6 | 7 | import ( 8 | "encoding/binary" 9 | "fmt" 10 | "os" 11 | ) 12 | 13 | // A Domain represents a Version 2 domain 14 | type Domain byte 15 | 16 | // Domain constants for DCE Security (Version 2) UUIDs. 17 | const ( 18 | Person = Domain(0) 19 | Group = Domain(1) 20 | Org = Domain(2) 21 | ) 22 | 23 | // NewDCESecurity returns a DCE Security (Version 2) UUID. 24 | // 25 | // The domain should be one of Person, Group or Org. 26 | // On a POSIX system the id should be the users UID for the Person 27 | // domain and the users GID for the Group. The meaning of id for 28 | // the domain Org or on non-POSIX systems is site defined. 29 | // 30 | // For a given domain/id pair the same token may be returned for up to 31 | // 7 minutes and 10 seconds. 32 | func NewDCESecurity(domain Domain, id uint32) (UUID, error) { 33 | uuid, err := NewUUID() 34 | if err == nil { 35 | uuid[6] = (uuid[6] & 0x0f) | 0x20 // Version 2 36 | uuid[9] = byte(domain) 37 | binary.BigEndian.PutUint32(uuid[0:], id) 38 | } 39 | return uuid, err 40 | } 41 | 42 | // NewDCEPerson returns a DCE Security (Version 2) UUID in the person 43 | // domain with the id returned by os.Getuid. 44 | // 45 | // NewDCEPerson(Person, uint32(os.Getuid())) 46 | func NewDCEPerson() (UUID, error) { 47 | return NewDCESecurity(Person, uint32(os.Getuid())) 48 | } 49 | 50 | // NewDCEGroup returns a DCE Security (Version 2) UUID in the group 51 | // domain with the id returned by os.Getgid. 52 | // 53 | // NewDCEGroup(Group, uint32(os.Getgid())) 54 | func NewDCEGroup() (UUID, error) { 55 | return NewDCESecurity(Group, uint32(os.Getgid())) 56 | } 57 | 58 | // Domain returns the domain for a Version 2 UUID. Domains are only defined 59 | // for Version 2 UUIDs. 60 | func (uuid UUID) Domain() Domain { 61 | return Domain(uuid[9]) 62 | } 63 | 64 | // ID returns the id for a Version 2 UUID. IDs are only defined for Version 2 65 | // UUIDs. 66 | func (uuid UUID) ID() uint32 { 67 | return binary.BigEndian.Uint32(uuid[0:4]) 68 | } 69 | 70 | func (d Domain) String() string { 71 | switch d { 72 | case Person: 73 | return "Person" 74 | case Group: 75 | return "Group" 76 | case Org: 77 | return "Org" 78 | } 79 | return fmt.Sprintf("Domain%d", int(d)) 80 | } 81 | -------------------------------------------------------------------------------- /vendor/github.com/google/uuid/doc.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 Google Inc. All rights reserved. 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 uuid generates and inspects UUIDs. 6 | // 7 | // UUIDs are based on RFC 4122 and DCE 1.1: Authentication and Security 8 | // Services. 9 | // 10 | // A UUID is a 16 byte (128 bit) array. UUIDs may be used as keys to 11 | // maps or compared directly. 12 | package uuid 13 | -------------------------------------------------------------------------------- /vendor/github.com/google/uuid/hash.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 Google Inc. All rights reserved. 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 uuid 6 | 7 | import ( 8 | "crypto/md5" 9 | "crypto/sha1" 10 | "hash" 11 | ) 12 | 13 | // Well known namespace IDs and UUIDs 14 | var ( 15 | NameSpaceDNS = Must(Parse("6ba7b810-9dad-11d1-80b4-00c04fd430c8")) 16 | NameSpaceURL = Must(Parse("6ba7b811-9dad-11d1-80b4-00c04fd430c8")) 17 | NameSpaceOID = Must(Parse("6ba7b812-9dad-11d1-80b4-00c04fd430c8")) 18 | NameSpaceX500 = Must(Parse("6ba7b814-9dad-11d1-80b4-00c04fd430c8")) 19 | Nil UUID // empty UUID, all zeros 20 | ) 21 | 22 | // NewHash returns a new UUID derived from the hash of space concatenated with 23 | // data generated by h. The hash should be at least 16 byte in length. The 24 | // first 16 bytes of the hash are used to form the UUID. The version of the 25 | // UUID will be the lower 4 bits of version. NewHash is used to implement 26 | // NewMD5 and NewSHA1. 27 | func NewHash(h hash.Hash, space UUID, data []byte, version int) UUID { 28 | h.Reset() 29 | h.Write(space[:]) 30 | h.Write([]byte(data)) 31 | s := h.Sum(nil) 32 | var uuid UUID 33 | copy(uuid[:], s) 34 | uuid[6] = (uuid[6] & 0x0f) | uint8((version&0xf)<<4) 35 | uuid[8] = (uuid[8] & 0x3f) | 0x80 // RFC 4122 variant 36 | return uuid 37 | } 38 | 39 | // NewMD5 returns a new MD5 (Version 3) UUID based on the 40 | // supplied name space and data. It is the same as calling: 41 | // 42 | // NewHash(md5.New(), space, data, 3) 43 | func NewMD5(space UUID, data []byte) UUID { 44 | return NewHash(md5.New(), space, data, 3) 45 | } 46 | 47 | // NewSHA1 returns a new SHA1 (Version 5) UUID based on the 48 | // supplied name space and data. It is the same as calling: 49 | // 50 | // NewHash(sha1.New(), space, data, 5) 51 | func NewSHA1(space UUID, data []byte) UUID { 52 | return NewHash(sha1.New(), space, data, 5) 53 | } 54 | -------------------------------------------------------------------------------- /vendor/github.com/google/uuid/marshal.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 Google Inc. All rights reserved. 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 uuid 6 | 7 | import "fmt" 8 | 9 | // MarshalText implements encoding.TextMarshaler. 10 | func (uuid UUID) MarshalText() ([]byte, error) { 11 | var js [36]byte 12 | encodeHex(js[:], uuid) 13 | return js[:], nil 14 | } 15 | 16 | // UnmarshalText implements encoding.TextUnmarshaler. 17 | func (uuid *UUID) UnmarshalText(data []byte) error { 18 | // See comment in ParseBytes why we do this. 19 | // id, err := ParseBytes(data) 20 | id, err := ParseBytes(data) 21 | if err == nil { 22 | *uuid = id 23 | } 24 | return err 25 | } 26 | 27 | // MarshalBinary implements encoding.BinaryMarshaler. 28 | func (uuid UUID) MarshalBinary() ([]byte, error) { 29 | return uuid[:], nil 30 | } 31 | 32 | // UnmarshalBinary implements encoding.BinaryUnmarshaler. 33 | func (uuid *UUID) UnmarshalBinary(data []byte) error { 34 | if len(data) != 16 { 35 | return fmt.Errorf("invalid UUID (got %d bytes)", len(data)) 36 | } 37 | copy(uuid[:], data) 38 | return nil 39 | } 40 | -------------------------------------------------------------------------------- /vendor/github.com/google/uuid/sql.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 Google Inc. All rights reserved. 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 uuid 6 | 7 | import ( 8 | "database/sql/driver" 9 | "fmt" 10 | ) 11 | 12 | // Scan implements sql.Scanner so UUIDs can be read from databases transparently 13 | // Currently, database types that map to string and []byte are supported. Please 14 | // consult database-specific driver documentation for matching types. 15 | func (uuid *UUID) Scan(src interface{}) error { 16 | switch src.(type) { 17 | case string: 18 | // if an empty UUID comes from a table, we return a null UUID 19 | if src.(string) == "" { 20 | return nil 21 | } 22 | 23 | // see Parse for required string format 24 | u, err := Parse(src.(string)) 25 | 26 | if err != nil { 27 | return fmt.Errorf("Scan: %v", err) 28 | } 29 | 30 | *uuid = u 31 | case []byte: 32 | b := src.([]byte) 33 | 34 | // if an empty UUID comes from a table, we return a null UUID 35 | if len(b) == 0 { 36 | return nil 37 | } 38 | 39 | // assumes a simple slice of bytes if 16 bytes 40 | // otherwise attempts to parse 41 | if len(b) != 16 { 42 | return uuid.Scan(string(b)) 43 | } 44 | copy((*uuid)[:], b) 45 | 46 | default: 47 | return fmt.Errorf("Scan: unable to scan type %T into UUID", src) 48 | } 49 | 50 | return nil 51 | } 52 | 53 | // Value implements sql.Valuer so that UUIDs can be written to databases 54 | // transparently. Currently, UUIDs map to strings. Please consult 55 | // database-specific driver documentation for matching types. 56 | func (uuid UUID) Value() (driver.Value, error) { 57 | return uuid.String(), nil 58 | } 59 | -------------------------------------------------------------------------------- /vendor/github.com/google/uuid/util.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 Google Inc. All rights reserved. 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 uuid 6 | 7 | import ( 8 | "io" 9 | ) 10 | 11 | // randomBits completely fills slice b with random data. 12 | func randomBits(b []byte) { 13 | if _, err := io.ReadFull(rander, b); err != nil { 14 | panic(err.Error()) // rand should never fail 15 | } 16 | } 17 | 18 | // xvalues returns the value of a byte as a hexadecimal digit or 255. 19 | var xvalues = [256]byte{ 20 | 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 21 | 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 22 | 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 23 | 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 255, 255, 255, 255, 255, 255, 24 | 255, 10, 11, 12, 13, 14, 15, 255, 255, 255, 255, 255, 255, 255, 255, 255, 25 | 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 26 | 255, 10, 11, 12, 13, 14, 15, 255, 255, 255, 255, 255, 255, 255, 255, 255, 27 | 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 28 | 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 29 | 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 30 | 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 31 | 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 32 | 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 33 | 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 34 | 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 35 | 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 36 | } 37 | 38 | // xtob converts hex characters x1 and x2 into a byte. 39 | func xtob(x1, x2 byte) (byte, bool) { 40 | b1 := xvalues[x1] 41 | b2 := xvalues[x2] 42 | return (b1 << 4) | b2, b1 != 255 && b2 != 255 43 | } 44 | -------------------------------------------------------------------------------- /vendor/github.com/google/uuid/version1.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 Google Inc. All rights reserved. 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 uuid 6 | 7 | import ( 8 | "encoding/binary" 9 | ) 10 | 11 | // NewUUID returns a Version 1 UUID based on the current NodeID and clock 12 | // sequence, and the current time. If the NodeID has not been set by SetNodeID 13 | // or SetNodeInterface then it will be set automatically. If the NodeID cannot 14 | // be set NewUUID returns nil. If clock sequence has not been set by 15 | // SetClockSequence then it will be set automatically. If GetTime fails to 16 | // return the current NewUUID returns Nil and an error. 17 | // 18 | // In most cases, New should be used. 19 | func NewUUID() (UUID, error) { 20 | nodeMu.Lock() 21 | if nodeID == zeroID { 22 | setNodeInterface("") 23 | } 24 | nodeMu.Unlock() 25 | 26 | var uuid UUID 27 | now, seq, err := GetTime() 28 | if err != nil { 29 | return uuid, err 30 | } 31 | 32 | timeLow := uint32(now & 0xffffffff) 33 | timeMid := uint16((now >> 32) & 0xffff) 34 | timeHi := uint16((now >> 48) & 0x0fff) 35 | timeHi |= 0x1000 // Version 1 36 | 37 | binary.BigEndian.PutUint32(uuid[0:], timeLow) 38 | binary.BigEndian.PutUint16(uuid[4:], timeMid) 39 | binary.BigEndian.PutUint16(uuid[6:], timeHi) 40 | binary.BigEndian.PutUint16(uuid[8:], seq) 41 | copy(uuid[10:], nodeID[:]) 42 | 43 | return uuid, nil 44 | } 45 | -------------------------------------------------------------------------------- /vendor/github.com/google/uuid/version4.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 Google Inc. All rights reserved. 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 uuid 6 | 7 | import "io" 8 | 9 | // New is creates a new random UUID or panics. New is equivalent to 10 | // the expression 11 | // 12 | // uuid.Must(uuid.NewRandom()) 13 | func New() UUID { 14 | return Must(NewRandom()) 15 | } 16 | 17 | // NewRandom returns a Random (Version 4) UUID or panics. 18 | // 19 | // The strength of the UUIDs is based on the strength of the crypto/rand 20 | // package. 21 | // 22 | // A note about uniqueness derived from from the UUID Wikipedia entry: 23 | // 24 | // Randomly generated UUIDs have 122 random bits. One's annual risk of being 25 | // hit by a meteorite is estimated to be one chance in 17 billion, that 26 | // means the probability is about 0.00000000006 (6 × 10−11), 27 | // equivalent to the odds of creating a few tens of trillions of UUIDs in a 28 | // year and having one duplicate. 29 | func NewRandom() (UUID, error) { 30 | var uuid UUID 31 | _, err := io.ReadFull(rander, uuid[:]) 32 | if err != nil { 33 | return Nil, err 34 | } 35 | uuid[6] = (uuid[6] & 0x0f) | 0x40 // Version 4 36 | uuid[8] = (uuid[8] & 0x3f) | 0x80 // Variant is 10 37 | return uuid, nil 38 | } 39 | -------------------------------------------------------------------------------- /vendor/go.uber.org/atomic/.codecov.yml: -------------------------------------------------------------------------------- 1 | coverage: 2 | range: 80..100 3 | round: down 4 | precision: 2 5 | 6 | status: 7 | project: # measuring the overall project coverage 8 | default: # context, you can create multiple ones with custom titles 9 | enabled: yes # must be yes|true to enable this status 10 | target: 100 # specify the target coverage for each commit status 11 | # option: "auto" (must increase from parent commit or pull request base) 12 | # option: "X%" a static target percentage to hit 13 | if_not_found: success # if parent is not found report status as success, error, or failure 14 | if_ci_failed: error # if ci fails report status as success, error, or failure 15 | 16 | -------------------------------------------------------------------------------- /vendor/go.uber.org/atomic/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | /vendor 3 | /cover 4 | cover.out 5 | lint.log 6 | 7 | # Binaries 8 | *.test 9 | 10 | # Profiling output 11 | *.prof 12 | -------------------------------------------------------------------------------- /vendor/go.uber.org/atomic/.travis.yml: -------------------------------------------------------------------------------- 1 | sudo: false 2 | language: go 3 | go_import_path: go.uber.org/atomic 4 | 5 | go: 6 | - 1.7 7 | - 1.8 8 | - 1.9 9 | 10 | cache: 11 | directories: 12 | - vendor 13 | 14 | install: 15 | - make install_ci 16 | 17 | script: 18 | - make test_ci 19 | - scripts/test-ubergo.sh 20 | - make lint 21 | 22 | after_success: 23 | - bash <(curl -s https://codecov.io/bash) 24 | -------------------------------------------------------------------------------- /vendor/go.uber.org/atomic/LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2016 Uber Technologies, Inc. 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 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all 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/go.uber.org/atomic/Makefile: -------------------------------------------------------------------------------- 1 | PACKAGES := $(shell glide nv) 2 | # Many Go tools take file globs or directories as arguments instead of packages. 3 | PACKAGE_FILES ?= *.go 4 | 5 | 6 | # The linting tools evolve with each Go version, so run them only on the latest 7 | # stable release. 8 | GO_VERSION := $(shell go version | cut -d " " -f 3) 9 | GO_MINOR_VERSION := $(word 2,$(subst ., ,$(GO_VERSION))) 10 | LINTABLE_MINOR_VERSIONS := 7 8 11 | ifneq ($(filter $(LINTABLE_MINOR_VERSIONS),$(GO_MINOR_VERSION)),) 12 | SHOULD_LINT := true 13 | endif 14 | 15 | 16 | export GO15VENDOREXPERIMENT=1 17 | 18 | 19 | .PHONY: build 20 | build: 21 | go build -i $(PACKAGES) 22 | 23 | 24 | .PHONY: install 25 | install: 26 | glide --version || go get github.com/Masterminds/glide 27 | glide install 28 | 29 | 30 | .PHONY: test 31 | test: 32 | go test -cover -race $(PACKAGES) 33 | 34 | 35 | .PHONY: install_ci 36 | install_ci: install 37 | go get github.com/wadey/gocovmerge 38 | go get github.com/mattn/goveralls 39 | go get golang.org/x/tools/cmd/cover 40 | ifdef SHOULD_LINT 41 | go get github.com/golang/lint/golint 42 | endif 43 | 44 | .PHONY: lint 45 | lint: 46 | ifdef SHOULD_LINT 47 | @rm -rf lint.log 48 | @echo "Checking formatting..." 49 | @gofmt -d -s $(PACKAGE_FILES) 2>&1 | tee lint.log 50 | @echo "Checking vet..." 51 | @$(foreach dir,$(PACKAGE_FILES),go tool vet $(dir) 2>&1 | tee -a lint.log;) 52 | @echo "Checking lint..." 53 | @$(foreach dir,$(PKGS),golint $(dir) 2>&1 | tee -a lint.log;) 54 | @echo "Checking for unresolved FIXMEs..." 55 | @git grep -i fixme | grep -v -e vendor -e Makefile | tee -a lint.log 56 | @[ ! -s lint.log ] 57 | else 58 | @echo "Skipping linters on" $(GO_VERSION) 59 | endif 60 | 61 | 62 | .PHONY: test_ci 63 | test_ci: install_ci build 64 | ./scripts/cover.sh $(shell go list $(PACKAGES)) 65 | -------------------------------------------------------------------------------- /vendor/go.uber.org/atomic/README.md: -------------------------------------------------------------------------------- 1 | # atomic [![GoDoc][doc-img]][doc] [![Build Status][ci-img]][ci] [![Coverage Status][cov-img]][cov] [![Go Report Card][reportcard-img]][reportcard] 2 | 3 | Simple wrappers for primitive types to enforce atomic access. 4 | 5 | ## Installation 6 | `go get -u go.uber.org/atomic` 7 | 8 | ## Usage 9 | The standard library's `sync/atomic` is powerful, but it's easy to forget which 10 | variables must be accessed atomically. `go.uber.org/atomic` preserves all the 11 | functionality of the standard library, but wraps the primitive types to 12 | provide a safer, more convenient API. 13 | 14 | ```go 15 | var atom atomic.Uint32 16 | atom.Store(42) 17 | atom.Sub(2) 18 | atom.CAS(40, 11) 19 | ``` 20 | 21 | See the [documentation][doc] for a complete API specification. 22 | 23 | ## Development Status 24 | Stable. 25 | 26 |
27 | Released under the [MIT License](LICENSE.txt). 28 | 29 | [doc-img]: https://godoc.org/github.com/uber-go/atomic?status.svg 30 | [doc]: https://godoc.org/go.uber.org/atomic 31 | [ci-img]: https://travis-ci.org/uber-go/atomic.svg?branch=master 32 | [ci]: https://travis-ci.org/uber-go/atomic 33 | [cov-img]: https://codecov.io/gh/uber-go/atomic/branch/master/graph/badge.svg 34 | [cov]: https://codecov.io/gh/uber-go/atomic 35 | [reportcard-img]: https://goreportcard.com/badge/go.uber.org/atomic 36 | [reportcard]: https://goreportcard.com/report/go.uber.org/atomic 37 | -------------------------------------------------------------------------------- /vendor/go.uber.org/atomic/glide.lock: -------------------------------------------------------------------------------- 1 | hash: f14d51408e3e0e4f73b34e4039484c78059cd7fc5f4996fdd73db20dc8d24f53 2 | updated: 2016-10-27T00:10:51.16960137-07:00 3 | imports: [] 4 | testImports: 5 | - name: github.com/davecgh/go-spew 6 | version: 5215b55f46b2b919f50a1df0eaa5886afe4e3b3d 7 | subpackages: 8 | - spew 9 | - name: github.com/pmezard/go-difflib 10 | version: d8ed2627bdf02c080bf22230dbb337003b7aba2d 11 | subpackages: 12 | - difflib 13 | - name: github.com/stretchr/testify 14 | version: d77da356e56a7428ad25149ca77381849a6a5232 15 | subpackages: 16 | - assert 17 | - require 18 | -------------------------------------------------------------------------------- /vendor/go.uber.org/atomic/glide.yaml: -------------------------------------------------------------------------------- 1 | package: go.uber.org/atomic 2 | testImport: 3 | - package: github.com/stretchr/testify 4 | subpackages: 5 | - assert 6 | - require 7 | -------------------------------------------------------------------------------- /vendor/go.uber.org/atomic/string.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Uber Technologies, Inc. 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 8 | // furnished to do so, subject to the following conditions: 9 | // 10 | // The above copyright notice and this permission notice shall be included in 11 | // all 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 | 21 | package atomic 22 | 23 | // String is an atomic type-safe wrapper around Value for strings. 24 | type String struct{ v Value } 25 | 26 | // NewString creates a String. 27 | func NewString(str string) *String { 28 | s := &String{} 29 | if str != "" { 30 | s.Store(str) 31 | } 32 | return s 33 | } 34 | 35 | // Load atomically loads the wrapped string. 36 | func (s *String) Load() string { 37 | v := s.v.Load() 38 | if v == nil { 39 | return "" 40 | } 41 | return v.(string) 42 | } 43 | 44 | // Store atomically stores the passed string. 45 | // Note: Converting the string to an interface{} to store in the Value 46 | // requires an allocation. 47 | func (s *String) Store(str string) { 48 | s.v.Store(str) 49 | } 50 | -------------------------------------------------------------------------------- /vendor/go.uber.org/multierr/.codecov.yml: -------------------------------------------------------------------------------- 1 | coverage: 2 | range: 80..100 3 | round: down 4 | precision: 2 5 | 6 | status: 7 | project: # measuring the overall project coverage 8 | default: # context, you can create multiple ones with custom titles 9 | enabled: yes # must be yes|true to enable this status 10 | target: 100 # specify the target coverage for each commit status 11 | # option: "auto" (must increase from parent commit or pull request base) 12 | # option: "X%" a static target percentage to hit 13 | if_not_found: success # if parent is not found report status as success, error, or failure 14 | if_ci_failed: error # if ci fails report status as success, error, or failure 15 | 16 | -------------------------------------------------------------------------------- /vendor/go.uber.org/multierr/.gitignore: -------------------------------------------------------------------------------- 1 | /vendor 2 | -------------------------------------------------------------------------------- /vendor/go.uber.org/multierr/.travis.yml: -------------------------------------------------------------------------------- 1 | sudo: false 2 | language: go 3 | go_import_path: go.uber.org/multierr 4 | 5 | env: 6 | global: 7 | - GO15VENDOREXPERIMENT=1 8 | 9 | go: 10 | - 1.7 11 | - 1.8 12 | - tip 13 | 14 | cache: 15 | directories: 16 | - vendor 17 | 18 | before_install: 19 | - go version 20 | 21 | install: 22 | - | 23 | set -e 24 | make install_ci 25 | 26 | script: 27 | - | 28 | set -e 29 | make lint 30 | make test_ci 31 | 32 | after_success: 33 | - bash <(curl -s https://codecov.io/bash) 34 | -------------------------------------------------------------------------------- /vendor/go.uber.org/multierr/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | Releases 2 | ======== 3 | 4 | v1.1.0 (2017-06-30) 5 | =================== 6 | 7 | - Added an `Errors(error) []error` function to extract the underlying list of 8 | errors for a multierr error. 9 | 10 | 11 | v1.0.0 (2017-05-31) 12 | =================== 13 | 14 | No changes since v0.2.0. This release is committing to making no breaking 15 | changes to the current API in the 1.X series. 16 | 17 | 18 | v0.2.0 (2017-04-11) 19 | =================== 20 | 21 | - Repeatedly appending to the same error is now faster due to fewer 22 | allocations. 23 | 24 | 25 | v0.1.0 (2017-31-03) 26 | =================== 27 | 28 | - Initial release 29 | -------------------------------------------------------------------------------- /vendor/go.uber.org/multierr/LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2017 Uber Technologies, Inc. 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 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all 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/go.uber.org/multierr/Makefile: -------------------------------------------------------------------------------- 1 | export GO15VENDOREXPERIMENT=1 2 | 3 | PACKAGES := $(shell glide nv) 4 | 5 | GO_FILES := $(shell \ 6 | find . '(' -path '*/.*' -o -path './vendor' ')' -prune \ 7 | -o -name '*.go' -print | cut -b3-) 8 | 9 | .PHONY: install 10 | install: 11 | glide --version || go get github.com/Masterminds/glide 12 | glide install 13 | 14 | .PHONY: build 15 | build: 16 | go build -i $(PACKAGES) 17 | 18 | .PHONY: test 19 | test: 20 | go test -cover -race $(PACKAGES) 21 | 22 | .PHONY: gofmt 23 | gofmt: 24 | $(eval FMT_LOG := $(shell mktemp -t gofmt.XXXXX)) 25 | @gofmt -e -s -l $(GO_FILES) > $(FMT_LOG) || true 26 | @[ ! -s "$(FMT_LOG)" ] || (echo "gofmt failed:" | cat - $(FMT_LOG) && false) 27 | 28 | .PHONY: govet 29 | govet: 30 | $(eval VET_LOG := $(shell mktemp -t govet.XXXXX)) 31 | @go vet $(PACKAGES) 2>&1 \ 32 | | grep -v '^exit status' > $(VET_LOG) || true 33 | @[ ! -s "$(VET_LOG)" ] || (echo "govet failed:" | cat - $(VET_LOG) && false) 34 | 35 | .PHONY: golint 36 | golint: 37 | @go get github.com/golang/lint/golint 38 | $(eval LINT_LOG := $(shell mktemp -t golint.XXXXX)) 39 | @cat /dev/null > $(LINT_LOG) 40 | @$(foreach pkg, $(PACKAGES), golint $(pkg) >> $(LINT_LOG) || true;) 41 | @[ ! -s "$(LINT_LOG)" ] || (echo "golint failed:" | cat - $(LINT_LOG) && false) 42 | 43 | .PHONY: staticcheck 44 | staticcheck: 45 | @go get honnef.co/go/tools/cmd/staticcheck 46 | $(eval STATICCHECK_LOG := $(shell mktemp -t staticcheck.XXXXX)) 47 | @staticcheck $(PACKAGES) 2>&1 > $(STATICCHECK_LOG) || true 48 | @[ ! -s "$(STATICCHECK_LOG)" ] || (echo "staticcheck failed:" | cat - $(STATICCHECK_LOG) && false) 49 | 50 | .PHONY: lint 51 | lint: gofmt govet golint staticcheck 52 | 53 | .PHONY: cover 54 | cover: 55 | ./scripts/cover.sh $(shell go list $(PACKAGES)) 56 | go tool cover -html=cover.out -o cover.html 57 | 58 | update-license: 59 | @go get go.uber.org/tools/update-license 60 | @update-license \ 61 | $(shell go list -json $(PACKAGES) | \ 62 | jq -r '.Dir + "/" + (.GoFiles | .[])') 63 | 64 | ############################################################################## 65 | 66 | .PHONY: install_ci 67 | install_ci: install 68 | go get github.com/wadey/gocovmerge 69 | go get github.com/mattn/goveralls 70 | go get golang.org/x/tools/cmd/cover 71 | 72 | .PHONY: test_ci 73 | test_ci: install_ci 74 | ./scripts/cover.sh $(shell go list $(PACKAGES)) 75 | -------------------------------------------------------------------------------- /vendor/go.uber.org/multierr/README.md: -------------------------------------------------------------------------------- 1 | # multierr [![GoDoc][doc-img]][doc] [![Build Status][ci-img]][ci] [![Coverage Status][cov-img]][cov] 2 | 3 | `multierr` allows combining one or more Go `error`s together. 4 | 5 | ## Installation 6 | 7 | go get -u go.uber.org/multierr 8 | 9 | ## Status 10 | 11 | Stable: No breaking changes will be made before 2.0. 12 | 13 | ------------------------------------------------------------------------------- 14 | 15 | Released under the [MIT License]. 16 | 17 | [MIT License]: LICENSE.txt 18 | [doc-img]: https://godoc.org/go.uber.org/multierr?status.svg 19 | [doc]: https://godoc.org/go.uber.org/multierr 20 | [ci-img]: https://travis-ci.org/uber-go/multierr.svg?branch=master 21 | [cov-img]: https://codecov.io/gh/uber-go/multierr/branch/master/graph/badge.svg 22 | [ci]: https://travis-ci.org/uber-go/multierr 23 | [cov]: https://codecov.io/gh/uber-go/multierr 24 | -------------------------------------------------------------------------------- /vendor/go.uber.org/multierr/glide.lock: -------------------------------------------------------------------------------- 1 | hash: b53b5e9a84b9cb3cc4b2d0499e23da2feca1eec318ce9bb717ecf35bf24bf221 2 | updated: 2017-04-10T13:34:45.671678062-07:00 3 | imports: 4 | - name: go.uber.org/atomic 5 | version: 3b8db5e93c4c02efbc313e17b2e796b0914a01fb 6 | testImports: 7 | - name: github.com/davecgh/go-spew 8 | version: 6d212800a42e8ab5c146b8ace3490ee17e5225f9 9 | subpackages: 10 | - spew 11 | - name: github.com/pmezard/go-difflib 12 | version: d8ed2627bdf02c080bf22230dbb337003b7aba2d 13 | subpackages: 14 | - difflib 15 | - name: github.com/stretchr/testify 16 | version: 69483b4bd14f5845b5a1e55bca19e954e827f1d0 17 | subpackages: 18 | - assert 19 | - require 20 | -------------------------------------------------------------------------------- /vendor/go.uber.org/multierr/glide.yaml: -------------------------------------------------------------------------------- 1 | package: go.uber.org/multierr 2 | import: 3 | - package: go.uber.org/atomic 4 | version: ^1 5 | testImport: 6 | - package: github.com/stretchr/testify 7 | subpackages: 8 | - assert 9 | -------------------------------------------------------------------------------- /vendor/go.uber.org/zap/.codecov.yml: -------------------------------------------------------------------------------- 1 | coverage: 2 | range: 80..100 3 | round: down 4 | precision: 2 5 | 6 | status: 7 | project: # measuring the overall project coverage 8 | default: # context, you can create multiple ones with custom titles 9 | enabled: yes # must be yes|true to enable this status 10 | target: 95% # specify the target coverage for each commit status 11 | # option: "auto" (must increase from parent commit or pull request base) 12 | # option: "X%" a static target percentage to hit 13 | if_not_found: success # if parent is not found report status as success, error, or failure 14 | if_ci_failed: error # if ci fails report status as success, error, or failure 15 | ignore: 16 | - internal/readme/readme.go 17 | 18 | -------------------------------------------------------------------------------- /vendor/go.uber.org/zap/.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 | vendor 10 | 11 | # Architecture specific extensions/prefixes 12 | *.[568vq] 13 | [568vq].out 14 | 15 | *.cgo1.go 16 | *.cgo2.c 17 | _cgo_defun.c 18 | _cgo_gotypes.go 19 | _cgo_export.* 20 | 21 | _testmain.go 22 | 23 | *.exe 24 | *.test 25 | *.prof 26 | *.pprof 27 | *.out 28 | *.log 29 | -------------------------------------------------------------------------------- /vendor/go.uber.org/zap/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | sudo: false 3 | go: 4 | - "1.9" 5 | - "1.10" 6 | go_import_path: go.uber.org/zap 7 | env: 8 | global: 9 | - TEST_TIMEOUT_SCALE=10 10 | cache: 11 | directories: 12 | - vendor 13 | install: 14 | - make dependencies 15 | script: 16 | - make lint 17 | - make test 18 | - make bench 19 | after_success: 20 | - make cover 21 | - bash <(curl -s https://codecov.io/bash) 22 | -------------------------------------------------------------------------------- /vendor/go.uber.org/zap/LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2016-2017 Uber Technologies, Inc. 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 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all 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/go.uber.org/zap/buffer/pool.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Uber Technologies, Inc. 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 8 | // furnished to do so, subject to the following conditions: 9 | // 10 | // The above copyright notice and this permission notice shall be included in 11 | // all 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 | 21 | package buffer 22 | 23 | import "sync" 24 | 25 | // A Pool is a type-safe wrapper around a sync.Pool. 26 | type Pool struct { 27 | p *sync.Pool 28 | } 29 | 30 | // NewPool constructs a new Pool. 31 | func NewPool() Pool { 32 | return Pool{p: &sync.Pool{ 33 | New: func() interface{} { 34 | return &Buffer{bs: make([]byte, 0, _size)} 35 | }, 36 | }} 37 | } 38 | 39 | // Get retrieves a Buffer from the pool, creating one if necessary. 40 | func (p Pool) Get() *Buffer { 41 | buf := p.p.Get().(*Buffer) 42 | buf.Reset() 43 | buf.pool = p 44 | return buf 45 | } 46 | 47 | func (p Pool) put(buf *Buffer) { 48 | p.p.Put(buf) 49 | } 50 | -------------------------------------------------------------------------------- /vendor/go.uber.org/zap/check_license.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | 3 | ERROR_COUNT=0 4 | while read -r file 5 | do 6 | case "$(head -1 "${file}")" in 7 | *"Copyright (c) "*" Uber Technologies, Inc.") 8 | # everything's cool 9 | ;; 10 | *) 11 | echo "$file is missing license header." 12 | (( ERROR_COUNT++ )) 13 | ;; 14 | esac 15 | done < <(git ls-files "*\.go") 16 | 17 | exit $ERROR_COUNT 18 | -------------------------------------------------------------------------------- /vendor/go.uber.org/zap/flag.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Uber Technologies, Inc. 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 8 | // furnished to do so, subject to the following conditions: 9 | // 10 | // The above copyright notice and this permission notice shall be included in 11 | // all 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 | 21 | package zap 22 | 23 | import ( 24 | "flag" 25 | 26 | "go.uber.org/zap/zapcore" 27 | ) 28 | 29 | // LevelFlag uses the standard library's flag.Var to declare a global flag 30 | // with the specified name, default, and usage guidance. The returned value is 31 | // a pointer to the value of the flag. 32 | // 33 | // If you don't want to use the flag package's global state, you can use any 34 | // non-nil *Level as a flag.Value with your own *flag.FlagSet. 35 | func LevelFlag(name string, defaultLevel zapcore.Level, usage string) *zapcore.Level { 36 | lvl := defaultLevel 37 | flag.Var(&lvl, name, usage) 38 | return &lvl 39 | } 40 | -------------------------------------------------------------------------------- /vendor/go.uber.org/zap/glide.yaml: -------------------------------------------------------------------------------- 1 | package: go.uber.org/zap 2 | license: MIT 3 | import: 4 | - package: go.uber.org/atomic 5 | version: ^1 6 | - package: go.uber.org/multierr 7 | version: ^1 8 | testImport: 9 | - package: github.com/satori/go.uuid 10 | - package: github.com/sirupsen/logrus 11 | - package: github.com/apex/log 12 | subpackages: 13 | - handlers/json 14 | - package: github.com/go-kit/kit 15 | subpackages: 16 | - log 17 | - package: github.com/stretchr/testify 18 | subpackages: 19 | - assert 20 | - require 21 | - package: gopkg.in/inconshreveable/log15.v2 22 | - package: github.com/mattn/goveralls 23 | - package: github.com/pborman/uuid 24 | - package: github.com/pkg/errors 25 | - package: go.pedge.io/lion 26 | - package: github.com/rs/zerolog 27 | - package: golang.org/x/tools 28 | subpackages: 29 | - cover 30 | - package: github.com/golang/lint 31 | subpackages: 32 | - golint 33 | - package: github.com/axw/gocov 34 | subpackages: 35 | - gocov 36 | -------------------------------------------------------------------------------- /vendor/go.uber.org/zap/internal/bufferpool/bufferpool.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Uber Technologies, Inc. 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 8 | // furnished to do so, subject to the following conditions: 9 | // 10 | // The above copyright notice and this permission notice shall be included in 11 | // all 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 | 21 | // Package bufferpool houses zap's shared internal buffer pool. Third-party 22 | // packages can recreate the same functionality with buffers.NewPool. 23 | package bufferpool 24 | 25 | import "go.uber.org/zap/buffer" 26 | 27 | var ( 28 | _pool = buffer.NewPool() 29 | // Get retrieves a buffer from the pool, creating one if necessary. 30 | Get = _pool.Get 31 | ) 32 | -------------------------------------------------------------------------------- /vendor/go.uber.org/zap/internal/color/color.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Uber Technologies, Inc. 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 8 | // furnished to do so, subject to the following conditions: 9 | // 10 | // The above copyright notice and this permission notice shall be included in 11 | // all 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 | 21 | // Package color adds coloring functionality for TTY output. 22 | package color 23 | 24 | import "fmt" 25 | 26 | // Foreground colors. 27 | const ( 28 | Black Color = iota + 30 29 | Red 30 | Green 31 | Yellow 32 | Blue 33 | Magenta 34 | Cyan 35 | White 36 | ) 37 | 38 | // Color represents a text color. 39 | type Color uint8 40 | 41 | // Add adds the coloring to the given string. 42 | func (c Color) Add(s string) string { 43 | return fmt.Sprintf("\x1b[%dm%s\x1b[0m", uint8(c), s) 44 | } 45 | -------------------------------------------------------------------------------- /vendor/go.uber.org/zap/internal/exit/exit.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Uber Technologies, Inc. 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 8 | // furnished to do so, subject to the following conditions: 9 | // 10 | // The above copyright notice and this permission notice shall be included in 11 | // all 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 | 21 | // Package exit provides stubs so that unit tests can exercise code that calls 22 | // os.Exit(1). 23 | package exit 24 | 25 | import "os" 26 | 27 | var real = func() { os.Exit(1) } 28 | 29 | // Exit normally terminates the process by calling os.Exit(1). If the package 30 | // is stubbed, it instead records a call in the testing spy. 31 | func Exit() { 32 | real() 33 | } 34 | 35 | // A StubbedExit is a testing fake for os.Exit. 36 | type StubbedExit struct { 37 | Exited bool 38 | prev func() 39 | } 40 | 41 | // Stub substitutes a fake for the call to os.Exit(1). 42 | func Stub() *StubbedExit { 43 | s := &StubbedExit{prev: real} 44 | real = s.exit 45 | return s 46 | } 47 | 48 | // WithStub runs the supplied function with Exit stubbed. It returns the stub 49 | // used, so that users can test whether the process would have crashed. 50 | func WithStub(f func()) *StubbedExit { 51 | s := Stub() 52 | defer s.Unstub() 53 | f() 54 | return s 55 | } 56 | 57 | // Unstub restores the previous exit function. 58 | func (se *StubbedExit) Unstub() { 59 | real = se.prev 60 | } 61 | 62 | func (se *StubbedExit) exit() { 63 | se.Exited = true 64 | } 65 | -------------------------------------------------------------------------------- /vendor/go.uber.org/zap/time.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Uber Technologies, Inc. 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 8 | // furnished to do so, subject to the following conditions: 9 | // 10 | // The above copyright notice and this permission notice shall be included in 11 | // all 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 | 21 | package zap 22 | 23 | import "time" 24 | 25 | func timeToMillis(t time.Time) int64 { 26 | return t.UnixNano() / int64(time.Millisecond) 27 | } 28 | -------------------------------------------------------------------------------- /vendor/go.uber.org/zap/zapcore/doc.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Uber Technologies, Inc. 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 8 | // furnished to do so, subject to the following conditions: 9 | // 10 | // The above copyright notice and this permission notice shall be included in 11 | // all 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 | 21 | // Package zapcore defines and implements the low-level interfaces upon which 22 | // zap is built. By providing alternate implementations of these interfaces, 23 | // external packages can extend zap's capabilities. 24 | package zapcore // import "go.uber.org/zap/zapcore" 25 | -------------------------------------------------------------------------------- /vendor/go.uber.org/zap/zapcore/level_strings.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Uber Technologies, Inc. 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 8 | // furnished to do so, subject to the following conditions: 9 | // 10 | // The above copyright notice and this permission notice shall be included in 11 | // all 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 | 21 | package zapcore 22 | 23 | import "go.uber.org/zap/internal/color" 24 | 25 | var ( 26 | _levelToColor = map[Level]color.Color{ 27 | DebugLevel: color.Magenta, 28 | InfoLevel: color.Blue, 29 | WarnLevel: color.Yellow, 30 | ErrorLevel: color.Red, 31 | DPanicLevel: color.Red, 32 | PanicLevel: color.Red, 33 | FatalLevel: color.Red, 34 | } 35 | _unknownLevelColor = color.Red 36 | 37 | _levelToLowercaseColorString = make(map[Level]string, len(_levelToColor)) 38 | _levelToCapitalColorString = make(map[Level]string, len(_levelToColor)) 39 | ) 40 | 41 | func init() { 42 | for level, color := range _levelToColor { 43 | _levelToLowercaseColorString[level] = color.Add(level.String()) 44 | _levelToCapitalColorString[level] = color.Add(level.CapitalString()) 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /vendor/go.uber.org/zap/zapcore/marshaler.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Uber Technologies, Inc. 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 8 | // furnished to do so, subject to the following conditions: 9 | // 10 | // The above copyright notice and this permission notice shall be included in 11 | // all 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 | 21 | package zapcore 22 | 23 | // ObjectMarshaler allows user-defined types to efficiently add themselves to the 24 | // logging context, and to selectively omit information which shouldn't be 25 | // included in logs (e.g., passwords). 26 | type ObjectMarshaler interface { 27 | MarshalLogObject(ObjectEncoder) error 28 | } 29 | 30 | // ObjectMarshalerFunc is a type adapter that turns a function into an 31 | // ObjectMarshaler. 32 | type ObjectMarshalerFunc func(ObjectEncoder) error 33 | 34 | // MarshalLogObject calls the underlying function. 35 | func (f ObjectMarshalerFunc) MarshalLogObject(enc ObjectEncoder) error { 36 | return f(enc) 37 | } 38 | 39 | // ArrayMarshaler allows user-defined types to efficiently add themselves to the 40 | // logging context, and to selectively omit information which shouldn't be 41 | // included in logs (e.g., passwords). 42 | type ArrayMarshaler interface { 43 | MarshalLogArray(ArrayEncoder) error 44 | } 45 | 46 | // ArrayMarshalerFunc is a type adapter that turns a function into an 47 | // ArrayMarshaler. 48 | type ArrayMarshalerFunc func(ArrayEncoder) error 49 | 50 | // MarshalLogArray calls the underlying function. 51 | func (f ArrayMarshalerFunc) MarshalLogArray(enc ArrayEncoder) error { 52 | return f(enc) 53 | } 54 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/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/net/CONTRIBUTORS: -------------------------------------------------------------------------------- 1 | # This source code was written by the Go contributors. 2 | # The master list of contributors is in the main Go distribution, 3 | # visible at http://tip.golang.org/CONTRIBUTORS. 4 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2009 The Go Authors. All rights reserved. 2 | 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions are 5 | met: 6 | 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above 10 | copyright notice, this list of conditions and the following disclaimer 11 | in the documentation and/or other materials provided with the 12 | distribution. 13 | * Neither the name of Google Inc. nor the names of its 14 | contributors may be used to endorse or promote products derived from 15 | this software without specific prior written permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/PATENTS: -------------------------------------------------------------------------------- 1 | Additional IP Rights Grant (Patents) 2 | 3 | "This implementation" means the copyrightable works distributed by 4 | Google as part of the Go project. 5 | 6 | Google hereby grants to You a perpetual, worldwide, non-exclusive, 7 | no-charge, royalty-free, irrevocable (except as stated in this section) 8 | patent license to make, have made, use, offer to sell, sell, import, 9 | transfer and otherwise run, modify and propagate the contents of this 10 | implementation of Go, where such license applies only to those patent 11 | claims, both currently owned or controlled by Google and acquired in 12 | the future, licensable by Google that are necessarily infringed by this 13 | implementation of Go. This grant does not include claims that would be 14 | infringed only as a consequence of further modification of this 15 | implementation. If you or your agent or exclusive licensee institute or 16 | order or agree to the institution of patent litigation against any 17 | entity (including a cross-claim or counterclaim in a lawsuit) alleging 18 | that this implementation of Go or any code incorporated within this 19 | implementation of Go constitutes direct or contributory patent 20 | infringement, or inducement of patent infringement, then any patent 21 | rights granted to you under this License for this implementation of Go 22 | shall terminate as of the date such litigation is filed. 23 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/context/go19.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 go1.9 6 | 7 | package context 8 | 9 | import "context" // standard library's context, as of Go 1.7 10 | 11 | // A Context carries a deadline, a cancelation signal, and other values across 12 | // API boundaries. 13 | // 14 | // Context's methods may be called by multiple goroutines simultaneously. 15 | type Context = context.Context 16 | 17 | // A CancelFunc tells an operation to abandon its work. 18 | // A CancelFunc does not wait for the work to stop. 19 | // After the first call, subsequent calls to a CancelFunc do nothing. 20 | type CancelFunc = context.CancelFunc 21 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/http/httpguts/guts.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // Package httpguts provides functions implementing various details 6 | // of the HTTP specification. 7 | // 8 | // This package is shared by the standard library (which vendors it) 9 | // and x/net/http2. It comes with no API stability promise. 10 | package httpguts 11 | 12 | import ( 13 | "net/textproto" 14 | "strings" 15 | ) 16 | 17 | // ValidTrailerHeader reports whether name is a valid header field name to appear 18 | // in trailers. 19 | // See RFC 7230, Section 4.1.2 20 | func ValidTrailerHeader(name string) bool { 21 | name = textproto.CanonicalMIMEHeaderKey(name) 22 | if strings.HasPrefix(name, "If-") || badTrailer[name] { 23 | return false 24 | } 25 | return true 26 | } 27 | 28 | var badTrailer = map[string]bool{ 29 | "Authorization": true, 30 | "Cache-Control": true, 31 | "Connection": true, 32 | "Content-Encoding": true, 33 | "Content-Length": true, 34 | "Content-Range": true, 35 | "Content-Type": true, 36 | "Expect": true, 37 | "Host": true, 38 | "Keep-Alive": true, 39 | "Max-Forwards": true, 40 | "Pragma": true, 41 | "Proxy-Authenticate": true, 42 | "Proxy-Authorization": true, 43 | "Proxy-Connection": true, 44 | "Range": true, 45 | "Realm": true, 46 | "Te": true, 47 | "Trailer": true, 48 | "Transfer-Encoding": true, 49 | "Www-Authenticate": true, 50 | } 51 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/http2/.gitignore: -------------------------------------------------------------------------------- 1 | *~ 2 | h2i/h2i 3 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/http2/Dockerfile: -------------------------------------------------------------------------------- 1 | # 2 | # This Dockerfile builds a recent curl with HTTP/2 client support, using 3 | # a recent nghttp2 build. 4 | # 5 | # See the Makefile for how to tag it. If Docker and that image is found, the 6 | # Go tests use this curl binary for integration tests. 7 | # 8 | 9 | FROM ubuntu:trusty 10 | 11 | RUN apt-get update && \ 12 | apt-get upgrade -y && \ 13 | apt-get install -y git-core build-essential wget 14 | 15 | RUN apt-get install -y --no-install-recommends \ 16 | autotools-dev libtool pkg-config zlib1g-dev \ 17 | libcunit1-dev libssl-dev libxml2-dev libevent-dev \ 18 | automake autoconf 19 | 20 | # The list of packages nghttp2 recommends for h2load: 21 | RUN apt-get install -y --no-install-recommends make binutils \ 22 | autoconf automake autotools-dev \ 23 | libtool pkg-config zlib1g-dev libcunit1-dev libssl-dev libxml2-dev \ 24 | libev-dev libevent-dev libjansson-dev libjemalloc-dev \ 25 | cython python3.4-dev python-setuptools 26 | 27 | # Note: setting NGHTTP2_VER before the git clone, so an old git clone isn't cached: 28 | ENV NGHTTP2_VER 895da9a 29 | RUN cd /root && git clone https://github.com/tatsuhiro-t/nghttp2.git 30 | 31 | WORKDIR /root/nghttp2 32 | RUN git reset --hard $NGHTTP2_VER 33 | RUN autoreconf -i 34 | RUN automake 35 | RUN autoconf 36 | RUN ./configure 37 | RUN make 38 | RUN make install 39 | 40 | WORKDIR /root 41 | RUN wget http://curl.haxx.se/download/curl-7.45.0.tar.gz 42 | RUN tar -zxvf curl-7.45.0.tar.gz 43 | WORKDIR /root/curl-7.45.0 44 | RUN ./configure --with-ssl --with-nghttp2=/usr/local 45 | RUN make 46 | RUN make install 47 | RUN ldconfig 48 | 49 | CMD ["-h"] 50 | ENTRYPOINT ["/usr/local/bin/curl"] 51 | 52 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/http2/Makefile: -------------------------------------------------------------------------------- 1 | curlimage: 2 | docker build -t gohttp2/curl . 3 | 4 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/http2/README: -------------------------------------------------------------------------------- 1 | This is a work-in-progress HTTP/2 implementation for Go. 2 | 3 | It will eventually live in the Go standard library and won't require 4 | any changes to your code to use. It will just be automatic. 5 | 6 | Status: 7 | 8 | * The server support is pretty good. A few things are missing 9 | but are being worked on. 10 | * The client work has just started but shares a lot of code 11 | is coming along much quicker. 12 | 13 | Docs are at https://godoc.org/golang.org/x/net/http2 14 | 15 | Demo test server at https://http2.golang.org/ 16 | 17 | Help & bug reports welcome! 18 | 19 | Contributing: https://golang.org/doc/contribute.html 20 | Bugs: https://golang.org/issue/new?title=x/net/http2:+ 21 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/http2/flow.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 | // Flow control 6 | 7 | package http2 8 | 9 | // flow is the flow control window's size. 10 | type flow struct { 11 | // n is the number of DATA bytes we're allowed to send. 12 | // A flow is kept both on a conn and a per-stream. 13 | n int32 14 | 15 | // conn points to the shared connection-level flow that is 16 | // shared by all streams on that conn. It is nil for the flow 17 | // that's on the conn directly. 18 | conn *flow 19 | } 20 | 21 | func (f *flow) setConnFlow(cf *flow) { f.conn = cf } 22 | 23 | func (f *flow) available() int32 { 24 | n := f.n 25 | if f.conn != nil && f.conn.n < n { 26 | n = f.conn.n 27 | } 28 | return n 29 | } 30 | 31 | func (f *flow) take(n int32) { 32 | if n > f.available() { 33 | panic("internal error: took too much") 34 | } 35 | f.n -= n 36 | if f.conn != nil { 37 | f.conn.n -= n 38 | } 39 | } 40 | 41 | // add adds n bytes (positive or negative) to the flow control window. 42 | // It returns false if the sum would exceed 2^31-1. 43 | func (f *flow) add(n int32) bool { 44 | sum := f.n + n 45 | if (sum > n) == (f.n > 0) { 46 | f.n = sum 47 | return true 48 | } 49 | return false 50 | } 51 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/http2/go16.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 go1.6 6 | 7 | package http2 8 | 9 | import ( 10 | "net/http" 11 | "time" 12 | ) 13 | 14 | func transportExpectContinueTimeout(t1 *http.Transport) time.Duration { 15 | return t1.ExpectContinueTimeout 16 | } 17 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/http2/go17_not18.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 go1.7,!go1.8 6 | 7 | package http2 8 | 9 | import "crypto/tls" 10 | 11 | // temporary copy of Go 1.7's private tls.Config.clone: 12 | func cloneTLSConfig(c *tls.Config) *tls.Config { 13 | return &tls.Config{ 14 | Rand: c.Rand, 15 | Time: c.Time, 16 | Certificates: c.Certificates, 17 | NameToCertificate: c.NameToCertificate, 18 | GetCertificate: c.GetCertificate, 19 | RootCAs: c.RootCAs, 20 | NextProtos: c.NextProtos, 21 | ServerName: c.ServerName, 22 | ClientAuth: c.ClientAuth, 23 | ClientCAs: c.ClientCAs, 24 | InsecureSkipVerify: c.InsecureSkipVerify, 25 | CipherSuites: c.CipherSuites, 26 | PreferServerCipherSuites: c.PreferServerCipherSuites, 27 | SessionTicketsDisabled: c.SessionTicketsDisabled, 28 | SessionTicketKey: c.SessionTicketKey, 29 | ClientSessionCache: c.ClientSessionCache, 30 | MinVersion: c.MinVersion, 31 | MaxVersion: c.MaxVersion, 32 | CurvePreferences: c.CurvePreferences, 33 | DynamicRecordSizingDisabled: c.DynamicRecordSizingDisabled, 34 | Renegotiation: c.Renegotiation, 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/http2/go18.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 go1.8 6 | 7 | package http2 8 | 9 | import ( 10 | "crypto/tls" 11 | "io" 12 | "net/http" 13 | ) 14 | 15 | func cloneTLSConfig(c *tls.Config) *tls.Config { 16 | c2 := c.Clone() 17 | c2.GetClientCertificate = c.GetClientCertificate // golang.org/issue/19264 18 | return c2 19 | } 20 | 21 | var _ http.Pusher = (*responseWriter)(nil) 22 | 23 | // Push implements http.Pusher. 24 | func (w *responseWriter) Push(target string, opts *http.PushOptions) error { 25 | internalOpts := pushOptions{} 26 | if opts != nil { 27 | internalOpts.Method = opts.Method 28 | internalOpts.Header = opts.Header 29 | } 30 | return w.push(target, internalOpts) 31 | } 32 | 33 | func configureServer18(h1 *http.Server, h2 *Server) error { 34 | if h2.IdleTimeout == 0 { 35 | if h1.IdleTimeout != 0 { 36 | h2.IdleTimeout = h1.IdleTimeout 37 | } else { 38 | h2.IdleTimeout = h1.ReadTimeout 39 | } 40 | } 41 | return nil 42 | } 43 | 44 | func shouldLogPanic(panicValue interface{}) bool { 45 | return panicValue != nil && panicValue != http.ErrAbortHandler 46 | } 47 | 48 | func reqGetBody(req *http.Request) func() (io.ReadCloser, error) { 49 | return req.GetBody 50 | } 51 | 52 | func reqBodyIsNoBody(body io.ReadCloser) bool { 53 | return body == http.NoBody 54 | } 55 | 56 | func go18httpNoBody() io.ReadCloser { return http.NoBody } // for tests only 57 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/http2/go19.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 go1.9 6 | 7 | package http2 8 | 9 | import ( 10 | "net/http" 11 | ) 12 | 13 | func configureServer19(s *http.Server, conf *Server) error { 14 | s.RegisterOnShutdown(conf.state.startGracefulShutdown) 15 | return nil 16 | } 17 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/http2/headermap.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package http2 6 | 7 | import ( 8 | "net/http" 9 | "strings" 10 | ) 11 | 12 | var ( 13 | commonLowerHeader = map[string]string{} // Go-Canonical-Case -> lower-case 14 | commonCanonHeader = map[string]string{} // lower-case -> Go-Canonical-Case 15 | ) 16 | 17 | func init() { 18 | for _, v := range []string{ 19 | "accept", 20 | "accept-charset", 21 | "accept-encoding", 22 | "accept-language", 23 | "accept-ranges", 24 | "age", 25 | "access-control-allow-origin", 26 | "allow", 27 | "authorization", 28 | "cache-control", 29 | "content-disposition", 30 | "content-encoding", 31 | "content-language", 32 | "content-length", 33 | "content-location", 34 | "content-range", 35 | "content-type", 36 | "cookie", 37 | "date", 38 | "etag", 39 | "expect", 40 | "expires", 41 | "from", 42 | "host", 43 | "if-match", 44 | "if-modified-since", 45 | "if-none-match", 46 | "if-unmodified-since", 47 | "last-modified", 48 | "link", 49 | "location", 50 | "max-forwards", 51 | "proxy-authenticate", 52 | "proxy-authorization", 53 | "range", 54 | "referer", 55 | "refresh", 56 | "retry-after", 57 | "server", 58 | "set-cookie", 59 | "strict-transport-security", 60 | "trailer", 61 | "transfer-encoding", 62 | "user-agent", 63 | "vary", 64 | "via", 65 | "www-authenticate", 66 | } { 67 | chk := http.CanonicalHeaderKey(v) 68 | commonLowerHeader[chk] = v 69 | commonCanonHeader[v] = chk 70 | } 71 | } 72 | 73 | func lowerHeader(v string) string { 74 | if s, ok := commonLowerHeader[v]; ok { 75 | return s 76 | } 77 | return strings.ToLower(v) 78 | } 79 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/http2/not_go16.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 !go1.6 6 | 7 | package http2 8 | 9 | import ( 10 | "net/http" 11 | "time" 12 | ) 13 | 14 | func configureTransport(t1 *http.Transport) (*Transport, error) { 15 | return nil, errTransportVersion 16 | } 17 | 18 | func transportExpectContinueTimeout(t1 *http.Transport) time.Duration { 19 | return 0 20 | 21 | } 22 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/http2/not_go18.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 !go1.8 6 | 7 | package http2 8 | 9 | import ( 10 | "io" 11 | "net/http" 12 | ) 13 | 14 | func configureServer18(h1 *http.Server, h2 *Server) error { 15 | // No IdleTimeout to sync prior to Go 1.8. 16 | return nil 17 | } 18 | 19 | func shouldLogPanic(panicValue interface{}) bool { 20 | return panicValue != nil 21 | } 22 | 23 | func reqGetBody(req *http.Request) func() (io.ReadCloser, error) { 24 | return nil 25 | } 26 | 27 | func reqBodyIsNoBody(io.ReadCloser) bool { return false } 28 | 29 | func go18httpNoBody() io.ReadCloser { return nil } // for tests only 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/http2/not_go19.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 !go1.9 6 | 7 | package http2 8 | 9 | import ( 10 | "net/http" 11 | ) 12 | 13 | func configureServer19(s *http.Server, conf *Server) error { 14 | // not supported prior to go1.9 15 | return nil 16 | } 17 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/http2/writesched_random.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package http2 6 | 7 | import "math" 8 | 9 | // NewRandomWriteScheduler constructs a WriteScheduler that ignores HTTP/2 10 | // priorities. Control frames like SETTINGS and PING are written before DATA 11 | // frames, but if no control frames are queued and multiple streams have queued 12 | // HEADERS or DATA frames, Pop selects a ready stream arbitrarily. 13 | func NewRandomWriteScheduler() WriteScheduler { 14 | return &randomWriteScheduler{sq: make(map[uint32]*writeQueue)} 15 | } 16 | 17 | type randomWriteScheduler struct { 18 | // zero are frames not associated with a specific stream. 19 | zero writeQueue 20 | 21 | // sq contains the stream-specific queues, keyed by stream ID. 22 | // When a stream is idle or closed, it's deleted from the map. 23 | sq map[uint32]*writeQueue 24 | 25 | // pool of empty queues for reuse. 26 | queuePool writeQueuePool 27 | } 28 | 29 | func (ws *randomWriteScheduler) OpenStream(streamID uint32, options OpenStreamOptions) { 30 | // no-op: idle streams are not tracked 31 | } 32 | 33 | func (ws *randomWriteScheduler) CloseStream(streamID uint32) { 34 | q, ok := ws.sq[streamID] 35 | if !ok { 36 | return 37 | } 38 | delete(ws.sq, streamID) 39 | ws.queuePool.put(q) 40 | } 41 | 42 | func (ws *randomWriteScheduler) AdjustStream(streamID uint32, priority PriorityParam) { 43 | // no-op: priorities are ignored 44 | } 45 | 46 | func (ws *randomWriteScheduler) Push(wr FrameWriteRequest) { 47 | id := wr.StreamID() 48 | if id == 0 { 49 | ws.zero.push(wr) 50 | return 51 | } 52 | q, ok := ws.sq[id] 53 | if !ok { 54 | q = ws.queuePool.get() 55 | ws.sq[id] = q 56 | } 57 | q.push(wr) 58 | } 59 | 60 | func (ws *randomWriteScheduler) Pop() (FrameWriteRequest, bool) { 61 | // Control frames first. 62 | if !ws.zero.empty() { 63 | return ws.zero.shift(), true 64 | } 65 | // Iterate over all non-idle streams until finding one that can be consumed. 66 | for _, q := range ws.sq { 67 | if wr, ok := q.consume(math.MaxInt32); ok { 68 | return wr, true 69 | } 70 | } 71 | return FrameWriteRequest{}, false 72 | } 73 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/idna/trie.go: -------------------------------------------------------------------------------- 1 | // Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. 2 | 3 | // Copyright 2016 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 idna 8 | 9 | // appendMapping appends the mapping for the respective rune. isMapped must be 10 | // true. A mapping is a categorization of a rune as defined in UTS #46. 11 | func (c info) appendMapping(b []byte, s string) []byte { 12 | index := int(c >> indexShift) 13 | if c&xorBit == 0 { 14 | s := mappings[index:] 15 | return append(b, s[1:s[0]+1]...) 16 | } 17 | b = append(b, s...) 18 | if c&inlineXOR == inlineXOR { 19 | // TODO: support and handle two-byte inline masks 20 | b[len(b)-1] ^= byte(index) 21 | } else { 22 | for p := len(b) - int(xorData[index]); p < len(b); p++ { 23 | index++ 24 | b[p] ^= xorData[index] 25 | } 26 | } 27 | return b 28 | } 29 | 30 | // Sparse block handling code. 31 | 32 | type valueRange struct { 33 | value uint16 // header: value:stride 34 | lo, hi byte // header: lo:n 35 | } 36 | 37 | type sparseBlocks struct { 38 | values []valueRange 39 | offset []uint16 40 | } 41 | 42 | var idnaSparse = sparseBlocks{ 43 | values: idnaSparseValues[:], 44 | offset: idnaSparseOffset[:], 45 | } 46 | 47 | // Don't use newIdnaTrie to avoid unconditional linking in of the table. 48 | var trie = &idnaTrie{} 49 | 50 | // lookup determines the type of block n and looks up the value for b. 51 | // For n < t.cutoff, the block is a simple lookup table. Otherwise, the block 52 | // is a list of ranges with an accompanying value. Given a matching range r, 53 | // the value for b is by r.value + (b - r.lo) * stride. 54 | func (t *sparseBlocks) lookup(n uint32, b byte) uint16 { 55 | offset := t.offset[n] 56 | header := t.values[offset] 57 | lo := offset + 1 58 | hi := lo + uint16(header.lo) 59 | for lo < hi { 60 | m := lo + (hi-lo)/2 61 | r := t.values[m] 62 | if r.lo <= b && b <= r.hi { 63 | return r.value + uint16(b-r.lo)*header.value 64 | } 65 | if b < r.lo { 66 | hi = m 67 | } else { 68 | lo = m + 1 69 | } 70 | } 71 | return 0 72 | } 73 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/trace/trace_go16.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 !go1.7 6 | 7 | package trace 8 | 9 | import "golang.org/x/net/context" 10 | 11 | // NewContext returns a copy of the parent context 12 | // and associates it with a Trace. 13 | func NewContext(ctx context.Context, tr Trace) context.Context { 14 | return context.WithValue(ctx, contextKey, tr) 15 | } 16 | 17 | // FromContext returns the Trace bound to the context, if any. 18 | func FromContext(ctx context.Context) (tr Trace, ok bool) { 19 | tr, ok = ctx.Value(contextKey).(Trace) 20 | return 21 | } 22 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/trace/trace_go17.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 go1.7 6 | 7 | package trace 8 | 9 | import "context" 10 | 11 | // NewContext returns a copy of the parent context 12 | // and associates it with a Trace. 13 | func NewContext(ctx context.Context, tr Trace) context.Context { 14 | return context.WithValue(ctx, contextKey, tr) 15 | } 16 | 17 | // FromContext returns the Trace bound to the context, if any. 18 | func FromContext(ctx context.Context) (tr Trace, ok bool) { 19 | tr, ok = ctx.Value(contextKey).(Trace) 20 | return 21 | } 22 | -------------------------------------------------------------------------------- /vendor/golang.org/x/text/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/text/CONTRIBUTORS: -------------------------------------------------------------------------------- 1 | # This source code was written by the Go contributors. 2 | # The master list of contributors is in the main Go distribution, 3 | # visible at http://tip.golang.org/CONTRIBUTORS. 4 | -------------------------------------------------------------------------------- /vendor/golang.org/x/text/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2009 The Go Authors. All rights reserved. 2 | 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions are 5 | met: 6 | 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above 10 | copyright notice, this list of conditions and the following disclaimer 11 | in the documentation and/or other materials provided with the 12 | distribution. 13 | * Neither the name of Google Inc. nor the names of its 14 | contributors may be used to endorse or promote products derived from 15 | this software without specific prior written permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | -------------------------------------------------------------------------------- /vendor/golang.org/x/text/PATENTS: -------------------------------------------------------------------------------- 1 | Additional IP Rights Grant (Patents) 2 | 3 | "This implementation" means the copyrightable works distributed by 4 | Google as part of the Go project. 5 | 6 | Google hereby grants to You a perpetual, worldwide, non-exclusive, 7 | no-charge, royalty-free, irrevocable (except as stated in this section) 8 | patent license to make, have made, use, offer to sell, sell, import, 9 | transfer and otherwise run, modify and propagate the contents of this 10 | implementation of Go, where such license applies only to those patent 11 | claims, both currently owned or controlled by Google and acquired in 12 | the future, licensable by Google that are necessarily infringed by this 13 | implementation of Go. This grant does not include claims that would be 14 | infringed only as a consequence of further modification of this 15 | implementation. If you or your agent or exclusive licensee institute or 16 | order or agree to the institution of patent litigation against any 17 | entity (including a cross-claim or counterclaim in a lawsuit) alleging 18 | that this implementation of Go or any code incorporated within this 19 | implementation of Go constitutes direct or contributory patent 20 | infringement, or inducement of patent infringement, then any patent 21 | rights granted to you under this License for this implementation of Go 22 | shall terminate as of the date such litigation is filed. 23 | -------------------------------------------------------------------------------- /vendor/golang.org/x/text/collate/build/table.go: -------------------------------------------------------------------------------- 1 | // Copyright 2012 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package build 6 | 7 | import ( 8 | "fmt" 9 | "io" 10 | "reflect" 11 | 12 | "golang.org/x/text/internal/colltab" 13 | ) 14 | 15 | // table is an intermediate structure that roughly resembles the table in collate. 16 | type table struct { 17 | colltab.Table 18 | trie trie 19 | root *trieHandle 20 | } 21 | 22 | // print writes the table as Go compilable code to w. It prefixes the 23 | // variable names with name. It returns the number of bytes written 24 | // and the size of the resulting table. 25 | func (t *table) fprint(w io.Writer, name string) (n, size int, err error) { 26 | update := func(nn, sz int, e error) { 27 | n += nn 28 | if err == nil { 29 | err = e 30 | } 31 | size += sz 32 | } 33 | // Write arrays needed for the structure. 34 | update(printColElems(w, t.ExpandElem, name+"ExpandElem")) 35 | update(printColElems(w, t.ContractElem, name+"ContractElem")) 36 | update(t.trie.printArrays(w, name)) 37 | update(printArray(t.ContractTries, w, name)) 38 | 39 | nn, e := fmt.Fprintf(w, "// Total size of %sTable is %d bytes\n", name, size) 40 | update(nn, 0, e) 41 | return 42 | } 43 | 44 | func (t *table) fprintIndex(w io.Writer, h *trieHandle, id string) (n int, err error) { 45 | p := func(f string, a ...interface{}) { 46 | nn, e := fmt.Fprintf(w, f, a...) 47 | n += nn 48 | if err == nil { 49 | err = e 50 | } 51 | } 52 | p("\t{ // %s\n", id) 53 | p("\t\tlookupOffset: 0x%x,\n", h.lookupStart) 54 | p("\t\tvaluesOffset: 0x%x,\n", h.valueStart) 55 | p("\t},\n") 56 | return 57 | } 58 | 59 | func printColElems(w io.Writer, a []uint32, name string) (n, sz int, err error) { 60 | p := func(f string, a ...interface{}) { 61 | nn, e := fmt.Fprintf(w, f, a...) 62 | n += nn 63 | if err == nil { 64 | err = e 65 | } 66 | } 67 | sz = len(a) * int(reflect.TypeOf(uint32(0)).Size()) 68 | p("// %s: %d entries, %d bytes\n", name, len(a), sz) 69 | p("var %s = [%d]uint32 {", name, len(a)) 70 | for i, c := range a { 71 | switch { 72 | case i%64 == 0: 73 | p("\n\t// Block %d, offset 0x%x\n", i/64, i) 74 | case (i%64)%6 == 0: 75 | p("\n\t") 76 | } 77 | p("0x%.8X, ", c) 78 | } 79 | p("\n}\n\n") 80 | return 81 | } 82 | -------------------------------------------------------------------------------- /vendor/golang.org/x/text/collate/index.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package collate 6 | 7 | import "golang.org/x/text/internal/colltab" 8 | 9 | const blockSize = 64 10 | 11 | func getTable(t tableIndex) *colltab.Table { 12 | return &colltab.Table{ 13 | Index: colltab.Trie{ 14 | Index0: mainLookup[:][blockSize*t.lookupOffset:], 15 | Values0: mainValues[:][blockSize*t.valuesOffset:], 16 | Index: mainLookup[:], 17 | Values: mainValues[:], 18 | }, 19 | ExpandElem: mainExpandElem[:], 20 | ContractTries: colltab.ContractTrieSet(mainCTEntries[:]), 21 | ContractElem: mainContractElem[:], 22 | MaxContractLen: 18, 23 | VariableTop: varTop, 24 | } 25 | } 26 | 27 | // tableIndex holds information for constructing a table 28 | // for a certain locale based on the main table. 29 | type tableIndex struct { 30 | lookupOffset uint32 31 | valuesOffset uint32 32 | } 33 | -------------------------------------------------------------------------------- /vendor/golang.org/x/text/collate/sort.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package collate 6 | 7 | import ( 8 | "bytes" 9 | "sort" 10 | ) 11 | 12 | const ( 13 | maxSortBuffer = 40960 14 | maxSortEntries = 4096 15 | ) 16 | 17 | type swapper interface { 18 | Swap(i, j int) 19 | } 20 | 21 | type sorter struct { 22 | buf *Buffer 23 | keys [][]byte 24 | src swapper 25 | } 26 | 27 | func (s *sorter) init(n int) { 28 | if s.buf == nil { 29 | s.buf = &Buffer{} 30 | s.buf.init() 31 | } 32 | if cap(s.keys) < n { 33 | s.keys = make([][]byte, n) 34 | } 35 | s.keys = s.keys[0:n] 36 | } 37 | 38 | func (s *sorter) sort(src swapper) { 39 | s.src = src 40 | sort.Sort(s) 41 | } 42 | 43 | func (s sorter) Len() int { 44 | return len(s.keys) 45 | } 46 | 47 | func (s sorter) Less(i, j int) bool { 48 | return bytes.Compare(s.keys[i], s.keys[j]) == -1 49 | } 50 | 51 | func (s sorter) Swap(i, j int) { 52 | s.keys[i], s.keys[j] = s.keys[j], s.keys[i] 53 | s.src.Swap(i, j) 54 | } 55 | 56 | // A Lister can be sorted by Collator's Sort method. 57 | type Lister interface { 58 | Len() int 59 | Swap(i, j int) 60 | // Bytes returns the bytes of the text at index i. 61 | Bytes(i int) []byte 62 | } 63 | 64 | // Sort uses sort.Sort to sort the strings represented by x using the rules of c. 65 | func (c *Collator) Sort(x Lister) { 66 | n := x.Len() 67 | c.sorter.init(n) 68 | for i := 0; i < n; i++ { 69 | c.sorter.keys[i] = c.Key(c.sorter.buf, x.Bytes(i)) 70 | } 71 | c.sorter.sort(x) 72 | } 73 | 74 | // SortStrings uses sort.Sort to sort the strings in x using the rules of c. 75 | func (c *Collator) SortStrings(x []string) { 76 | c.sorter.init(len(x)) 77 | for i, s := range x { 78 | c.sorter.keys[i] = c.KeyFromString(c.sorter.buf, s) 79 | } 80 | c.sorter.sort(sort.StringSlice(x)) 81 | } 82 | -------------------------------------------------------------------------------- /vendor/golang.org/x/text/internal/colltab/weighter.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package colltab // import "golang.org/x/text/internal/colltab" 6 | 7 | // A Weighter can be used as a source for Collator and Searcher. 8 | type Weighter interface { 9 | // Start finds the start of the segment that includes position p. 10 | Start(p int, b []byte) int 11 | 12 | // StartString finds the start of the segment that includes position p. 13 | StartString(p int, s string) int 14 | 15 | // AppendNext appends Elems to buf corresponding to the longest match 16 | // of a single character or contraction from the start of s. 17 | // It returns the new buf and the number of bytes consumed. 18 | AppendNext(buf []Elem, s []byte) (ce []Elem, n int) 19 | 20 | // AppendNextString appends Elems to buf corresponding to the longest match 21 | // of a single character or contraction from the start of s. 22 | // It returns the new buf and the number of bytes consumed. 23 | AppendNextString(buf []Elem, s string) (ce []Elem, n int) 24 | 25 | // Domain returns a slice of all single characters and contractions for which 26 | // collation elements are defined in this table. 27 | Domain() []string 28 | 29 | // Top returns the highest variable primary value. 30 | Top() uint32 31 | } 32 | -------------------------------------------------------------------------------- /vendor/golang.org/x/text/internal/triegen/compact.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package triegen 6 | 7 | // This file defines Compacter and its implementations. 8 | 9 | import "io" 10 | 11 | // A Compacter generates an alternative, more space-efficient way to store a 12 | // trie value block. A trie value block holds all possible values for the last 13 | // byte of a UTF-8 encoded rune. Excluding ASCII characters, a trie value block 14 | // always has 64 values, as a UTF-8 encoding ends with a byte in [0x80, 0xC0). 15 | type Compacter interface { 16 | // Size returns whether the Compacter could encode the given block as well 17 | // as its size in case it can. len(v) is always 64. 18 | Size(v []uint64) (sz int, ok bool) 19 | 20 | // Store stores the block using the Compacter's compression method. 21 | // It returns a handle with which the block can be retrieved. 22 | // len(v) is always 64. 23 | Store(v []uint64) uint32 24 | 25 | // Print writes the data structures associated to the given store to w. 26 | Print(w io.Writer) error 27 | 28 | // Handler returns the name of a function that gets called during trie 29 | // lookup for blocks generated by the Compacter. The function should be of 30 | // the form func (n uint32, b byte) uint64, where n is the index returned by 31 | // the Compacter's Store method and b is the last byte of the UTF-8 32 | // encoding, where 0x80 <= b < 0xC0, for which to do the lookup in the 33 | // block. 34 | Handler() string 35 | } 36 | 37 | // simpleCompacter is the default Compacter used by builder. It implements a 38 | // normal trie block. 39 | type simpleCompacter builder 40 | 41 | func (b *simpleCompacter) Size([]uint64) (sz int, ok bool) { 42 | return blockSize * b.ValueSize, true 43 | } 44 | 45 | func (b *simpleCompacter) Store(v []uint64) uint32 { 46 | h := uint32(len(b.ValueBlocks) - blockOffset) 47 | b.ValueBlocks = append(b.ValueBlocks, v) 48 | return h 49 | } 50 | 51 | func (b *simpleCompacter) Print(io.Writer) error { 52 | // Structures are printed in print.go. 53 | return nil 54 | } 55 | 56 | func (b *simpleCompacter) Handler() string { 57 | panic("Handler should be special-cased for this Compacter") 58 | } 59 | -------------------------------------------------------------------------------- /vendor/golang.org/x/text/language/Makefile: -------------------------------------------------------------------------------- 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 | CLEANFILES+=maketables 6 | 7 | maketables: maketables.go 8 | go build $^ 9 | 10 | tables: maketables 11 | ./maketables > tables.go 12 | gofmt -w -s tables.go 13 | 14 | # Build (but do not run) maketables during testing, 15 | # just to make sure it still compiles. 16 | testshort: maketables 17 | -------------------------------------------------------------------------------- /vendor/golang.org/x/text/language/common.go: -------------------------------------------------------------------------------- 1 | // Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. 2 | 3 | package language 4 | 5 | // This file contains code common to the maketables.go and the package code. 6 | 7 | // langAliasType is the type of an alias in langAliasMap. 8 | type langAliasType int8 9 | 10 | const ( 11 | langDeprecated langAliasType = iota 12 | langMacro 13 | langLegacy 14 | 15 | langAliasTypeUnknown langAliasType = -1 16 | ) 17 | -------------------------------------------------------------------------------- /vendor/golang.org/x/text/language/gen_common.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 ignore 6 | 7 | package main 8 | 9 | // This file contains code common to the maketables.go and the package code. 10 | 11 | // langAliasType is the type of an alias in langAliasMap. 12 | type langAliasType int8 13 | 14 | const ( 15 | langDeprecated langAliasType = iota 16 | langMacro 17 | langLegacy 18 | 19 | langAliasTypeUnknown langAliasType = -1 20 | ) 21 | -------------------------------------------------------------------------------- /vendor/golang.org/x/text/language/go1_1.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 !go1.2 6 | 7 | package language 8 | 9 | import "sort" 10 | 11 | func sortStable(s sort.Interface) { 12 | ss := stableSort{ 13 | s: s, 14 | pos: make([]int, s.Len()), 15 | } 16 | for i := range ss.pos { 17 | ss.pos[i] = i 18 | } 19 | sort.Sort(&ss) 20 | } 21 | 22 | type stableSort struct { 23 | s sort.Interface 24 | pos []int 25 | } 26 | 27 | func (s *stableSort) Len() int { 28 | return len(s.pos) 29 | } 30 | 31 | func (s *stableSort) Less(i, j int) bool { 32 | return s.s.Less(i, j) || !s.s.Less(j, i) && s.pos[i] < s.pos[j] 33 | } 34 | 35 | func (s *stableSort) Swap(i, j int) { 36 | s.s.Swap(i, j) 37 | s.pos[i], s.pos[j] = s.pos[j], s.pos[i] 38 | } 39 | -------------------------------------------------------------------------------- /vendor/golang.org/x/text/language/go1_2.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 go1.2 6 | 7 | package language 8 | 9 | import "sort" 10 | 11 | var sortStable = sort.Stable 12 | -------------------------------------------------------------------------------- /vendor/golang.org/x/text/secure/bidirule/bidirule10.0.0.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 go1.10 6 | 7 | package bidirule 8 | 9 | func (t *Transformer) isFinal() bool { 10 | return t.state == ruleLTRFinal || t.state == ruleRTLFinal || t.state == ruleInitial 11 | } 12 | -------------------------------------------------------------------------------- /vendor/golang.org/x/text/secure/bidirule/bidirule9.0.0.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 !go1.10 6 | 7 | package bidirule 8 | 9 | func (t *Transformer) isFinal() bool { 10 | if !t.isRTL() { 11 | return true 12 | } 13 | return t.state == ruleLTRFinal || t.state == ruleRTLFinal || t.state == ruleInitial 14 | } 15 | -------------------------------------------------------------------------------- /vendor/golang.org/x/text/unicode/bidi/gen_ranges.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 ignore 6 | 7 | package main 8 | 9 | import ( 10 | "unicode" 11 | 12 | "golang.org/x/text/internal/gen" 13 | "golang.org/x/text/internal/ucd" 14 | "golang.org/x/text/unicode/rangetable" 15 | ) 16 | 17 | // These tables are hand-extracted from: 18 | // http://www.unicode.org/Public/8.0.0/ucd/extracted/DerivedBidiClass.txt 19 | func visitDefaults(fn func(r rune, c Class)) { 20 | // first write default values for ranges listed above. 21 | visitRunes(fn, AL, []rune{ 22 | 0x0600, 0x07BF, // Arabic 23 | 0x08A0, 0x08FF, // Arabic Extended-A 24 | 0xFB50, 0xFDCF, // Arabic Presentation Forms 25 | 0xFDF0, 0xFDFF, 26 | 0xFE70, 0xFEFF, 27 | 0x0001EE00, 0x0001EEFF, // Arabic Mathematical Alpha Symbols 28 | }) 29 | visitRunes(fn, R, []rune{ 30 | 0x0590, 0x05FF, // Hebrew 31 | 0x07C0, 0x089F, // Nko et al. 32 | 0xFB1D, 0xFB4F, 33 | 0x00010800, 0x00010FFF, // Cypriot Syllabary et. al. 34 | 0x0001E800, 0x0001EDFF, 35 | 0x0001EF00, 0x0001EFFF, 36 | }) 37 | visitRunes(fn, ET, []rune{ // European Terminator 38 | 0x20A0, 0x20Cf, // Currency symbols 39 | }) 40 | rangetable.Visit(unicode.Noncharacter_Code_Point, func(r rune) { 41 | fn(r, BN) // Boundary Neutral 42 | }) 43 | ucd.Parse(gen.OpenUCDFile("DerivedCoreProperties.txt"), func(p *ucd.Parser) { 44 | if p.String(1) == "Default_Ignorable_Code_Point" { 45 | fn(p.Rune(0), BN) // Boundary Neutral 46 | } 47 | }) 48 | } 49 | 50 | func visitRunes(fn func(r rune, c Class), c Class, runes []rune) { 51 | for i := 0; i < len(runes); i += 2 { 52 | lo, hi := runes[i], runes[i+1] 53 | for j := lo; j <= hi; j++ { 54 | fn(j, c) 55 | } 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /vendor/golang.org/x/text/unicode/bidi/gen_trieval.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 ignore 6 | 7 | package main 8 | 9 | // Class is the Unicode BiDi class. Each rune has a single class. 10 | type Class uint 11 | 12 | const ( 13 | L Class = iota // LeftToRight 14 | R // RightToLeft 15 | EN // EuropeanNumber 16 | ES // EuropeanSeparator 17 | ET // EuropeanTerminator 18 | AN // ArabicNumber 19 | CS // CommonSeparator 20 | B // ParagraphSeparator 21 | S // SegmentSeparator 22 | WS // WhiteSpace 23 | ON // OtherNeutral 24 | BN // BoundaryNeutral 25 | NSM // NonspacingMark 26 | AL // ArabicLetter 27 | Control // Control LRO - PDI 28 | 29 | numClass 30 | 31 | LRO // LeftToRightOverride 32 | RLO // RightToLeftOverride 33 | LRE // LeftToRightEmbedding 34 | RLE // RightToLeftEmbedding 35 | PDF // PopDirectionalFormat 36 | LRI // LeftToRightIsolate 37 | RLI // RightToLeftIsolate 38 | FSI // FirstStrongIsolate 39 | PDI // PopDirectionalIsolate 40 | 41 | unknownClass = ^Class(0) 42 | ) 43 | 44 | var controlToClass = map[rune]Class{ 45 | 0x202D: LRO, // LeftToRightOverride, 46 | 0x202E: RLO, // RightToLeftOverride, 47 | 0x202A: LRE, // LeftToRightEmbedding, 48 | 0x202B: RLE, // RightToLeftEmbedding, 49 | 0x202C: PDF, // PopDirectionalFormat, 50 | 0x2066: LRI, // LeftToRightIsolate, 51 | 0x2067: RLI, // RightToLeftIsolate, 52 | 0x2068: FSI, // FirstStrongIsolate, 53 | 0x2069: PDI, // PopDirectionalIsolate, 54 | } 55 | 56 | // A trie entry has the following bits: 57 | // 7..5 XOR mask for brackets 58 | // 4 1: Bracket open, 0: Bracket close 59 | // 3..0 Class type 60 | 61 | const ( 62 | openMask = 0x10 63 | xorMaskShift = 5 64 | ) 65 | -------------------------------------------------------------------------------- /vendor/golang.org/x/text/unicode/bidi/trieval.go: -------------------------------------------------------------------------------- 1 | // Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. 2 | 3 | package bidi 4 | 5 | // Class is the Unicode BiDi class. Each rune has a single class. 6 | type Class uint 7 | 8 | const ( 9 | L Class = iota // LeftToRight 10 | R // RightToLeft 11 | EN // EuropeanNumber 12 | ES // EuropeanSeparator 13 | ET // EuropeanTerminator 14 | AN // ArabicNumber 15 | CS // CommonSeparator 16 | B // ParagraphSeparator 17 | S // SegmentSeparator 18 | WS // WhiteSpace 19 | ON // OtherNeutral 20 | BN // BoundaryNeutral 21 | NSM // NonspacingMark 22 | AL // ArabicLetter 23 | Control // Control LRO - PDI 24 | 25 | numClass 26 | 27 | LRO // LeftToRightOverride 28 | RLO // RightToLeftOverride 29 | LRE // LeftToRightEmbedding 30 | RLE // RightToLeftEmbedding 31 | PDF // PopDirectionalFormat 32 | LRI // LeftToRightIsolate 33 | RLI // RightToLeftIsolate 34 | FSI // FirstStrongIsolate 35 | PDI // PopDirectionalIsolate 36 | 37 | unknownClass = ^Class(0) 38 | ) 39 | 40 | var controlToClass = map[rune]Class{ 41 | 0x202D: LRO, // LeftToRightOverride, 42 | 0x202E: RLO, // RightToLeftOverride, 43 | 0x202A: LRE, // LeftToRightEmbedding, 44 | 0x202B: RLE, // RightToLeftEmbedding, 45 | 0x202C: PDF, // PopDirectionalFormat, 46 | 0x2066: LRI, // LeftToRightIsolate, 47 | 0x2067: RLI, // RightToLeftIsolate, 48 | 0x2068: FSI, // FirstStrongIsolate, 49 | 0x2069: PDI, // PopDirectionalIsolate, 50 | } 51 | 52 | // A trie entry has the following bits: 53 | // 7..5 XOR mask for brackets 54 | // 4 1: Bracket open, 0: Bracket close 55 | // 3..0 Class type 56 | 57 | const ( 58 | openMask = 0x10 59 | xorMaskShift = 5 60 | ) 61 | -------------------------------------------------------------------------------- /vendor/golang.org/x/text/unicode/norm/trie.go: -------------------------------------------------------------------------------- 1 | // Copyright 2011 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package norm 6 | 7 | type valueRange struct { 8 | value uint16 // header: value:stride 9 | lo, hi byte // header: lo:n 10 | } 11 | 12 | type sparseBlocks struct { 13 | values []valueRange 14 | offset []uint16 15 | } 16 | 17 | var nfcSparse = sparseBlocks{ 18 | values: nfcSparseValues[:], 19 | offset: nfcSparseOffset[:], 20 | } 21 | 22 | var nfkcSparse = sparseBlocks{ 23 | values: nfkcSparseValues[:], 24 | offset: nfkcSparseOffset[:], 25 | } 26 | 27 | var ( 28 | nfcData = newNfcTrie(0) 29 | nfkcData = newNfkcTrie(0) 30 | ) 31 | 32 | // lookupValue determines the type of block n and looks up the value for b. 33 | // For n < t.cutoff, the block is a simple lookup table. Otherwise, the block 34 | // is a list of ranges with an accompanying value. Given a matching range r, 35 | // the value for b is by r.value + (b - r.lo) * stride. 36 | func (t *sparseBlocks) lookup(n uint32, b byte) uint16 { 37 | offset := t.offset[n] 38 | header := t.values[offset] 39 | lo := offset + 1 40 | hi := lo + uint16(header.lo) 41 | for lo < hi { 42 | m := lo + (hi-lo)/2 43 | r := t.values[m] 44 | if r.lo <= b && b <= r.hi { 45 | return r.value + uint16(b-r.lo)*header.value 46 | } 47 | if b < r.lo { 48 | hi = m 49 | } else { 50 | lo = m + 1 51 | } 52 | } 53 | return 0 54 | } 55 | -------------------------------------------------------------------------------- /vendor/golang.org/x/text/unicode/rangetable/rangetable.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // Package rangetable provides utilities for creating and inspecting 6 | // unicode.RangeTables. 7 | package rangetable 8 | 9 | import ( 10 | "sort" 11 | "unicode" 12 | ) 13 | 14 | // New creates a RangeTable from the given runes, which may contain duplicates. 15 | func New(r ...rune) *unicode.RangeTable { 16 | if len(r) == 0 { 17 | return &unicode.RangeTable{} 18 | } 19 | 20 | sort.Sort(byRune(r)) 21 | 22 | // Remove duplicates. 23 | k := 1 24 | for i := 1; i < len(r); i++ { 25 | if r[k-1] != r[i] { 26 | r[k] = r[i] 27 | k++ 28 | } 29 | } 30 | 31 | var rt unicode.RangeTable 32 | for _, r := range r[:k] { 33 | if r <= 0xFFFF { 34 | rt.R16 = append(rt.R16, unicode.Range16{Lo: uint16(r), Hi: uint16(r), Stride: 1}) 35 | } else { 36 | rt.R32 = append(rt.R32, unicode.Range32{Lo: uint32(r), Hi: uint32(r), Stride: 1}) 37 | } 38 | } 39 | 40 | // Optimize RangeTable. 41 | return Merge(&rt) 42 | } 43 | 44 | type byRune []rune 45 | 46 | func (r byRune) Len() int { return len(r) } 47 | func (r byRune) Swap(i, j int) { r[i], r[j] = r[j], r[i] } 48 | func (r byRune) Less(i, j int) bool { return r[i] < r[j] } 49 | 50 | // Visit visits all runes in the given RangeTable in order, calling fn for each. 51 | func Visit(rt *unicode.RangeTable, fn func(rune)) { 52 | for _, r16 := range rt.R16 { 53 | for r := rune(r16.Lo); r <= rune(r16.Hi); r += rune(r16.Stride) { 54 | fn(r) 55 | } 56 | } 57 | for _, r32 := range rt.R32 { 58 | for r := rune(r32.Lo); r <= rune(r32.Hi); r += rune(r32.Stride) { 59 | fn(r) 60 | } 61 | } 62 | } 63 | 64 | // Assigned returns a RangeTable with all assigned code points for a given 65 | // Unicode version. This includes graphic, format, control, and private-use 66 | // characters. It returns nil if the data for the given version is not 67 | // available. 68 | func Assigned(version string) *unicode.RangeTable { 69 | return assigned[version] 70 | } 71 | -------------------------------------------------------------------------------- /vendor/google.golang.org/grpc/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | 3 | go: 4 | - 1.6.x 5 | - 1.7.x 6 | - 1.8.x 7 | - 1.9.x 8 | - 1.10.x 9 | 10 | matrix: 11 | include: 12 | - go: 1.10.x 13 | env: RUN386=1 14 | 15 | go_import_path: google.golang.org/grpc 16 | 17 | before_install: 18 | - if [[ -n "$RUN386" ]]; then export GOARCH=386; fi 19 | - if [[ "$TRAVIS_GO_VERSION" = 1.10* && "$GOARCH" != "386" ]]; then ./vet.sh -install || exit 1; fi 20 | 21 | script: 22 | - if [[ "$TRAVIS_GO_VERSION" = 1.10* && "$GOARCH" != "386" ]]; then ./vet.sh || exit 1; fi 23 | - make test || exit 1 24 | - if [[ "$GOARCH" != "386" ]]; then make testrace; fi 25 | -------------------------------------------------------------------------------- /vendor/google.golang.org/grpc/AUTHORS: -------------------------------------------------------------------------------- 1 | Google Inc. 2 | -------------------------------------------------------------------------------- /vendor/google.golang.org/grpc/Makefile: -------------------------------------------------------------------------------- 1 | all: vet test testrace 2 | 3 | deps: 4 | go get -d -v google.golang.org/grpc/... 5 | 6 | updatedeps: 7 | go get -d -v -u -f google.golang.org/grpc/... 8 | 9 | testdeps: 10 | go get -d -v -t google.golang.org/grpc/... 11 | 12 | updatetestdeps: 13 | go get -d -v -t -u -f google.golang.org/grpc/... 14 | 15 | build: deps 16 | go build google.golang.org/grpc/... 17 | 18 | proto: 19 | @ if ! which protoc > /dev/null; then \ 20 | echo "error: protoc not installed" >&2; \ 21 | exit 1; \ 22 | fi 23 | go generate google.golang.org/grpc/... 24 | 25 | vet: 26 | ./vet.sh 27 | 28 | test: testdeps 29 | go test -cpu 1,4 -timeout 5m google.golang.org/grpc/... 30 | 31 | testrace: testdeps 32 | go test -race -cpu 1,4 -timeout 7m google.golang.org/grpc/... 33 | 34 | clean: 35 | go clean -i google.golang.org/grpc/... 36 | 37 | .PHONY: \ 38 | all \ 39 | deps \ 40 | updatedeps \ 41 | testdeps \ 42 | updatetestdeps \ 43 | build \ 44 | proto \ 45 | vet \ 46 | test \ 47 | testrace \ 48 | clean 49 | -------------------------------------------------------------------------------- /vendor/google.golang.org/grpc/README.md: -------------------------------------------------------------------------------- 1 | # gRPC-Go 2 | 3 | [![Build Status](https://travis-ci.org/grpc/grpc-go.svg)](https://travis-ci.org/grpc/grpc-go) [![GoDoc](https://godoc.org/google.golang.org/grpc?status.svg)](https://godoc.org/google.golang.org/grpc) [![GoReportCard](https://goreportcard.com/badge/grpc/grpc-go)](https://goreportcard.com/report/github.com/grpc/grpc-go) 4 | 5 | The Go implementation of [gRPC](https://grpc.io/): A high performance, open source, general RPC framework that puts mobile and HTTP/2 first. For more information see the [gRPC Quick Start: Go](https://grpc.io/docs/quickstart/go.html) guide. 6 | 7 | Installation 8 | ------------ 9 | 10 | To install this package, you need to install Go and setup your Go workspace on your computer. The simplest way to install the library is to run: 11 | 12 | ``` 13 | $ go get -u google.golang.org/grpc 14 | ``` 15 | 16 | Prerequisites 17 | ------------- 18 | 19 | This requires Go 1.6 or later. Go 1.7 will be required soon. 20 | 21 | Constraints 22 | ----------- 23 | The grpc package should only depend on standard Go packages and a small number of exceptions. If your contribution introduces new dependencies which are NOT in the [list](http://godoc.org/google.golang.org/grpc?imports), you need a discussion with gRPC-Go authors and consultants. 24 | 25 | Documentation 26 | ------------- 27 | See [API documentation](https://godoc.org/google.golang.org/grpc) for package and API descriptions and find examples in the [examples directory](examples/). 28 | 29 | Performance 30 | ----------- 31 | See the current benchmarks for some of the languages supported in [this dashboard](https://performance-dot-grpc-testing.appspot.com/explore?dashboard=5652536396611584&widget=490377658&container=1286539696). 32 | 33 | Status 34 | ------ 35 | General Availability [Google Cloud Platform Launch Stages](https://cloud.google.com/terms/launch-stages). 36 | 37 | FAQ 38 | --- 39 | 40 | #### Compiling error, undefined: grpc.SupportPackageIsVersion 41 | 42 | Please update proto package, gRPC package and rebuild the proto files: 43 | - `go get -u github.com/golang/protobuf/{proto,protoc-gen-go}` 44 | - `go get -u google.golang.org/grpc` 45 | - `protoc --go_out=plugins=grpc:. *.proto` 46 | -------------------------------------------------------------------------------- /vendor/google.golang.org/grpc/backoff.go: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright 2017 gRPC authors. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | 19 | // See internal/backoff package for the backoff implementation. This file is 20 | // kept for the exported types and API backward compatility. 21 | 22 | package grpc 23 | 24 | import ( 25 | "time" 26 | ) 27 | 28 | // DefaultBackoffConfig uses values specified for backoff in 29 | // https://github.com/grpc/grpc/blob/master/doc/connection-backoff.md. 30 | var DefaultBackoffConfig = BackoffConfig{ 31 | MaxDelay: 120 * time.Second, 32 | } 33 | 34 | // BackoffConfig defines the parameters for the default gRPC backoff strategy. 35 | type BackoffConfig struct { 36 | // MaxDelay is the upper bound of backoff delay. 37 | MaxDelay time.Duration 38 | } 39 | -------------------------------------------------------------------------------- /vendor/google.golang.org/grpc/balancer/base/base.go: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright 2017 gRPC authors. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | 19 | // Package base defines a balancer base that can be used to build balancers with 20 | // different picking algorithms. 21 | // 22 | // The base balancer creates a new SubConn for each resolved address. The 23 | // provided picker will only be notified about READY SubConns. 24 | // 25 | // This package is the base of round_robin balancer, its purpose is to be used 26 | // to build round_robin like balancers with complex picking algorithms. 27 | // Balancers with more complicated logic should try to implement a balancer 28 | // builder from scratch. 29 | // 30 | // All APIs in this package are experimental. 31 | package base 32 | 33 | import ( 34 | "google.golang.org/grpc/balancer" 35 | "google.golang.org/grpc/resolver" 36 | ) 37 | 38 | // PickerBuilder creates balancer.Picker. 39 | type PickerBuilder interface { 40 | // Build takes a slice of ready SubConns, and returns a picker that will be 41 | // used by gRPC to pick a SubConn. 42 | Build(readySCs map[resolver.Address]balancer.SubConn) balancer.Picker 43 | } 44 | 45 | // NewBalancerBuilder returns a balancer builder. The balancers 46 | // built by this builder will use the picker builder to build pickers. 47 | func NewBalancerBuilder(name string, pb PickerBuilder) balancer.Builder { 48 | return &baseBuilder{ 49 | name: name, 50 | pickerBuilder: pb, 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /vendor/google.golang.org/grpc/codec.go: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright 2014 gRPC authors. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | 19 | package grpc 20 | 21 | import ( 22 | "google.golang.org/grpc/encoding" 23 | _ "google.golang.org/grpc/encoding/proto" // to register the Codec for "proto" 24 | ) 25 | 26 | // baseCodec contains the functionality of both Codec and encoding.Codec, but 27 | // omits the name/string, which vary between the two and are not needed for 28 | // anything besides the registry in the encoding package. 29 | type baseCodec interface { 30 | Marshal(v interface{}) ([]byte, error) 31 | Unmarshal(data []byte, v interface{}) error 32 | } 33 | 34 | var _ baseCodec = Codec(nil) 35 | var _ baseCodec = encoding.Codec(nil) 36 | 37 | // Codec defines the interface gRPC uses to encode and decode messages. 38 | // Note that implementations of this interface must be thread safe; 39 | // a Codec's methods can be called from concurrent goroutines. 40 | // 41 | // Deprecated: use encoding.Codec instead. 42 | type Codec interface { 43 | // Marshal returns the wire format of v. 44 | Marshal(v interface{}) ([]byte, error) 45 | // Unmarshal parses the wire format into v. 46 | Unmarshal(data []byte, v interface{}) error 47 | // String returns the name of the Codec implementation. This is unused by 48 | // gRPC. 49 | String() string 50 | } 51 | -------------------------------------------------------------------------------- /vendor/google.golang.org/grpc/codegen.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # This script serves as an example to demonstrate how to generate the gRPC-Go 4 | # interface and the related messages from .proto file. 5 | # 6 | # It assumes the installation of i) Google proto buffer compiler at 7 | # https://github.com/google/protobuf (after v2.6.1) and ii) the Go codegen 8 | # plugin at https://github.com/golang/protobuf (after 2015-02-20). If you have 9 | # not, please install them first. 10 | # 11 | # We recommend running this script at $GOPATH/src. 12 | # 13 | # If this is not what you need, feel free to make your own scripts. Again, this 14 | # script is for demonstration purpose. 15 | # 16 | proto=$1 17 | protoc --go_out=plugins=grpc:. $proto 18 | -------------------------------------------------------------------------------- /vendor/google.golang.org/grpc/codes/code_string.go: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright 2017 gRPC authors. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | 19 | package codes 20 | 21 | import "strconv" 22 | 23 | func (c Code) String() string { 24 | switch c { 25 | case OK: 26 | return "OK" 27 | case Canceled: 28 | return "Canceled" 29 | case Unknown: 30 | return "Unknown" 31 | case InvalidArgument: 32 | return "InvalidArgument" 33 | case DeadlineExceeded: 34 | return "DeadlineExceeded" 35 | case NotFound: 36 | return "NotFound" 37 | case AlreadyExists: 38 | return "AlreadyExists" 39 | case PermissionDenied: 40 | return "PermissionDenied" 41 | case ResourceExhausted: 42 | return "ResourceExhausted" 43 | case FailedPrecondition: 44 | return "FailedPrecondition" 45 | case Aborted: 46 | return "Aborted" 47 | case OutOfRange: 48 | return "OutOfRange" 49 | case Unimplemented: 50 | return "Unimplemented" 51 | case Internal: 52 | return "Internal" 53 | case Unavailable: 54 | return "Unavailable" 55 | case DataLoss: 56 | return "DataLoss" 57 | case Unauthenticated: 58 | return "Unauthenticated" 59 | default: 60 | return "Code(" + strconv.FormatInt(int64(c), 10) + ")" 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /vendor/google.golang.org/grpc/connectivity/connectivity.go: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright 2017 gRPC authors. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | 19 | // Package connectivity defines connectivity semantics. 20 | // For details, see https://github.com/grpc/grpc/blob/master/doc/connectivity-semantics-and-api.md. 21 | // All APIs in this package are experimental. 22 | package connectivity 23 | 24 | import ( 25 | "golang.org/x/net/context" 26 | "google.golang.org/grpc/grpclog" 27 | ) 28 | 29 | // State indicates the state of connectivity. 30 | // It can be the state of a ClientConn or SubConn. 31 | type State int 32 | 33 | func (s State) String() string { 34 | switch s { 35 | case Idle: 36 | return "IDLE" 37 | case Connecting: 38 | return "CONNECTING" 39 | case Ready: 40 | return "READY" 41 | case TransientFailure: 42 | return "TRANSIENT_FAILURE" 43 | case Shutdown: 44 | return "SHUTDOWN" 45 | default: 46 | grpclog.Errorf("unknown connectivity state: %d", s) 47 | return "Invalid-State" 48 | } 49 | } 50 | 51 | const ( 52 | // Idle indicates the ClientConn is idle. 53 | Idle State = iota 54 | // Connecting indicates the ClienConn is connecting. 55 | Connecting 56 | // Ready indicates the ClientConn is ready for work. 57 | Ready 58 | // TransientFailure indicates the ClientConn has seen a failure but expects to recover. 59 | TransientFailure 60 | // Shutdown indicates the ClientConn has started shutting down. 61 | Shutdown 62 | ) 63 | 64 | // Reporter reports the connectivity states. 65 | type Reporter interface { 66 | // CurrentState returns the current state of the reporter. 67 | CurrentState() State 68 | // WaitForStateChange blocks until the reporter's state is different from the given state, 69 | // and returns true. 70 | // It returns false if <-ctx.Done() can proceed (ctx got timeout or got canceled). 71 | WaitForStateChange(context.Context, State) bool 72 | } 73 | -------------------------------------------------------------------------------- /vendor/google.golang.org/grpc/credentials/credentials_util_go17.go: -------------------------------------------------------------------------------- 1 | // +build go1.7 2 | // +build !go1.8 3 | 4 | /* 5 | * 6 | * Copyright 2016 gRPC authors. 7 | * 8 | * Licensed under the Apache License, Version 2.0 (the "License"); 9 | * you may not use this file except in compliance with the License. 10 | * You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | * 20 | */ 21 | 22 | package credentials 23 | 24 | import ( 25 | "crypto/tls" 26 | ) 27 | 28 | // cloneTLSConfig returns a shallow clone of the exported 29 | // fields of cfg, ignoring the unexported sync.Once, which 30 | // contains a mutex and must not be copied. 31 | // 32 | // If cfg is nil, a new zero tls.Config is returned. 33 | func cloneTLSConfig(cfg *tls.Config) *tls.Config { 34 | if cfg == nil { 35 | return &tls.Config{} 36 | } 37 | return &tls.Config{ 38 | Rand: cfg.Rand, 39 | Time: cfg.Time, 40 | Certificates: cfg.Certificates, 41 | NameToCertificate: cfg.NameToCertificate, 42 | GetCertificate: cfg.GetCertificate, 43 | RootCAs: cfg.RootCAs, 44 | NextProtos: cfg.NextProtos, 45 | ServerName: cfg.ServerName, 46 | ClientAuth: cfg.ClientAuth, 47 | ClientCAs: cfg.ClientCAs, 48 | InsecureSkipVerify: cfg.InsecureSkipVerify, 49 | CipherSuites: cfg.CipherSuites, 50 | PreferServerCipherSuites: cfg.PreferServerCipherSuites, 51 | SessionTicketsDisabled: cfg.SessionTicketsDisabled, 52 | SessionTicketKey: cfg.SessionTicketKey, 53 | ClientSessionCache: cfg.ClientSessionCache, 54 | MinVersion: cfg.MinVersion, 55 | MaxVersion: cfg.MaxVersion, 56 | CurvePreferences: cfg.CurvePreferences, 57 | DynamicRecordSizingDisabled: cfg.DynamicRecordSizingDisabled, 58 | Renegotiation: cfg.Renegotiation, 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /vendor/google.golang.org/grpc/credentials/credentials_util_go18.go: -------------------------------------------------------------------------------- 1 | // +build go1.8 2 | 3 | /* 4 | * 5 | * Copyright 2017 gRPC authors. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | */ 20 | 21 | package credentials 22 | 23 | import ( 24 | "crypto/tls" 25 | ) 26 | 27 | // cloneTLSConfig returns a shallow clone of the exported 28 | // fields of cfg, ignoring the unexported sync.Once, which 29 | // contains a mutex and must not be copied. 30 | // 31 | // If cfg is nil, a new zero tls.Config is returned. 32 | func cloneTLSConfig(cfg *tls.Config) *tls.Config { 33 | if cfg == nil { 34 | return &tls.Config{} 35 | } 36 | 37 | return cfg.Clone() 38 | } 39 | -------------------------------------------------------------------------------- /vendor/google.golang.org/grpc/credentials/credentials_util_pre_go17.go: -------------------------------------------------------------------------------- 1 | // +build !go1.7 2 | 3 | /* 4 | * 5 | * Copyright 2016 gRPC authors. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | */ 20 | 21 | package credentials 22 | 23 | import ( 24 | "crypto/tls" 25 | ) 26 | 27 | // cloneTLSConfig returns a shallow clone of the exported 28 | // fields of cfg, ignoring the unexported sync.Once, which 29 | // contains a mutex and must not be copied. 30 | // 31 | // If cfg is nil, a new zero tls.Config is returned. 32 | func cloneTLSConfig(cfg *tls.Config) *tls.Config { 33 | if cfg == nil { 34 | return &tls.Config{} 35 | } 36 | return &tls.Config{ 37 | Rand: cfg.Rand, 38 | Time: cfg.Time, 39 | Certificates: cfg.Certificates, 40 | NameToCertificate: cfg.NameToCertificate, 41 | GetCertificate: cfg.GetCertificate, 42 | RootCAs: cfg.RootCAs, 43 | NextProtos: cfg.NextProtos, 44 | ServerName: cfg.ServerName, 45 | ClientAuth: cfg.ClientAuth, 46 | ClientCAs: cfg.ClientCAs, 47 | InsecureSkipVerify: cfg.InsecureSkipVerify, 48 | CipherSuites: cfg.CipherSuites, 49 | PreferServerCipherSuites: cfg.PreferServerCipherSuites, 50 | SessionTicketsDisabled: cfg.SessionTicketsDisabled, 51 | SessionTicketKey: cfg.SessionTicketKey, 52 | ClientSessionCache: cfg.ClientSessionCache, 53 | MinVersion: cfg.MinVersion, 54 | MaxVersion: cfg.MaxVersion, 55 | CurvePreferences: cfg.CurvePreferences, 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /vendor/google.golang.org/grpc/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright 2015 gRPC authors. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | 19 | /* 20 | Package grpc implements an RPC system called gRPC. 21 | 22 | See grpc.io for more information about gRPC. 23 | */ 24 | package grpc // import "google.golang.org/grpc" 25 | -------------------------------------------------------------------------------- /vendor/google.golang.org/grpc/envconfig.go: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright 2018 gRPC authors. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | 19 | package grpc 20 | 21 | import ( 22 | "os" 23 | "strings" 24 | ) 25 | 26 | const ( 27 | envConfigPrefix = "GRPC_GO_" 28 | envConfigStickinessStr = envConfigPrefix + "STICKINESS" 29 | ) 30 | 31 | var ( 32 | envConfigStickinessOn bool 33 | ) 34 | 35 | func init() { 36 | envConfigStickinessOn = strings.EqualFold(os.Getenv(envConfigStickinessStr), "on") 37 | } 38 | -------------------------------------------------------------------------------- /vendor/google.golang.org/grpc/go16.go: -------------------------------------------------------------------------------- 1 | // +build go1.6,!go1.7 2 | 3 | /* 4 | * 5 | * Copyright 2016 gRPC authors. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | */ 20 | 21 | package grpc 22 | 23 | import ( 24 | "fmt" 25 | "io" 26 | "net" 27 | "net/http" 28 | 29 | "golang.org/x/net/context" 30 | "google.golang.org/grpc/codes" 31 | "google.golang.org/grpc/status" 32 | "google.golang.org/grpc/transport" 33 | ) 34 | 35 | // dialContext connects to the address on the named network. 36 | func dialContext(ctx context.Context, network, address string) (net.Conn, error) { 37 | return (&net.Dialer{Cancel: ctx.Done()}).Dial(network, address) 38 | } 39 | 40 | func sendHTTPRequest(ctx context.Context, req *http.Request, conn net.Conn) error { 41 | req.Cancel = ctx.Done() 42 | if err := req.Write(conn); err != nil { 43 | return fmt.Errorf("failed to write the HTTP request: %v", err) 44 | } 45 | return nil 46 | } 47 | 48 | // toRPCErr converts an error into an error from the status package. 49 | func toRPCErr(err error) error { 50 | if err == nil || err == io.EOF { 51 | return err 52 | } 53 | if _, ok := status.FromError(err); ok { 54 | return err 55 | } 56 | switch e := err.(type) { 57 | case transport.StreamError: 58 | return status.Error(e.Code, e.Desc) 59 | case transport.ConnectionError: 60 | return status.Error(codes.Unavailable, e.Desc) 61 | default: 62 | switch err { 63 | case context.DeadlineExceeded: 64 | return status.Error(codes.DeadlineExceeded, err.Error()) 65 | case context.Canceled: 66 | return status.Error(codes.Canceled, err.Error()) 67 | } 68 | } 69 | return status.Error(codes.Unknown, err.Error()) 70 | } 71 | -------------------------------------------------------------------------------- /vendor/google.golang.org/grpc/go17.go: -------------------------------------------------------------------------------- 1 | // +build go1.7 2 | 3 | /* 4 | * 5 | * Copyright 2016 gRPC authors. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | */ 20 | 21 | package grpc 22 | 23 | import ( 24 | "context" 25 | "fmt" 26 | "io" 27 | "net" 28 | "net/http" 29 | 30 | netctx "golang.org/x/net/context" 31 | "google.golang.org/grpc/codes" 32 | "google.golang.org/grpc/status" 33 | "google.golang.org/grpc/transport" 34 | ) 35 | 36 | // dialContext connects to the address on the named network. 37 | func dialContext(ctx context.Context, network, address string) (net.Conn, error) { 38 | return (&net.Dialer{}).DialContext(ctx, network, address) 39 | } 40 | 41 | func sendHTTPRequest(ctx context.Context, req *http.Request, conn net.Conn) error { 42 | req = req.WithContext(ctx) 43 | if err := req.Write(conn); err != nil { 44 | return fmt.Errorf("failed to write the HTTP request: %v", err) 45 | } 46 | return nil 47 | } 48 | 49 | // toRPCErr converts an error into an error from the status package. 50 | func toRPCErr(err error) error { 51 | if err == nil || err == io.EOF { 52 | return err 53 | } 54 | if _, ok := status.FromError(err); ok { 55 | return err 56 | } 57 | switch e := err.(type) { 58 | case transport.StreamError: 59 | return status.Error(e.Code, e.Desc) 60 | case transport.ConnectionError: 61 | return status.Error(codes.Unavailable, e.Desc) 62 | default: 63 | switch err { 64 | case context.DeadlineExceeded, netctx.DeadlineExceeded: 65 | return status.Error(codes.DeadlineExceeded, err.Error()) 66 | case context.Canceled, netctx.Canceled: 67 | return status.Error(codes.Canceled, err.Error()) 68 | } 69 | } 70 | return status.Error(codes.Unknown, err.Error()) 71 | } 72 | -------------------------------------------------------------------------------- /vendor/google.golang.org/grpc/internal/grpcrand/grpcrand.go: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright 2018 gRPC authors. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | 19 | // Package grpcrand implements math/rand functions in a concurrent-safe way 20 | // with a global random source, independent of math/rand's global source. 21 | package grpcrand 22 | 23 | import ( 24 | "math/rand" 25 | "sync" 26 | "time" 27 | ) 28 | 29 | var ( 30 | r = rand.New(rand.NewSource(time.Now().UnixNano())) 31 | mu sync.Mutex 32 | ) 33 | 34 | // Int63n implements rand.Int63n on the grpcrand global source. 35 | func Int63n(n int64) int64 { 36 | mu.Lock() 37 | res := r.Int63n(n) 38 | mu.Unlock() 39 | return res 40 | } 41 | 42 | // Intn implements rand.Intn on the grpcrand global source. 43 | func Intn(n int) int { 44 | mu.Lock() 45 | res := r.Intn(n) 46 | mu.Unlock() 47 | return res 48 | } 49 | 50 | // Float64 implements rand.Float64 on the grpcrand global source. 51 | func Float64() float64 { 52 | mu.Lock() 53 | res := r.Float64() 54 | mu.Unlock() 55 | return res 56 | } 57 | -------------------------------------------------------------------------------- /vendor/google.golang.org/grpc/internal/internal.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 gRPC authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | // Package internal contains gRPC-internal code, to avoid polluting 19 | // the godoc of the top-level grpc package. It must not import any grpc 20 | // symbols to avoid circular dependencies. 21 | package internal 22 | 23 | var ( 24 | 25 | // TestingUseHandlerImpl enables the http.Handler-based server implementation. 26 | // It must be called before Serve and requires TLS credentials. 27 | // 28 | // The provided grpcServer must be of type *grpc.Server. It is untyped 29 | // for circular dependency reasons. 30 | TestingUseHandlerImpl func(grpcServer interface{}) 31 | 32 | // WithContextDialer is exported by clientconn.go 33 | WithContextDialer interface{} // func(context.Context, string) (net.Conn, error) grpc.DialOption 34 | // WithResolverBuilder is exported by clientconn.go 35 | WithResolverBuilder interface{} // func (resolver.Builder) grpc.DialOption 36 | ) 37 | -------------------------------------------------------------------------------- /vendor/google.golang.org/grpc/naming/go17.go: -------------------------------------------------------------------------------- 1 | // +build go1.6,!go1.8 2 | 3 | /* 4 | * 5 | * Copyright 2017 gRPC authors. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | */ 20 | 21 | package naming 22 | 23 | import ( 24 | "net" 25 | 26 | "golang.org/x/net/context" 27 | ) 28 | 29 | var ( 30 | lookupHost = func(ctx context.Context, host string) ([]string, error) { return net.LookupHost(host) } 31 | lookupSRV = func(ctx context.Context, service, proto, name string) (string, []*net.SRV, error) { 32 | return net.LookupSRV(service, proto, name) 33 | } 34 | ) 35 | -------------------------------------------------------------------------------- /vendor/google.golang.org/grpc/naming/go18.go: -------------------------------------------------------------------------------- 1 | // +build go1.8 2 | 3 | /* 4 | * 5 | * Copyright 2017 gRPC authors. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | */ 20 | 21 | package naming 22 | 23 | import "net" 24 | 25 | var ( 26 | lookupHost = net.DefaultResolver.LookupHost 27 | lookupSRV = net.DefaultResolver.LookupSRV 28 | ) 29 | -------------------------------------------------------------------------------- /vendor/google.golang.org/grpc/peer/peer.go: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright 2014 gRPC authors. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | 19 | // Package peer defines various peer information associated with RPCs and 20 | // corresponding utils. 21 | package peer 22 | 23 | import ( 24 | "net" 25 | 26 | "golang.org/x/net/context" 27 | "google.golang.org/grpc/credentials" 28 | ) 29 | 30 | // Peer contains the information of the peer for an RPC, such as the address 31 | // and authentication information. 32 | type Peer struct { 33 | // Addr is the peer address. 34 | Addr net.Addr 35 | // AuthInfo is the authentication information of the transport. 36 | // It is nil if there is no transport security being used. 37 | AuthInfo credentials.AuthInfo 38 | } 39 | 40 | type peerKey struct{} 41 | 42 | // NewContext creates a new context with peer information attached. 43 | func NewContext(ctx context.Context, p *Peer) context.Context { 44 | return context.WithValue(ctx, peerKey{}, p) 45 | } 46 | 47 | // FromContext returns the peer information in ctx if it exists. 48 | func FromContext(ctx context.Context) (p *Peer, ok bool) { 49 | p, ok = ctx.Value(peerKey{}).(*Peer) 50 | return 51 | } 52 | -------------------------------------------------------------------------------- /vendor/google.golang.org/grpc/resolver/dns/go17.go: -------------------------------------------------------------------------------- 1 | // +build go1.6, !go1.8 2 | 3 | /* 4 | * 5 | * Copyright 2017 gRPC authors. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | */ 20 | 21 | package dns 22 | 23 | import ( 24 | "net" 25 | 26 | "golang.org/x/net/context" 27 | ) 28 | 29 | var ( 30 | lookupHost = func(ctx context.Context, host string) ([]string, error) { return net.LookupHost(host) } 31 | lookupSRV = func(ctx context.Context, service, proto, name string) (string, []*net.SRV, error) { 32 | return net.LookupSRV(service, proto, name) 33 | } 34 | lookupTXT = func(ctx context.Context, name string) ([]string, error) { return net.LookupTXT(name) } 35 | ) 36 | -------------------------------------------------------------------------------- /vendor/google.golang.org/grpc/resolver/dns/go18.go: -------------------------------------------------------------------------------- 1 | // +build go1.8 2 | 3 | /* 4 | * 5 | * Copyright 2017 gRPC authors. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | */ 20 | 21 | package dns 22 | 23 | import "net" 24 | 25 | var ( 26 | lookupHost = net.DefaultResolver.LookupHost 27 | lookupSRV = net.DefaultResolver.LookupSRV 28 | lookupTXT = net.DefaultResolver.LookupTXT 29 | ) 30 | -------------------------------------------------------------------------------- /vendor/google.golang.org/grpc/resolver/passthrough/passthrough.go: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright 2017 gRPC authors. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | 19 | // Package passthrough implements a pass-through resolver. It sends the target 20 | // name without scheme back to gRPC as resolved address. 21 | package passthrough 22 | 23 | import "google.golang.org/grpc/resolver" 24 | 25 | const scheme = "passthrough" 26 | 27 | type passthroughBuilder struct{} 28 | 29 | func (*passthroughBuilder) Build(target resolver.Target, cc resolver.ClientConn, opts resolver.BuildOption) (resolver.Resolver, error) { 30 | r := &passthroughResolver{ 31 | target: target, 32 | cc: cc, 33 | } 34 | r.start() 35 | return r, nil 36 | } 37 | 38 | func (*passthroughBuilder) Scheme() string { 39 | return scheme 40 | } 41 | 42 | type passthroughResolver struct { 43 | target resolver.Target 44 | cc resolver.ClientConn 45 | } 46 | 47 | func (r *passthroughResolver) start() { 48 | r.cc.NewAddress([]resolver.Address{{Addr: r.target.Endpoint}}) 49 | } 50 | 51 | func (*passthroughResolver) ResolveNow(o resolver.ResolveNowOption) {} 52 | 53 | func (*passthroughResolver) Close() {} 54 | 55 | func init() { 56 | resolver.Register(&passthroughBuilder{}) 57 | } 58 | -------------------------------------------------------------------------------- /vendor/google.golang.org/grpc/status/go16.go: -------------------------------------------------------------------------------- 1 | // +build go1.6,!go1.7 2 | 3 | /* 4 | * 5 | * Copyright 2018 gRPC authors. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | */ 20 | 21 | package status 22 | 23 | import ( 24 | "golang.org/x/net/context" 25 | "google.golang.org/grpc/codes" 26 | ) 27 | 28 | // FromContextError converts a context error into a Status. It returns a 29 | // Status with codes.OK if err is nil, or a Status with codes.Unknown if err is 30 | // non-nil and not a context error. 31 | func FromContextError(err error) *Status { 32 | switch err { 33 | case nil: 34 | return New(codes.OK, "") 35 | case context.DeadlineExceeded: 36 | return New(codes.DeadlineExceeded, err.Error()) 37 | case context.Canceled: 38 | return New(codes.Canceled, err.Error()) 39 | default: 40 | return New(codes.Unknown, err.Error()) 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /vendor/google.golang.org/grpc/status/go17.go: -------------------------------------------------------------------------------- 1 | // +build go1.7 2 | 3 | /* 4 | * 5 | * Copyright 2018 gRPC authors. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | */ 20 | 21 | package status 22 | 23 | import ( 24 | "context" 25 | 26 | netctx "golang.org/x/net/context" 27 | "google.golang.org/grpc/codes" 28 | ) 29 | 30 | // FromContextError converts a context error into a Status. It returns a 31 | // Status with codes.OK if err is nil, or a Status with codes.Unknown if err is 32 | // non-nil and not a context error. 33 | func FromContextError(err error) *Status { 34 | switch err { 35 | case nil: 36 | return New(codes.OK, "") 37 | case context.DeadlineExceeded, netctx.DeadlineExceeded: 38 | return New(codes.DeadlineExceeded, err.Error()) 39 | case context.Canceled, netctx.Canceled: 40 | return New(codes.Canceled, err.Error()) 41 | default: 42 | return New(codes.Unknown, err.Error()) 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /vendor/google.golang.org/grpc/tap/tap.go: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright 2016 gRPC authors. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | 19 | // Package tap defines the function handles which are executed on the transport 20 | // layer of gRPC-Go and related information. Everything here is EXPERIMENTAL. 21 | package tap 22 | 23 | import ( 24 | "golang.org/x/net/context" 25 | ) 26 | 27 | // Info defines the relevant information needed by the handles. 28 | type Info struct { 29 | // FullMethodName is the string of grpc method (in the format of 30 | // /package.service/method). 31 | FullMethodName string 32 | // TODO: More to be added. 33 | } 34 | 35 | // ServerInHandle defines the function which runs before a new stream is created 36 | // on the server side. If it returns a non-nil error, the stream will not be 37 | // created and a RST_STREAM will be sent back to the client with REFUSED_STREAM. 38 | // The client will receive an RPC error "code = Unavailable, desc = stream 39 | // terminated by RST_STREAM with error code: REFUSED_STREAM". 40 | // 41 | // It's intended to be used in situations where you don't want to waste the 42 | // resources to accept the new stream (e.g. rate-limiting). And the content of 43 | // the error will be ignored and won't be sent back to the client. For other 44 | // general usages, please use interceptors. 45 | // 46 | // Note that it is executed in the per-connection I/O goroutine(s) instead of 47 | // per-RPC goroutine. Therefore, users should NOT have any 48 | // blocking/time-consuming work in this handle. Otherwise all the RPCs would 49 | // slow down. Also, for the same reason, this handle won't be called 50 | // concurrently by gRPC. 51 | type ServerInHandle func(ctx context.Context, info *Info) (context.Context, error) 52 | -------------------------------------------------------------------------------- /vendor/google.golang.org/grpc/transport/go16.go: -------------------------------------------------------------------------------- 1 | // +build go1.6,!go1.7 2 | 3 | /* 4 | * 5 | * Copyright 2016 gRPC authors. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | */ 20 | 21 | package transport 22 | 23 | import ( 24 | "net" 25 | "net/http" 26 | 27 | "google.golang.org/grpc/codes" 28 | 29 | "golang.org/x/net/context" 30 | ) 31 | 32 | // dialContext connects to the address on the named network. 33 | func dialContext(ctx context.Context, network, address string) (net.Conn, error) { 34 | return (&net.Dialer{Cancel: ctx.Done()}).Dial(network, address) 35 | } 36 | 37 | // ContextErr converts the error from context package into a StreamError. 38 | func ContextErr(err error) StreamError { 39 | switch err { 40 | case context.DeadlineExceeded: 41 | return streamErrorf(codes.DeadlineExceeded, "%v", err) 42 | case context.Canceled: 43 | return streamErrorf(codes.Canceled, "%v", err) 44 | } 45 | return streamErrorf(codes.Internal, "Unexpected error from context packet: %v", err) 46 | } 47 | 48 | // contextFromRequest returns a background context. 49 | func contextFromRequest(r *http.Request) context.Context { 50 | return context.Background() 51 | } 52 | -------------------------------------------------------------------------------- /vendor/google.golang.org/grpc/transport/go17.go: -------------------------------------------------------------------------------- 1 | // +build go1.7 2 | 3 | /* 4 | * 5 | * Copyright 2016 gRPC authors. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | */ 20 | 21 | package transport 22 | 23 | import ( 24 | "context" 25 | "net" 26 | "net/http" 27 | 28 | "google.golang.org/grpc/codes" 29 | 30 | netctx "golang.org/x/net/context" 31 | ) 32 | 33 | // dialContext connects to the address on the named network. 34 | func dialContext(ctx context.Context, network, address string) (net.Conn, error) { 35 | return (&net.Dialer{}).DialContext(ctx, network, address) 36 | } 37 | 38 | // ContextErr converts the error from context package into a StreamError. 39 | func ContextErr(err error) StreamError { 40 | switch err { 41 | case context.DeadlineExceeded, netctx.DeadlineExceeded: 42 | return streamErrorf(codes.DeadlineExceeded, "%v", err) 43 | case context.Canceled, netctx.Canceled: 44 | return streamErrorf(codes.Canceled, "%v", err) 45 | } 46 | return streamErrorf(codes.Internal, "Unexpected error from context packet: %v", err) 47 | } 48 | 49 | // contextFromRequest returns a context from the HTTP Request. 50 | func contextFromRequest(r *http.Request) context.Context { 51 | return r.Context() 52 | } 53 | -------------------------------------------------------------------------------- /vendor/google.golang.org/grpc/transport/log.go: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright 2017 gRPC authors. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | 19 | // This file contains wrappers for grpclog functions. 20 | // The transport package only logs to verbose level 2 by default. 21 | 22 | package transport 23 | 24 | import "google.golang.org/grpc/grpclog" 25 | 26 | const logLevel = 2 27 | 28 | func infof(format string, args ...interface{}) { 29 | if grpclog.V(logLevel) { 30 | grpclog.Infof(format, args...) 31 | } 32 | } 33 | 34 | func warningf(format string, args ...interface{}) { 35 | if grpclog.V(logLevel) { 36 | grpclog.Warningf(format, args...) 37 | } 38 | } 39 | 40 | func errorf(format string, args ...interface{}) { 41 | if grpclog.V(logLevel) { 42 | grpclog.Errorf(format, args...) 43 | } 44 | } 45 | 46 | func fatalf(format string, args ...interface{}) { 47 | if grpclog.V(logLevel) { 48 | grpclog.Fatalf(format, args...) 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /vendor/google.golang.org/grpc/version.go: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright 2018 gRPC authors. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | 19 | package grpc 20 | 21 | // Version is the current grpc version. 22 | const Version = "1.13.0" 23 | -------------------------------------------------------------------------------- /vendor/gopkg.in/urfave/cli.v1/.flake8: -------------------------------------------------------------------------------- 1 | [flake8] 2 | max-line-length = 120 3 | -------------------------------------------------------------------------------- /vendor/gopkg.in/urfave/cli.v1/.gitignore: -------------------------------------------------------------------------------- 1 | *.coverprofile 2 | node_modules/ 3 | -------------------------------------------------------------------------------- /vendor/gopkg.in/urfave/cli.v1/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | sudo: false 3 | dist: trusty 4 | osx_image: xcode8.3 5 | go: 1.8.x 6 | 7 | os: 8 | - linux 9 | - osx 10 | 11 | cache: 12 | directories: 13 | - node_modules 14 | 15 | before_script: 16 | - go get github.com/urfave/gfmrun/... || true 17 | - go get golang.org/x/tools/cmd/goimports 18 | - if [ ! -f node_modules/.bin/markdown-toc ] ; then 19 | npm install markdown-toc ; 20 | fi 21 | 22 | script: 23 | - ./runtests gen 24 | - ./runtests vet 25 | - ./runtests test 26 | - ./runtests gfmrun 27 | - ./runtests toc 28 | -------------------------------------------------------------------------------- /vendor/gopkg.in/urfave/cli.v1/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2016 Jeremy Saenz & Contributors 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/gopkg.in/urfave/cli.v1/appveyor.yml: -------------------------------------------------------------------------------- 1 | version: "{build}" 2 | 3 | os: Windows Server 2016 4 | 5 | image: Visual Studio 2017 6 | 7 | clone_folder: c:\gopath\src\github.com\urfave\cli 8 | 9 | environment: 10 | GOPATH: C:\gopath 11 | GOVERSION: 1.8.x 12 | PYTHON: C:\Python36-x64 13 | PYTHON_VERSION: 3.6.x 14 | PYTHON_ARCH: 64 15 | 16 | install: 17 | - set PATH=%GOPATH%\bin;C:\go\bin;%PATH% 18 | - go version 19 | - go env 20 | - go get github.com/urfave/gfmrun/... 21 | - go get -v -t ./... 22 | 23 | build_script: 24 | - python runtests vet 25 | - python runtests test 26 | - python runtests gfmrun 27 | -------------------------------------------------------------------------------- /vendor/gopkg.in/urfave/cli.v1/category.go: -------------------------------------------------------------------------------- 1 | package cli 2 | 3 | // CommandCategories is a slice of *CommandCategory. 4 | type CommandCategories []*CommandCategory 5 | 6 | // CommandCategory is a category containing commands. 7 | type CommandCategory struct { 8 | Name string 9 | Commands Commands 10 | } 11 | 12 | func (c CommandCategories) Less(i, j int) bool { 13 | return c[i].Name < c[j].Name 14 | } 15 | 16 | func (c CommandCategories) Len() int { 17 | return len(c) 18 | } 19 | 20 | func (c CommandCategories) Swap(i, j int) { 21 | c[i], c[j] = c[j], c[i] 22 | } 23 | 24 | // AddCommand adds a command to a category. 25 | func (c CommandCategories) AddCommand(category string, command Command) CommandCategories { 26 | for _, commandCategory := range c { 27 | if commandCategory.Name == category { 28 | commandCategory.Commands = append(commandCategory.Commands, command) 29 | return c 30 | } 31 | } 32 | return append(c, &CommandCategory{Name: category, Commands: []Command{command}}) 33 | } 34 | 35 | // VisibleCommands returns a slice of the Commands with Hidden=false 36 | func (c *CommandCategory) VisibleCommands() []Command { 37 | ret := []Command{} 38 | for _, command := range c.Commands { 39 | if !command.Hidden { 40 | ret = append(ret, command) 41 | } 42 | } 43 | return ret 44 | } 45 | -------------------------------------------------------------------------------- /vendor/gopkg.in/urfave/cli.v1/cli.go: -------------------------------------------------------------------------------- 1 | // Package cli provides a minimal framework for creating and organizing command line 2 | // Go applications. cli is designed to be easy to understand and write, the most simple 3 | // cli application can be written as follows: 4 | // func main() { 5 | // cli.NewApp().Run(os.Args) 6 | // } 7 | // 8 | // Of course this application does not do much, so let's make this an actual application: 9 | // func main() { 10 | // app := cli.NewApp() 11 | // app.Name = "greet" 12 | // app.Usage = "say a greeting" 13 | // app.Action = func(c *cli.Context) error { 14 | // println("Greetings") 15 | // return nil 16 | // } 17 | // 18 | // app.Run(os.Args) 19 | // } 20 | package cli 21 | 22 | //go:generate python ./generate-flag-types cli -i flag-types.json -o flag_generated.go 23 | -------------------------------------------------------------------------------- /vendor/gopkg.in/urfave/cli.v1/funcs.go: -------------------------------------------------------------------------------- 1 | package cli 2 | 3 | // BashCompleteFunc is an action to execute when the bash-completion flag is set 4 | type BashCompleteFunc func(*Context) 5 | 6 | // BeforeFunc is an action to execute before any subcommands are run, but after 7 | // the context is ready if a non-nil error is returned, no subcommands are run 8 | type BeforeFunc func(*Context) error 9 | 10 | // AfterFunc is an action to execute after any subcommands are run, but after the 11 | // subcommand has finished it is run even if Action() panics 12 | type AfterFunc func(*Context) error 13 | 14 | // ActionFunc is the action to execute when no subcommands are specified 15 | type ActionFunc func(*Context) error 16 | 17 | // CommandNotFoundFunc is executed if the proper command cannot be found 18 | type CommandNotFoundFunc func(*Context, string) 19 | 20 | // OnUsageErrorFunc is executed if an usage error occurs. This is useful for displaying 21 | // customized usage error messages. This function is able to replace the 22 | // original error messages. If this function is not set, the "Incorrect usage" 23 | // is displayed and the execution is interrupted. 24 | type OnUsageErrorFunc func(context *Context, err error, isSubcommand bool) error 25 | 26 | // FlagStringFunc is used by the help generation to display a flag, which is 27 | // expected to be a single line. 28 | type FlagStringFunc func(Flag) string 29 | --------------------------------------------------------------------------------